<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AskApache &#187; Search Results  &#187;  analytics</title>
	<atom:link href="http://www.askapache.com/search/analytics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.askapache.com</link>
	<description>Advanced Web Development</description>
	<lastBuildDate>Thu, 26 Apr 2012 11:29:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Htaccess Rewrites for Moving Urls</title>
		<link>http://www.askapache.com/htaccess/htaccess-rewrites.html</link>
		<comments>http://www.askapache.com/htaccess/htaccess-rewrites.html#comments</comments>
		<pubDate>Sat, 29 Oct 2011 14:41:55 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Htaccess]]></category>
		<category><![CDATA[301 Redirects]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=5231</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/htaccess/htaccess-rewrites.html"></a><a href="http://www.askapache.com/htaccess/htaccess-rewrites.html"><cite>AskApache.com</cite></a></p><p>This is part 2 of the <a href="http://www.askapache.com/htaccess/htaccess.html" title="Htaccess Tutorial like no other">exhaustive Htaccess Tutorial</a>.  I realized it was so lengthy that search engines and visitors were having real problems with it, so I moved half of it here.  But this gave me the opportunity to add a ton of new stuff that I hadn't been able to add to the main htaccess tutorial.  And now this new part 2 is already twice as big as the original!  To sum up, this is a work in progress.</p>


<h2>Moving Half of Original Tutorial to a new URL - SEO Rewriting</h2>
<p>Well, the original tutorial was at /htaccess/apache-htaccess.html, but it was such a huge article that search engines were dropping it!  So I split it into 3 new urls.</p>
<ol>
<li>/htaccess/htaccess.html - 1</li>
<li>/htaccess/htaccess-rewrites.html - Rewrites</li>
<li>/htaccess/apache-htaccess-2.html - Part 2</li>
</ol>

<p>The /htaccess/apache-htaccess-2.html is a lot of unfinished new stuff, and the /htaccess/htaccess-rewrites.html (this very page) still needs to be split several times to get the filesize down.</p>

<h3>301 Link Juice</h3>
<p>The /apache-htaccess.html url has been around since 2006, and it was full of original ideas and examples for using htaccess.  Almost every htaccess guide or tutorial published since then has many of the examples and ideas from that tutorial, (I encourage people to modify and republish everything on this site according to copyright).  I know it, the authors sometimes know it, but the main point is Google for sure knows it.  That's the beauty of creating unique content, Google sees that.  So that /apache-htaccess.html link has extreme link juice, from all the sites, books, papers, and presentations that have linked to it since 2006.</p>

<h4>Filesize Is important</h4>
<p>I like to use my blog as a way to keep notes about my research organized, and I am extremely good at doing research, unfortunately, that means I have a huge article.  The filesize for the html alone is larger than all the other resources like javascript and images, combined.</p>
<ul>
<li>So that means it is very difficult to view on a mobile device, or a slow connection.</li>
<li>For google-bot and other search engine crawlers and robots, this is a huge problem (I made a big mistake letting it get that size).</li>
<li>The robot has to parse an enormous single html file, containing hundreds/thousands of external and internal links, and its such an issue they can decide to just skip indexing that url until the filesize is manageable.</li>
<li>Once again, it's all about the human experience, a huge single file is not good for anyone who isn't printing it out to read offline.</li>
</ul>

<h4>Starting Fresh without losing juice</h4>
<p>So since the page wasn't being indexed much since it was so huge, I decided to split up the content into new separate urls and utilize a 301 Redirect to transfer all the link juice from /apache-htaccess.html to /htaccess.html.</p>


<h2>301 Redirect Timeline</h2>
<ol>
<li>Now, the idea is to take the first pages from the original multi-page guide, do a little improvement on that content, and save it to the new url /htaccess.html.</li>
<li>Then just continue taking the next page from the remaining original guide and creating new pages using the original links structure.  /apache-htaccess-2.html, /apache-htaccess-3.html, etc.. This is a secondary backup to the new /htaccess.html url, which will receive the 301 link juice from the old url, but these secondary pages will help keep the links on external sites good.</li>
<li>Then, I setup a 301 Redirect in my .htaccess file to redirect the old url to the new /htaccess.html url.</li>
<li>Finally, I delete the old url and it is replaced forever by a 301 Redirect pointing to my new location, filesize problems eliminated.</li>
</ol>

<h3>301 Redirect Code Used</h3>
<p>This is so easy to do with RedirectMatch, way faster and easier than using mod_rewrite to handle this, and much less overhead.  Note that this is a general command that I will leave up for a few weeks and slowly tighten it up by looking at my Google Analytics and Apache Logs.  For instance, this first redirectmatch rule is an older RedirectMatch I still have active to redirect all the old links pointing at /2006/htaccess/apache-htaccess.html to /htaccess/apache-htaccess.html from when I ditched the date-based permalinks back in 2007, and you can see it is a little tighter than the 2nd one which also redirects requests for apache-htaccess.html/feed/ or trackback or whatever.</p>
<pre>RedirectMatch 301 ^/2006/.*apache-htaccess.html$ http://www.askapache.com/htaccess/apache-htaccess.html
RedirectMatch 301 ^/.*apache-htaccess.html(.*)$ http://www.askapache.com/htaccess/htaccess.html$1</pre>



<h2>Advanced 301 Redirects for SEO</h2>
<p>I wrote a couple of articles that go into detail about maximizing the SEO with linking and redirects, it remains one of my most helpful articles to anyone trying to rank higher the right way, the Google way.. <a href="http://www.askapache.com/seo/seo-advanced-pagerank-indexing.html">SEO Secrets of AskApache Part 2</a></p><p><a href="http://www.askapache.com/htaccess/htaccess-rewrites.html"></a><a href="http://www.askapache.com/htaccess/htaccess-rewrites.html">Htaccess Rewrites for Moving Urls</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/htaccess/htaccess-rewrites.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Top 3 Speed Tips for Sites using Google Analytics</title>
		<link>http://www.askapache.com/google/google-analytics-speed-tips.html</link>
		<comments>http://www.askapache.com/google/google-analytics-speed-tips.html#comments</comments>
		<pubDate>Fri, 17 Oct 2008 06:31:23 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=1689</guid>
		<description><![CDATA[<p><a id="id23" href="http://www.askapache.com/javascript/google-analytics-speed-tips.html" class="IFL" title="Tips for Sites using Google Analytics"></a>Top 3 ways to speed up websites that use Google Analytics.  Host Script Locally, Fix Google-Analytics Cookie Domain, and Failsafe Loading for optimum tracking statistics.<br class="C" /></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/google/google-analytics-speed-tips.html"></a><a href="http://www.askapache.com/google/google-analytics-speed-tips.html"><cite>AskApache.com</cite></a></p><p><a id="id23" href="http://www.askapache.com/javascript/google-analytics-speed-tips.html"></a>I've written alot about how I speed up websites, but there is much more to cover.  Here are the 3 ways I speed up my site by playing with the Google Analytics Tracking Code.<br class="C" /></p>

<ol>
<li><a href="http://www.askapache.com/javascript/google-analytics-speed-tips.html#googleanalyticshosting">Host the Google-Analytics ga.js file locally</a></li>
<li><a href="http://www.askapache.com/javascript/google-analytics-speed-tips.html#googleanalyticsdomain">Set Correct Cookie Domain</a></li>
<li><a href="http://www.askapache.com/javascript/google-analytics-speed-tips.html#googleanalyticsloading">Make Sure Google Analytics Loads</a></li>
</ol>


<h2><a id="googleanalyticsdefault">Default Google-Analytics Tracking Code</a></h2>
<pre>&lt;script type="text/javascript"&gt;
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src=&#039;" + gaJsHost + "google-analytics.com/ga.js&#039; type=&#039;text/javascript&#039;%3E%3C/script%3E"));
&lt;/script&gt;
&lt;script type="text/javascript"&gt;
var pageTracker = _gat._getTracker("UA-2452345-5");
pageTracker._trackPageview();
&lt;/script&gt;</pre>
<hr class="C" />

<h2>1. <a id="googleanalyticshosting">Hosting the Google ga.js file locally</a></h2>
<p>Instead of calling the <a href="http://www.google-analytics.com/ga.js">http://www.google-analytics.com/ga.js</a> file in your site's html, you can instead save the <code>ga.js</code> source code and serve it from on your own server!  This <strong>reduces DNS lookups</strong>, gives you <strong>control over caching</strong>, and if you combine the <code>ga.js</code> with a javascript file already on your site like I do, you <strong>reduce HTTP Requests</strong>, <strong>reduce browser cache lookups</strong>, etc.</p>
<p>For this site, I added the ga.js code to my http://static.askapache.com/z/j/apache-999.js file, then I <a href="http://www.askapache.com/tools/online-compression-tool-compares-packer-jsmin-dojo-and-yui-compressor.html">compressed it online</a> and saved to serve!</p>
<p class="anote"><strong>How to Do it: </strong><a href="http://www.askapache.com/javascript/serve-external-javascript-files-locally-for-increased-speed.html">Serve External Javascript Files locally for Increased Speed</a></p>
<hr class="C" />


<h2>2. <a id="googleanalyticsdomain">Set Correct Domain for Cookie</a></h2>
<p>For those websites who employ <a href="http://www.askapache.com/htaccess/apache-speed-subdomains.html">multiple sub-domains to serve static content</a>, and you are using the default google-analytics javascript code for website statistics, you may be able to get some speed by forcing the google analytics cookie to only be sent for your non-static subdomain.</p>
<p>I just noticed this on my site the other day while watching the wire:</p>
<p>The Google Analytics cookie was being set for the domain <code>.askapache.com</code> and so it was being sent needlessly with every request to every subdomain, when it only should be sent for requests to <code>www.askapache.com</code>.</p>

<h3>Specify Google-Analytics Cookie Domain</h3>
<p>So I googled for an answer for awhile and finally found the solution in the ga.js code itself.  There is a command called <code>_setDomainName</code> that lets you set the domain for the cookie.  The following code sets the GA cookie for <code>.www.askapache.com</code>, ensuring that the cookie will not be sent needlessly for images and other static content.</p>
<pre>var pageTracker = _gat._getTracker("UA-732153-7");
pageTracker._setDomainName("www.askapache.com");
pageTracker._trackPageview();</pre>
<hr class="C" />

<h2>3. <a id="googleanalyticsloading">Make Sure Google Analytics Loads</a></h2>
<p>Look at the source code for this page to see how I do it.  Here is what is going on:</p>
<ol>
<li>Add the google javascript at the bottom of my source code to make sure the HTML and DOM is fully loaded before first calling the script for download.</li>
<li>Check that the google-javascript is loaded by testing that the object called _gat exists, which is the internal object created.</li>
<li>Initiate google-analytics</li>
</ol>

<h3>The Safer Google-Analytics Include Code</h3>
<pre>&lt;script type="text/javascript"&gt;
if (typeof(_gat) == "object") {
  var pageTracker = _gat._getTracker("UA-732153-7");
  pageTracker._setDomainName("www.askapache.com");
  pageTracker._initData();
  pageTracker._trackPageview();
}
&lt;/script&gt;</pre><p><a href="http://www.askapache.com/google/google-analytics-speed-tips.html"></a><a href="http://www.askapache.com/google/google-analytics-speed-tips.html">Top 3 Speed Tips for Sites using Google Analytics</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/google/google-analytics-speed-tips.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Serve External Javascript Files locally for Increased Speed</title>
		<link>http://www.askapache.com/javascript/serve-external-javascript-files-locally-for-increased-speed.html</link>
		<comments>http://www.askapache.com/javascript/serve-external-javascript-files-locally-for-increased-speed.html#comments</comments>
		<pubDate>Wed, 01 Oct 2008 06:55:46 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=1542</guid>
		<description><![CDATA[<p><a class="IFL hs hs16" href="http://uploads.askapache.com/2008/10/google-external-javascript.png" title="Screenshot of bash shell script for downloading externally hosted javascript files"></a>One way I speed up AskApache.com is by downloading external third-party javascript files to host on my own server instead of externally.  In addition to the obvious speed boost, this lets you configure the caching and compression settings for the files.<br class="C" /></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/javascript/serve-external-javascript-files-locally-for-increased-speed.html"></a><a href="http://www.askapache.com/javascript/serve-external-javascript-files-locally-for-increased-speed.html"><cite>AskApache.com</cite></a></p><p><a class="IFL hs hs16" href="http://uploads.askapache.com/2008/10/google-external-javascript.png" title="Screenshot of bash shell script for downloading externally hosted javascript files"></a>One of the ways I speed up AskApache.com is by downloading all the external javascript files to my server and then serve them from my own server instead of the external site.  Currently I'm using this method to serve the <a href="http://www.google-analytics.com/ga.js">Google Analytics</a> javascript file, and the <a href="http://edge.quantserve.com/quant.js">Quantcast</a> javascript file.<br class="C" /></p>


<h2>Speed Benefit</h2>
<p>The speed benefit occurs because normally a site visitor has to perform a DNS query for both the google-analytics.com and quantcast.com servers, create a connection to each server, and then download the files.  By hosting these scripts on your own server you remove all the extra DNS queries, and by hosting all the files on your single server you enable advanced HTTP 1/1 protocol features like Pipelining the requests, which means a single connection for multiple files.</p>


<h2>Cache and Compression Control</h2>
<p>Serving these javascript files from your own server gives you complete control over the caching and compression settings of those files, which may not seem like a big deal... unless you know about the advanced caching and compression techniques available to make your site super-fast.</p>

<h3>Caching Control</h3>
<p>By using the <a href="http://www.askapache.com/htaccess/mod_rewrite-fix-for-caching-updated-files.html">mod_rewrite cache hack</a> like I do, you can make sure that a fresh version of the <code>.js file</code> is used by your visitors.</p>

<h3>Compression Control</h3>
<p>You can also specify advanced compression for these files, which could mean using Apache's mod_deflate or mod_gzip modules, or you can even use a compression tool like Dojo's Shrinksafe, Packer, JSMin, or YUICompressor to further compress the javascript files.</p>


<h2>Automated Downloading with Crontab</h2>
<p>Using crontab I tell my web server to run this shell script every day, to make sure I have updated versions of all the files.  Here's the crontab entry I use to run this shell script every day.</p>
<pre>@daily /bin/sh /home/cron-scripts/grab_javascripts.sh 2&gt;&amp;1 &amp;&gt;/dev/null</pre>


<h2>Shell Script to Download JS</h2>
<p>I created a simple Bash shell-script to download the javascript files.  All you need to do is modify the variables to save to your directory and send your site as the Referring URL and you are good to go.  You can add as many files as you want by adding them to the JSFILE array.</p>
<p>You can also download the shell-script: <a href='http://uploads.askapache.com/2008/10/grab_javascripts.sh'>grab_javascripts.sh</a></p>
<pre>#!/bin/bash
# 2008-09-30
umask 022
VER="2.0"
&nbsp;
### Set as the referring url for downloads
SITE=http://www.askapache.com/
&nbsp;
### Directory to save the downloaded files
JSD=$HOME/j/
&nbsp;
### The files to download
JSFILE[0]=http://www.google-analytics.com/ga.js
&nbsp;
### run script with args to turn on debugging
[[ $# -ne 0 ]] &amp;&amp; set -o xtrace &amp;&amp; set -o verbose
&nbsp;
### SHELL OPTIONS
set +o noclobber # allowed to clobber files
set +o noglob # globbing on
set -e # abort on first error
shopt -s extglob
&nbsp;
#--=--=--=--=--=--=--=--=--=--=--#
# pt
#==-==-==-==-==-==-==-==-==-==-==#
function pt(){
  case ${1:-d} in
   i) echo -e "${C6}=&gt; ${C4}${2} ${C0}"; ;;
   m) echo -en "\n\n${C2}&gt;&gt;&gt; ${C4}${2} ${C0}\n\n"; ;;
   *) echo -e "\n${C8} DONE ${C0} \n"; ;;
  esac
}
&nbsp;
#=# CATCH SCRIPT KILLED BY USER
trap &#039;kill -9 $$&#039; SIGHUP SIGINT SIGTERM
&nbsp;
#=# MAKE MAIN SCRIPT NICE AS POSSIBLE SINCE IT DOESNT DO MUCH
renice 19 -p $$ &amp;&gt;/dev/null
&nbsp;
#=# TURNS ON COLORING ONLY FOR TERMS THAT CAN SUPPORT IT
C="\033[";C0=;C1=;C2=;C3=;C4=;C5=;C6=;C7=;C8=;C9=;
  C0="${C}0m";C1="${C}1;30m";C2="${C}1;32m";C3="${C}0;32m";C4="${C}1;37m"
  C5="${C}0;36m";C6="${C}1;35m";C7="${C}0;37m";C8="${C}30;42m";C9="${C}1;36m";
clear
echo -e "${C1} __________________________________________________________________________ "
echo -e "| ${C2}             ___       __    ___                 __             ${C1}         |"
echo -e "| ${C2}            / _ | ___ / /__ / _ | ___  ___ _____/ /  ___        ${C1}         |"
echo -e "| ${C2}           / __ |(_-&lt;/  &#039;_// __ |/ _ \/ _ \`/ __/ _ \/ -_)       ${C1}         |"
echo -e "| ${C3}          /_/ |_/___/_/\_\/_/ |_/ .__/\_,_/\__/_//_/\__/        ${C1}         |"
echo -e "| ${C3}                               /_/                              ${C1}         |"
echo -e "|                                                                          |"
echo -e "|                 ${C4} LOCAL JAVASCRIPT FILES SCRIPT Version ${VER} ${C1}              |"
echo -e "${C1} __________________________________________________________________________ ${C0} \n\n"
&nbsp;
#=# BUILD INCOMING DIRS
[[ ! -d "${JSD}" ]] &amp;&amp; pt m "BUILDING DIRS" &amp;&amp; mkdir -p $JSD &amp;&gt;/dev/null &amp;&amp; pt i "CREATED $JSD" &amp;&amp; pt
&nbsp;
#=# DOWNLOAD JAVASCRIPT FILES
cd $JSD &amp;&amp; pt m "DOWNLOADING JAVASCRIPT FILES"
for theurl in "${JSFILE[@]}"; do
pt i "${theurl}"
curl -m 60 --connect-timeout 10 --retry 10 --retry-delay 180 -s -S -L -e &#039;${SITE}&#039; -A &#039;Mozilla/5.0&#039; -O "${theurl}"
done
pt &amp;&amp; cd $OLDPWD
&nbsp;
######## curl options
# -S Show error. With -s, make curl show errors when they occur
# -s Silent mode. Don&#039;t output anything
# -e  Referer URL (H)
# -H &lt;line&gt; Custom header to pass to server (H)
# -L  Follow Location: hints (H)
# -A &lt;string&gt; User-Agent to send to server (H)
# -m &lt;seconds&gt; Maximum time allowed for the transfer
# --connect-timeout &lt;seconds&gt; Maximum time allowed for connection
# --globoff  Disable URL sequences and ranges using {} and []
# -O  Write output to a file named as the remote file
# --retry &lt;num&gt;  Retry request &lt;num&gt; times if transient problems occur
# --retry-delay &lt;seconds&gt; When retrying, wait this many seconds between each
# --retry-max-time &lt;seconds&gt; Retry only within this period
#############################################################################
&nbsp;
exit 0</pre><p><a href="http://www.askapache.com/javascript/serve-external-javascript-files-locally-for-increased-speed.html"></a><a href="http://www.askapache.com/javascript/serve-external-javascript-files-locally-for-increased-speed.html">Serve External Javascript Files locally for Increased Speed</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/javascript/serve-external-javascript-files-locally-for-increased-speed.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>About AskApache</title>
		<link>http://www.askapache.com/about</link>
		<comments>http://www.askapache.com/about#comments</comments>
		<pubDate>Mon, 15 Sep 2008 12:26:49 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
		
		<guid isPermaLink="false">http://www.askapache.com/about/</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/about"></a><a href="http://www.askapache.com/about"><cite>AskApache.com</cite></a></p><p>The goal of AskApache.com is simple - To provide free access to knowledge and data with the goal of empowering people.. or more melodramatically:  <strong>"Power to the People!"</strong></p>
<p><strong>Why the name AskApache?</strong>  AskApache was chosen to show and pay <strong>respect</strong> to the contributors of the <a href="http://httpd.apache.org">Apache Web Server</a>.  Literally it means to ask Apache when facing a problem, by searching the <strong>Open-Source</strong>, contacting a board/list, or browsing the documentation.</p>



<h3>Technology Interests</h3>
<ol>
    <li><strong>CSS</strong></li>
    <li><strong>XHTML</strong> (<em>strict!</em>)</li>
    <li><strong>Javascript</strong> (<em>unobtrusive, strict!</em>)</li>
    <li><strong>NetSec</strong> (<em>network security, hack the planet</em>)    </li>
    <li><strong>PHP, Python, Ruby, Perl, Ocaml, Shell-Scripting</strong> (<em>strict mostly!</em>)</li>
    <li><strong>AJAX</strong> (<em>strict,crossbrowser,degrades gracefully!</em>)</li>
    <li><strong>Linux</strong> <em>{Arch-Linux, Slackware, Gentoo, Red Hat, Fedora}</em></li>
    <li><strong>BSD/Unix</strong> <em>{OpenBSD, FreeBSD, NetBSD}</em></li>
    <li><strong>Software</strong> <em>{Photoshop, Dreamweaver, Sorenson, Flash, QuickTime, ffmpeg, nirsoft, sysinternals, Adobe Creative Suite, etc.}</em></li>
    <li><strong>Windows</strong> <em>{for Workgroups, 3.1, 95, 98, me, 2000, NT Workstation&amp;Server,  XP Pro&amp;Home SP1&amp;SP2}</em></li>
    <li>And of course, if not especially, the <strong><a href="http://www.askapache.com/htaccess/htaccess.html">Apache Web Server, .htaccess, and mod_rewrite</a>!</strong></li>
</ol>



<h3>AskApache.com Info</h3>
<ol>
    <li><a href="https://plus.google.com/101616558702207714980" rel="me">Google +</a></li>
    <li>Popular Web Design and Development Blogs on Google</li>
    <li><a href="http://www.alexa.com/topsites/category/Top/Computers/Internet/Web_Design_and_Development/Weblogs">Top Weblogs on Alexa</a></li>
    <li><a href="http://www.technorati.com/people/technorati/askapache">Technorati</a></li>
    <li><a href="http://twitter.com/AskApache">AskApache Twitter</a></li>
    <li><a href="http://profile.typekey.com/AskApache/">Typekey</a></li>
    <li><a href="http://askapache.stumbleupon.com/">Stumbleupon</a></li>
    <li><a href="http://www.last.fm/user/AskApache">Last.fm</a></li>
    <li><a href="http://www.seomoz.org/users/view/25352">seomoz</a></li>
    <li><a href="http://www.livejournal.com/userinfo.bml?userid=15825935&amp;t=I">LiveJournal</a></li>
    <li><a href="http://digg.com/users/apachehtaccess">Digg</a></li>
    <li><a href="http://flickr.com/people/htaccess/">Flickr</a></li>
    <li><a href=" http://www.mybloglog.com/buzz/members/AskApache">MyBlogLog</a></li>
    <li><a href="http://wordpress.org/extend/plugins/profile/askapache">WordPress Plugins</a>, <a href="http://wordpress.org/support/profile/407510">Support Forum</a>, <a href="http://codex.wordpress.org/User:AskApache">Codex Wiki</a></li>
    <li><a href="http://www.blogcatalog.com/user/askapache">BlogCatalog</a></li>
</ol>


<h2>More AskApache</h2>
<ol>
    <li><a rel="nofollow" href="http://www.blogcatalog.com/blogs/askapache-web-fire.html">BlogCatalog</a></li>
    <li><a rel="nofollow" href="http://www.statsaholic.com/askapache.com">StatsAholic</a></li>
    <li><a rel="nofollow" href="http://www.alexa.com/data/details/main?url=askapache.com">Alexa</a></li>
    <li><a rel="nofollow" href="http://www.technorati.com/search/askapache.com">Technorati</a></li>
    <li><a rel="nofollow" href="http://siteanalytics.compete.com/askapache.com/">Compete</a></li>
    <li><a rel="nofollow" href="http://www.quantcast.com/askapache.com">Quantcast</a></li>
    <li><a rel="nofollow" href="http://whois.domaintools.com/askapache.com">DomainTools</a></li>
    <li><a rel="nofollow" href="http://search.live.com/results.aspx?q=%2Bsite%3Awww.askapache.com">Live</a></li>
    <li><a rel="nofollow" href="http://www.google.com/search?q=site%3Aaskapache.com">Google</a></li>
    <li><a rel="nofollow" href="http://www.findforward.com/?q=askapache&amp;t=world">FindForward</a></li>
    <li><a href="http://www.alexa.com/topsites/category/Top/Computers/Internet/Web_Design_and_Development/Weblogs">Alexa Directory</a><a href="http://www.alexa.com/search?q=askapache.com">Alexa Info</a></li>
    <li><a rel="nofollow" href="http://www.mybloglog.com/buzz/community/apache-htaccess/">MyBlogLog htaccess Group</a></li>
</ol>


<h2>AskApache mirrors</h2>
<p>Every once in awhile I come across a project that is so indescribably great that I decide to help out by mirroring and contributing to the content.</p>
<ul>
    <li><a href="http://curl.askapache.com/" title="curl, libcurl">cURL / libcurl</a></li>
    <li><a href="http://nongnu.askapache.com/" title="Savannah Non-gnu free software">Savannah - nongnu</a></li>
    <li><a href="http://wireshark.askapache.com/" title="WireShark">WireShark Network God</a></li>
</ul>
<p><em>Google if you are reading this, I'm willing to relocate. ;)  Microsoft, no thanks.</em></p><p><a href="http://www.askapache.com/about"></a><a href="http://www.askapache.com/about">About AskApache</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/about/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>SEO Secrets of AskApache.com</title>
		<link>http://www.askapache.com/seo/seo-secrets.html</link>
		<comments>http://www.askapache.com/seo/seo-secrets.html#comments</comments>
		<pubDate>Thu, 29 May 2008 01:45:02 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://www.askapache.com/?p=566</guid>
		<description><![CDATA[<p><a rel="lb" class="IFL hs hs31" href='http://www.askapache.com/seo/seo-secrets.html' title="SEO Secrets for Google High Ranking"></a>Learn how in a year, with no previous blogging experience this blog was able to rank so high in search engines and achieve 15,000 unique visitors every day.  Uses combination of tricks and tips from throughout AskApache.com for Search Engine Optimization.<br class="C" /></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/seo/seo-secrets.html"></a><a href="http://www.askapache.com/seo/seo-secrets.html"><cite>AskApache.com</cite></a></p><p><a rel="lb" class="IFL hs hs31" href='http://uploads.askapache.com/2008/04/google-rankings.png' title="SEO Secrets for Google High Ranking"></a>First let me say that I don't read SEO stuff, I don't participate in the SEO community, I only have an interest in regards to the technology used by the search engines.  All websites are hosted on servers, mostly Apache, and that is the primary topic of this blog.  During the past year of this blog, my research into non-seo areas has turned up some very valuable SEO techniques.. All of them legal, ethical, and genuinely good for the Internet at large.<br class="C" /></p>

<p class="anote"><strong>Update:</strong> <a href="http://www.askapache.com/seo/seo-advanced-pagerank-indexing.html">SEO Secrets part II:  Advanced Indexing and Pagerank Control</a></p>


<h2>Some Background</h2>
<p>I started this blog in late 2006, my first foray into blogging, and I've been extremely successful at achieving top ten google rankings and maintaining on average 15K unique visitors/day (per google analytics) 85% of which come from search engine traffic.</p>

<p class="cnote"><strong>NOTE:</strong>  I take it for granted that anyone reading AskApache is an expert of some skill, if you aren't I apologize, I can't waste time on the easy stuff.</p>

<h2>Prerequisite SEO</h2>
<p>There are literally hundreds of thousands of SEO articles on the net, 99.9% of which are absolute garbage.  Especially in the sense that they just repeat the same 10 year old stuff.  However, to do any kind of advanced SEO like I am going to discuss in this article, I am assuming that you, the intelligent reader, has already read those and has a basic understanding of SEO fundamentals like meta tags, titles, keywords, etc.</p>


<h2>First, Great Content</h2>
<p>The foremost and most important step in achieving any kind of traffic is to produce great content.  I'm sure you've heard that a million times, but let me break it down how I perceive it.  Before I even started to mess with SEO for AskApache.com I began by writing articles.  At that point I didn't have a clue what my blog was going to be about or even if I was going to be doing it after a week.</p>

<h3>What is Content</h3>
<p>For me, being a top-paid professional web developer, I spend about 80% of my time doing research.  I think that is a bit uncommon, but its a throwback from the 10 years I spent in the network/computer security field, where research is 99% of the job, a story for another time perhaps.</p>

<p>So the research I was doing at that time was about best-practice standards-based web design, mainly <a href="http://www.askapache.com/xhtml/">XHTML Strict</a>, <a href="http://www.askapache.com/css/">CSS</a>, and <a href="http://www.askapache.com/javascript/">unobtrusive javascript</a>.  Each of those subjects has become near and dear to my heart, and each should also be mandatory learning for anyone interested in SEO.  The best advice I can give towards that end is checking out the CSS, Javascript, and XHTML Strict source code for this page and site.  And of course the holy <a href="http://www.w3.org/QA/">W3.org</a>.</p>

<p>In addition to striving to master those 3 subjects, I was also and always will be researching web programming languages like <a href="http://www.askapache.com/php/">PHP</a>, Ajax, Ruby, and Server Technology like <a href="http://www.askapache.com/apache/">Apache</a>.   Although I should note that my research into Apache and server technologies is more of a hobby than a job requirement, also a throwback to my days in the security industry and of course my love for <a href="http://nongnu.askapache.com/">open source software</a>.</p>

<h3>My Content</h3>
<p>So basically I was spending 25% of my time at work actually working, and the other 75% of the time I would research how to do something better, faster, the best.  Incredibly, I discovered or re-discovered a ton of tips, tricks, and methods to aid me in my work.  I was learning so much valuable information that I joined a couple of forums to discuss them and get feedback on making them even better.  Soon I realized that I was one of a small few who actually post content to a forum instead of just questions, so I decided to write my tutorials down on a blog, and AskApache was born.</p>

<p>So that is why this blog is comprised of almost 100% tutorials, and why almost all of them are completely original works you won't find elsewhere.  That's how I create content, but you might do something different.  Whatever it is that you do for content, just make sure you are providing VALUE with everything you do.  Not to everyone, just stuff that you would consider to have value if you were reading it.</p>

<h2>Second, Great Site</h2>
<p>Ok so I had 10 or so great articles that I knew would provide value for many web developers, but so what?  Nobody cares you know..  That's when I decided to take a closer look at the software that was running my new blog, WordPress, and I've been <a href="http://www.askapache.com/wordpress-plugins/">hacking the code</a> ever since on my never-ending quest to be the best and know the most advanced web development.  You'll see why in a couple paragraphs.</p>

<h3>I Mean, a Really Great Site</h3>
<p><a class="IFL" rel="lb" href='http://uploads.askapache.com/2008/04/the-web.png'><img src="http://uploads.askapache.com/2008/04/the-web-200x200.png" alt="Google Want A Spider Web" title="the-web" /></a>By great, I mean you need to make it incredibly user-friendly.  Every design and development decision you make should be about the visitor.  THATS the number one key to success on the net, regardless of endeavor.  Here is a list of things you definately need to have before you do SEO, I'm not listing obvious stuff like descriptions, titles, and good writing.<br class="C" /></p>
<ol>
<li>Intuitive and circular, your website should be a spider-web of urls.</li>
<li>Easy to read, plenty of white-space, design is your decision but I like minimalistic.</li>
<li>Super fast rendering.  You need effective <a href="http://www.askapache.com/web-cache/">caching and optimization</a>.</li>
<li>A very <a href="http://www.askapache.com/seo/google-ajax-search-seo-tips.html">helpful 404 error page</a>, hopefully never seen.</li>
</ol>


<h2>Focus in on your URL's</h2>
<p>Many sites that use a CMS of some kind, be it <a href="http://drupal.org/">Drupal</a> or <a href="http://wordpress.org/">WordPress</a>, have hundreds or thousands of URL's even if they only have 10 actual posts/articles.</p>

<h3>Removing Duplicate Content</h3>
<p>You've all heard this before, but almost no-one has taken it to the level I am going to discuss.  Bear with me.</p>

<p>Removing duplicate content is actually a very straightforward process if you know what you are doing, and if you don't, well that's why I'm going to quickly explain how to really do a good job.</p>

<h3>Locate Duplicate Content and URLS</h3>
<p>People misunderstand that you should just not repeat the same paragraph in a different article, that is partially true, but the main impact this has on your site is if you can access the same article from more than a single URL.</p>

<p>I hope you realize you MUST use pretty urls like my site and not codey looking ones with question marks.  You can find any potential <a href="http://www.askapache.com/htaccess/rewriterule-viewer-plugin.html">duplicate urls on wordpress</a> with the rewriterules plugin. Also look at Google's webmaster tools to look for any duplicate urls, and you can use xenus link sleuth tool as well.</p>

<h3>Remove Duplicate Urls with .htaccess</h3>
<p>Once you've found duplicate urls, you need to instruct google and other search engine robots to be redirected to the correct url.  By doing a 301 redirect you tell the search engines NOT to index the bad url, only the good one.  Below are some of the .htaccess code I use on this site to accomplish this technique, this is gold I myself use so pay attention.  It works.</p>

<h4>301 Redirects with mod_rewrite</h4>
<p>First lets start with one everyone should know, and the most common, <em>to www or not to www?</em></p>
<pre>RewriteCond %{HTTP_HOST} !^www\.askapache\.com$ [NC]
RewriteRule ^(.*)$ http://www.askapache.com/$1 [R=301,L]</pre>


<p>Its a highly rare individual who has seen this one, which forces requests for <code>.html/</code> to <code>.html</code></p>
<pre>RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /[^\.]+\.html/\ HTTP/ [NC]
RewriteRule ^(.*)\.html/$ http://www.askapache.com/$1.html [R=301,L]</pre>


<h4>301 Redirects without mod_rewrite</h4>
<p>For the rest of the duplicate urls that you find, I like to use Redirect and RedirectMatch.</p>

<p>This redirects requests that start with an <code>&amp; or /&amp;amp or /(</code>  to my homepage. </p>
<pre>RedirectMatch 301 ^/&amp;(.*)$ http://www.askapache.com/
RedirectMatch 301 ^/&amp;amp(.*)$ http://www.askapache.com/
RedirectMatch 301 ^/([\(]+)(.*)$ http://www.askapache.com/</pre>

<p>This redirects requests with <code>//whatev</code> to <code>/whatev</code></p>
<pre>RedirectMatch 301 ^//(.*)$ http://www.askapache.com/$1</pre>

<p>But this is just a brief look at what you will have to spend some time on.  There are detailed guides to doing this with <a href="http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html">mod_rewrite</a> and using <a href="http://www.askapache.com/htaccess/seo-search-engine-friendly-redirects-without-mod_rewrite.html">Redirect</a> on my blog.  Its time now for <strong>some real SEO tips</strong>.  The heart of the matter, as it were.</p>


<h2>Wrap It Up</h2>
<p>So I realize that was brief, so I want to really stress 2 things or you won't take away much from part 1.</p>

<h3>Locate Duplicate URLS</h3>
<p>This is truly one of the most important things in my personal experience.  I personally take this as extreme as I can, I regularly grep my access files, mod_security and error log files looking for bad URLS.  I am always checking them out to see if someone has a bad link to me somewhere, or if someone just typed it in wrong.   If its a bad link on a site, I will very politely attempt contacting the webmaster about it until they fix it.</p>

<p>Even I, with my many colorful years of Internet travel, was caught off-guard by the variety and creativity and the sheer number of urls people are using to link to my site.  I found that often bad links would be published because my URL was just too long, so I shortened the URL's.  Now of course bad links can't really even touch my site with all my 301's in place.</p>

<p>Besides grepping your server's logs, the 2nd best place to locate duplicate urls or just plain wrong urls is by using Googles free webmaster tools.  They keep track of all the bad urls linking to your site and allow you to download this data in a .csv spreadsheet format.  The first time I checked into this I found over 1,000 bad links, after a couple months with my RewriteRules and 301 Redirects, I've narrowed the list down to under 50 most months.  That is a powerful reason to use 301 Redirects, as we'll really get into in part 2.</p>


<h3>301 Redirect Bad URLS</h3>
<p>Finding the bad urls takes some time, a couple hours even, and then the whole reason you do that is to be able to create 301 Redirects for all of those bad urls to good urls.</p>

<p>One reason that I wasn't even aware of until several months ago is that when Googlebot locates a bad URL for your site, it tries to access it, and if you haven't planned for this in advance, your page most likely will return a <code>200 OK</code> status header, or if you are lucky a <code>404 Not Found</code> error, both of which really hurt you.</p>

<p>Basically, a 200 response will produce duplicate content in 99.9% of the time, and 404 responses will whisper to Google's algorithms that you don't know what you are doing and your site isn't authoritative.  200 means google will index your site, 404 means google won't index your site, but it also won't give up trying for awhile, which takes away from your real urls.</p>

<h4>What a 301 Response tells Google</h4>
<p><a href="http://www.askapache.com/htaccess/apache-status-code-headers-errordocument.html#status-301">301 Responses</a> were practically invented for user-agents/clients/web-crawling robots like google.  They instruct the client, whether that be a persons browser or a googlebot, that the resource/page that they are looking for is actually at a different URL.  This is an authoritative response that makes googlebot and other search engines ecstatic because now they can give up on the 200 and 404 responses that didn't really give them an answer either way.</p>

<p>On the other hand, a <a href="http://www.askapache.com/seo/404-google-wordpress-plugin.html">great 404</a> can and should be just as powerful as a 301, but hardly anyone uses them in the correct way according to HTTP 1.1 or 1.0 Specifications.  We'll tear that subject apart further down the road.</p>

<p>I'll leave this topic for now with one last idea, 301 Redirects when implemented and used correctly, actually redirect the page rank and search engine ranking for itself to the redirected / correct url.  That means if you have 1000 unique links pointing to your article, and all of them are incorrect in some way, if you can 301 redirect all of those bad links to your correct link you now have 1000 new good links!  It has to be done right and in a classy way though of course.</p>

<p class="cnote"><strong>Now that you have content and a great site, its <a href="http://www.askapache.com/seo/seo-advanced-pagerank-indexing.html">time to SEO like a mofo</a></strong>.</p><p><a href="http://www.askapache.com/seo/seo-secrets.html"></a><a href="http://www.askapache.com/seo/seo-secrets.html">SEO Secrets of AskApache.com</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/seo/seo-secrets.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Auto-Login to Google Analytics to impress Clients</title>
		<link>http://www.askapache.com/google/login-google-analytics.html</link>
		<comments>http://www.askapache.com/google/login-google-analytics.html#comments</comments>
		<pubDate>Wed, 26 Mar 2008 19:42:14 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.askapache.com/webmaster/login-google-analytics.html</guid>
		<description><![CDATA[<p><img class="IFL" src="http://static.askapache.com/i/google_analytics.gif" alt="" /><strong>Google Analytics for your clients sites is a no-brainer, it ROCKS!</strong>  I have 100+ client sites running Analytics and all of them have trouble-free<em> (no password or username to remember)</em> access to their site reports.  Thanks to the method in this post, my clients couldn't be happier.. <br class="C" /></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/google/login-google-analytics.html"></a><a href="http://www.askapache.com/google/login-google-analytics.html"><cite>AskApache.com</cite></a></p><p><strong>Adding Google Analytics to clients' sites is a no-brainer, it ROCKS!</strong></p>
<p>I have 100+ client web sites running Analytics and all of them have trouble-free<em> (no password or username to remember)</em> access to their site reports.  Thanks to the method outlined in this post, my clients couldn't be happier.. about that at least :)<br class="C" /></p>

<p class="enote"><strong>Special Thanks</strong> to <a href="http://bowmantechnology.com/">Bowman Technology</a> for coming up with a fix for problems people were having.  I'm glad it still is a working technique, Thanks! BT.</p>


<h2>Google Analytics Auto-Login Demo</h2>
<p><a class="aaButton FL" href="javascript:gi('googleanalyticslogin').submit();">Sign in to AskApache.info Analytics Account</a></p>
<hr />


<h2>5 Minute Install</h2>
<p><a rel="lb" class='IFL' href='http://uploads.askapache.com/2007/08/google-new-user.png' title='Create New User for Access'><img src='http://uploads.askapache.com/2007/08/google-new-user.thumbnail.png' alt='Create New User for Access' title="google new user.thumbnail google" /></a>Of course you need your own <a href="http://www.google.com/analytics/">Google Analytics</a> Administrator Account, if you don't already have one.<br /><br /><strong>Then I add a non-admin user</strong> for each of my clients sites, making sure to only allow access to their individual accounts.  <strong>I personally like</strong> using a naming system so that each new user's email address is <code>domain.tld@gmail.com</code>...  <br class="C" /></p>
<hr />


<p><a rel="lb" class='IFR' href='http://uploads.askapache.com/2007/08/google-user-added.png' title='Log out After Adding new User'><img src='http://uploads.askapache.com/2007/08/google-user-added.thumbnail.png' alt='Log out After Adding new User' title="google user added.thumbnail google" /></a><strong>In this example</strong> the username is <code>askapache.info@gmail.com</code> for the site <code>AskApache.info</code>, pretty easy to remember huh!<br /><br />Now all you need is the code to let your clients login without a username or password, because they prefer to roll down easy street whenever possible.<br class="C" /></p>
<hr />


<p><a rel="lb" class='IFL' href='http://uploads.askapache.com/2007/08/google-get-pass.png' title='Get the form input values by logging in to google analytics'><img src='http://uploads.askapache.com/2007/08/google-get-pass.thumbnail.png' alt='Get the form input values by logging in to google analytics' title="google get pass.thumbnail google" /></a><strong>You should be able to use</strong> the exact form code I have provided <em>(view source)</em>, modifying only the username and password.<br /><br />If you'd like you could use a Firefox add-on like <a href="https://addons.mozilla.org/en-US/firefox/addon/60">Web Developer</a> or <a href="https://addons.mozilla.org/en-US/firefox/addon/3829">Live HTTP Headers</a> to view the form data.  If you were really cool you would much prefer to use <a href="http://wireshark.askapache.com">WireShark</a> and <a href="http://www.askapache.com/tools/sniff-http-to-debug-apache-htaccess-and-httpdconf.html">view the HTTP</a> protocol in detail.  Basically you need to know the data that is sent to Google by the <a href="https://www.google.com/analytics/home/login?reset=1">login form</a>, then you can imitate that same data being sent by using a form on your own site. <br class="C" /></p>
<hr />



<h2>The Code</h2>
<p>The javascript is optional, you could just display the form if you want and use a form input to submit.  The handy thing about keeping the form invisible and using a button with javascript is that you can have multiple hidden forms and multiple buttons.  On the admin pages that I create for clients where I use this method, I have several other auto-login and other types of form submissions so its just easier.</p>
<h4>The button</h4>
<pre>&lt;a href="javascript:gi(&#039;googleanalyticslogin&#039;).submit();"&gt;Sign in to AskApache.info Analytics Account&lt;/a&gt;</pre>

<h4>The invisible form</h4>
<pre>&lt;form id="googleanalyticslogin" action="https://www.google.com/accounts/ServiceLoginBoxAuth" method="post"&gt;
&lt;input type="text" name="Email" class="gaia le val" id="Email" size="18" value="me@gmail.com" /&gt;
&lt;input type="password" name="Passwd" class="gaia le val" id="Passwd" size="18" value="Passw0rd" /&gt;
&lt;input type="checkbox" name="PersistentCookie" value="yes" /&gt;
&lt;input type="hidden" name="rmShown" value="1" /&gt;
&lt;input type="hidden" name="continue" value="http://www.google.com/analytics/home/?et=reset&amp;amp;hl=en-US" /&gt;
&lt;input type="hidden" name="service" value="analytics" /&gt;
&lt;input type="hidden" name="nui" value="1" /&gt;
&lt;input type="hidden" name="hl" value="en-US" /&gt;
&lt;input type="hidden" name="GA3T" value="oCGYxIWWGUE" /&gt;
&lt;input type="hidden" name="GALX" value="3Jces-nq404" /&gt;
&lt;input type="submit" /&gt;
&lt;/form&gt;</pre>


<p class="anote"><span>NOTE:</span> I'm still waiting to hear from google whether or not they are OK with this method, so if anyone hears anything let me know!</p>







<form id="googleanalyticslogin" action="https://www.google.com/accounts/ServiceLoginBoxAuth" method="post">
<input type="text" name="Email" class="gaia le val" id="Email" size="18" value="me@gmail.com" />
<input type="password" name="Passwd" class="gaia le val" id="Passwd" size="18" value="Passw0rd" />
<input type="checkbox" name="PersistentCookie" value="yes" />
<input type="hidden" name="rmShown" value="1" />
<input type="hidden" name="continue" value="http://www.google.com/analytics/home/?et=reset&amp;hl=en-US" />
<input type="hidden" name="service" value="analytics" />
<input type="hidden" name="nui" value="1" />
<input type="hidden" name="hl" value="en-US" />
<input type="hidden" name="GA3T" value="oCGYxIWWGUE" />
<input type="hidden" name="GALX" value="3Jces-nq404" />
<input type="submit" />
</form>



<hr /><hr /><p><a href="http://www.askapache.com/google/login-google-analytics.html"></a><a href="http://www.askapache.com/google/login-google-analytics.html">Auto-Login to Google Analytics to impress Clients</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/google/login-google-analytics.html/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Speed Up Google Analytics, use local ga.js</title>
		<link>http://www.askapache.com/google/ga-urchin-speed.html</link>
		<comments>http://www.askapache.com/google/ga-urchin-speed.html#comments</comments>
		<pubDate>Wed, 30 Jan 2008 13:35:11 +0000</pubDate>
		<dc:creator>AskApache</dc:creator>
				<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.askapache.com/linux/ga-urchin-speed.html</guid>
		<description><![CDATA[<p><a class="IFL" rel="lb" href='http://uploads.askapache.com/2008/01/google-analytics-speed.png' title='Google Analytics ga.js Speed'><img src='http://uploads.askapache.com/2008/01/google-analytics-speed.png' alt='Google Analytics ga.js Speed' /></a>Host Google Analytics ga.js file locally for increased speed!  Makes web pages load faster.<br class="C" /></p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.askapache.com/google/ga-urchin-speed.html"></a><a href="http://www.askapache.com/google/ga-urchin-speed.html"><cite>AskApache.com</cite></a></p><p><a class="IFL" rel="lb" href='http://uploads.askapache.com/2008/01/google-analytics-speed.png' title='Google Analytics ga.js Speed'><img src='http://uploads.askapache.com/2008/01/google-analytics-speed.png' alt='Google Analytics ga.js Speed' title="google analytics speed google" /></a>Last year I wrote about <a href="http://www.askapache.com/webmaster/faster-google-analytics-with-a-local-urchinjs.html">hosting Google Analytics urchin.js file on your own server</a>, to speed up the loading of your site.  Well, google has migrated to a new analytics javascript, ga.js.  You can read the <a href="http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=57045">urchin.js to ga.js migration guide</a> if you want.  They also wrote about the changes on the <a href="http://analytics.blogspot.com/2007/12/announcing-new-graphing-tools-gajs.html">Google Analytics Blog</a>.  And if you want to learn about advanced features of <code>ga.js</code> check out this <a href="http://code.google.com/apis/analytics/docs/">Google Analytics Documentation</a>.<br class="C" /></p>


<h2>XHTML for hosting ga.js locally</h2>
<p>If you use a relative link like below, you don't need the https detection part of the script.</p>
<p>Also note that the <code>-151</code> is from my advanced <a href="http://www.askapache.com/htaccess/mod_rewrite-fix-for-caching-updated-files.html" title="mod_rewrite Fix for Caching Updated Files">mod_rewrite Fix for Caching Updated Files</a>.  So you won't need that unless you implement that technique.</p>
<pre>&lt;script src="/j/ga-151.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
var pageTracker = _gat._getTracker("UA-732153-7");
pageTracker._initData();pageTracker._trackPageview();
&lt;/script&gt;</pre>


<h2>Shell Script to Update ga.js</h2>
<p>Here is an updated shell script that fetches the latest ga.js file from google and places it in the folder of your site.</p>
<pre>#!/bin/sh
&nbsp;
# TMP DIRECTORY
MYTMP=/tmp/
&nbsp;
# SAVE ga.js HERE
INSTALL_IN=/home/user/askapache.com/z/j/
&nbsp;
# RESOURCE URLS
GOOGLE_GA_URL=http://www.google-analytics.com/ga.js
&nbsp;
# USER-AGENT
UA="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"
&nbsp;
# CD TO TMP DIRECTORY
cd $MYTMP
&nbsp;
# DOWNLOAD THE FILE
curl --header "Pragma:" -f -s -A "${UA}" -m 1800 --retry 15 --retry-delay 15 --max-redirs 8 -O $GOOGLE_GA_URL
&nbsp;
# GIVE FILE CORRECT PERMISSIONS
chmod 644 $MYTMP/ga.js
&nbsp;
# COPY FILE TO SITE DIRECTORY
cp -r $MYTMP/ga.js $INSTALL_IN
&nbsp;
# RETURN TO OLDPWD
cd $OLDPWD
&nbsp;
exit 0;</pre>


<h2>Updating ga.js with Crontab</h2>
<p>Just add this to your crontab by typing <code>crontab -e</code> where google-analytics-update.sh is the location of your shell script.</p>
<pre>@daily /home/user/scripts/google-analytics-update.sh &gt;/dev/null 2&gt;&amp;1</pre>



<h2>More Speed Tips</h2>
<ul>
<li><a href="http://www.askapache.com/htaccess/mod_rewrite-fix-for-caching-updated-files.html" title="mod_rewrite Fix for Caching Updated Files">mod_rewrite Fix for Caching Updated Files</a></li>
<li><a href="http://www.askapache.com/htaccess/speed-up-your-site-with-caching-and-cache-control.html" title="Speed up your site with Caching and cache-control">Speed up your site with Caching and cache-control</a></li>
<li><a href="http://www.askapache.com/web-cache/top-methods-for-faster-speedier-web-sites.html" title="Top methods for Faster, Speedier web sites">Top methods for Faster, Speedier web sites</a></li>
</ul><p><a href="http://www.askapache.com/google/ga-urchin-speed.html"></a><a href="http://www.askapache.com/google/ga-urchin-speed.html">Speed Up Google Analytics, use local ga.js</a> originally appeared on <cite>AskApache.com</cite> </p>]]></content:encoded>
			<wfw:commentRss>http://www.askapache.com/google/ga-urchin-speed.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

