<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Speed Up Google Analytics, use local ga.js</title>
	<atom:link href="http://www.askapache.com/linux-unix/ga-urchin-speed.html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.askapache.com/linux-unix/ga-urchin-speed.html</link>
	<description>Advanced Web Development</description>
	<lastBuildDate>Wed, 18 Nov 2009 23:28:48 -0500</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: A Guide to Google Analytics and Useful Tools &#171; Smashing Magazine</title>
		<link>http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-105028</link>
		<dc:creator>A Guide to Google Analytics and Useful Tools &#171; Smashing Magazine</dc:creator>
		<pubDate>Sat, 10 Oct 2009 13:59:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-105028</guid>
		<description>[...] Speed Up Google Analytics &#8220;Last year I wrote about hosting Google Analytics urchin.js file on your own server, to speed up the loading of your site. Well, google has migrated to a new analytics javascript, ga.js. You can read the urchin.js to ga.js migration guide if you want. They also wrote about the changes on the Google Analytics Blog. And if you want to learn about advanced features of ga.js check out this Google Analytics Documentation.&#8221; [...]</description>
		<content:encoded><![CDATA[<p>[...] Speed Up Google Analytics &#8220;Last year I wrote about hosting Google Analytics urchin.js file on your own server, to speed up the loading of your site. Well, google has migrated to a new analytics javascript, ga.js. You can read the urchin.js to ga.js migration guide if you want. They also wrote about the changes on the Google Analytics Blog. And if you want to learn about advanced features of ga.js check out this Google Analytics Documentation.&#8221; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arjan</title>
		<link>http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-90671</link>
		<dc:creator>Arjan</dc:creator>
		<pubDate>Sun, 26 Jul 2009 10:30:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-90671</guid>
		<description>This won&#039;t speed up things. Most people will have Google&#039;s ga.js in their cache from previous visits to other sites. Your server cannot beat the cache (and probably cannot beat Google&#039;s servers either).</description>
		<content:encoded><![CDATA[<p>This won&#8217;t speed up things. Most people will have Google&#8217;s ga.js in their cache from previous visits to other sites. Your server cannot beat the cache (and probably cannot beat Google&#8217;s servers either).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AskApache</title>
		<link>http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-71910</link>
		<dc:creator>AskApache</dc:creator>
		<pubDate>Thu, 23 Apr 2009 09:01:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-71910</guid>
		<description>&lt;strong&gt;@ Rafał&lt;/strong&gt;

If you did that then Google Analytics would not work!  Google uses the &lt;code&gt;__utm.gif&lt;/code&gt; file as a method to pass various stats on to the Google Analytics engine.  If you request the &lt;code&gt;__utm.gif&lt;/code&gt; file on your own server, then Google Analytics will not work!  Check out the Host: header field from this WireShark dump, this shows that hosting the ga.js on your server works but only because its still calling &lt;code&gt;google-analytics.com/__utm.gif&lt;/code&gt;.

&lt;pre class=&#039;brushhtaccess&#039;&gt;
GET /__utm.gif?&amp;utmp=/linux-unix/ga-urchin-speed.html&amp;utmac=UA-732153-7
Host: www.google-analytics.com
Referer: http://www.askapache.com/linux-unix/ga-urchin-speed.html
&lt;/pre&gt;

</description>
		<content:encoded><![CDATA[<p><strong>@ Rafał</strong></p>
<p>If you did that then Google Analytics would not work!  Google uses the <code>__utm.gif</code> file as a method to pass various stats on to the Google Analytics engine.  If you request the <code>__utm.gif</code> file on your own server, then Google Analytics will not work!  Check out the Host: header field from this WireShark dump, this shows that hosting the ga.js on your server works but only because its still calling <code>google-analytics.com/__utm.gif</code>.</p>
<pre class='brushhtaccess'>GET /__utm.gif?&#038;utmp=/linux-unix/ga-urchin-speed.html&#038;utmac=UA-732153-7
Host: www.google-analytics.com
Referer: http://www.askapache.com/linux-unix/ga-urchin-speed.html</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rafał Szymański</title>
		<link>http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-71685</link>
		<dc:creator>Rafał Szymański</dc:creator>
		<pubDate>Mon, 20 Apr 2009 19:52:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-71685</guid>
		<description>Hi,
Very interesting article. I&#039;m not sure that is everything OK because in my opinion you have to also do 2 things:
&lt;ol&gt;
&lt;li&gt;Copy &lt;code&gt;_umt.gif&lt;/code&gt; from Google to your server&lt;/li&gt;
&lt;li&gt;edit ga.js to add new url for &lt;code&gt;_umt.gif&lt;/code&gt;. Without this changes just copied &lt;code&gt;ga.js&lt;/code&gt; will not work correctly on your local server.&lt;/li&gt;
&lt;/ol&gt;

In original ga.js it&#039;s look that:
&lt;code&gt;lc:&quot;http://www.google-analytics.com/__utm.gif&quot;,mc:&quot;https://ssl.google-analytics.com/__utm.gif&quot;&lt;/code&gt; 
in your local file should look that:
&lt;code&gt;lc:&quot;http://www.yourdomain.com/__utm.gif&quot;,mc:&quot;https://yourdomain.com/__utm.gif&quot;&lt;/code&gt;

So, challenging is to make script to made this changes in every updated ga.js

Best regards
Rafał</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Very interesting article. I&#8217;m not sure that is everything OK because in my opinion you have to also do 2 things:</p>
<ol>
<li>Copy <code>_umt.gif</code> from Google to your server</li>
<li>edit ga.js to add new url for <code>_umt.gif</code>. Without this changes just copied <code>ga.js</code> will not work correctly on your local server.</li>
</ol>
<p>In original ga.js it&#8217;s look that:<br />
<code>lc:"http://www.google-analytics.com/__utm.gif",mc:"https://ssl.google-analytics.com/__utm.gif"</code><br />
in your local file should look that:<br />
<code>lc:"http://www.yourdomain.com/__utm.gif",mc:"https://yourdomain.com/__utm.gif"</code></p>
<p>So, challenging is to make script to made this changes in every updated ga.js</p>
<p>Best regards<br />
Rafał</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ibme</title>
		<link>http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-47481</link>
		<dc:creator>ibme</dc:creator>
		<pubDate>Tue, 25 Nov 2008 15:46:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-47481</guid>
		<description>We were running into a problem where for some reason the google script code for correctly identifying http vs. https wasn&#039;t working properly.  This caused an error to generate in the server logs where it was looking for the ga.js file locally.  I wasn&#039;t able to pin point the problem with the gahost code and since it was happening only 2 to 5% of the time, I was looking for another method.

Your solution of downloading and hosting the ga.js file locally is an elegant solution to our particular problem.  This way, the ga.js is always local and we don&#039;t have to use the https identifying code. 

Hopefully our error / issue will go away.

Thanks!</description>
		<content:encoded><![CDATA[<p>We were running into a problem where for some reason the google script code for correctly identifying http vs. https wasn&#8217;t working properly.  This caused an error to generate in the server logs where it was looking for the ga.js file locally.  I wasn&#8217;t able to pin point the problem with the gahost code and since it was happening only 2 to 5% of the time, I was looking for another method.</p>
<p>Your solution of downloading and hosting the ga.js file locally is an elegant solution to our particular problem.  This way, the ga.js is always local and we don&#8217;t have to use the https identifying code. </p>
<p>Hopefully our error / issue will go away.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Hunter</title>
		<link>http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-35608</link>
		<dc:creator>Barry Hunter</dc:creator>
		<pubDate>Fri, 01 Feb 2008 15:47:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-35608</guid>
		<description>Thanks for the responce, 

&gt; The google-analytics.com servers are configured to return a random Last-Modified date EVERY single time a browser requests http://www.google-analytics.com/ga.js 

It validates for me here tho (tried it three times)
http://www.ircache.net/cgi-bin/cacheability.py

Its probably just that different datacenters have slightly different versions of the file, so sometimes you hit one, sometimes another? (another common problem with etags)
- so if that is the case then it is rather a shot in the foot - both for Google, and visitors to sites with GA. 

They do also have a &#039;max-age&#039;, so most of the time the browser wont even bother with the conditional get. 

&gt; your browser has to follow up the 304 If-Modified-Since request with a FULL GET request, 
I thought it was a &#039;conditional get&#039;, &#039;Ive got this file, if it matches this date dont bother sending it&#039;, so if the dates match server returns 304, otherwise 200 and the new content. 

&gt; Also don&#039;t forget about HTTP/1.1 ability to use persistant connections. 
Ah of course! Although I know have tended to disable it on high traffic sites, lots of clients maintaining connections, eats up apache threads, siting around doing nothing. Having lots of threads in the cache ready means minimum startup time on each connection, and the overall server performance is better - of course there may be some other apache setting to help with this - or for small sites is perfectly good.</description>
		<content:encoded><![CDATA[<p>Thanks for the responce, </p>
<p>&gt; The google-analytics.com servers are configured to return a random Last-Modified date EVERY single time a browser requests http://www.google-analytics.com/ga.js </p>
<p>It validates for me here tho (tried it three times)<br />
http://www.ircache.net/cgi-bin/cacheability.py</p>
<p>Its probably just that different datacenters have slightly different versions of the file, so sometimes you hit one, sometimes another? (another common problem with etags)<br />
- so if that is the case then it is rather a shot in the foot &#8211; both for Google, and visitors to sites with GA. </p>
<p>They do also have a &#8216;max-age&#8217;, so most of the time the browser wont even bother with the conditional get. </p>
<p>&gt; your browser has to follow up the 304 If-Modified-Since request with a FULL GET request,<br />
I thought it was a &#8216;conditional get&#8217;, &#8216;Ive got this file, if it matches this date dont bother sending it&#8217;, so if the dates match server returns 304, otherwise 200 and the new content. </p>
<p>&gt; Also don&#8217;t forget about HTTP/1.1 ability to use persistant connections.<br />
Ah of course! Although I know have tended to disable it on high traffic sites, lots of clients maintaining connections, eats up apache threads, siting around doing nothing. Having lots of threads in the cache ready means minimum startup time on each connection, and the overall server performance is better &#8211; of course there may be some other apache setting to help with this &#8211; or for small sites is perfectly good.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AskApache</title>
		<link>http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-35607</link>
		<dc:creator>AskApache</dc:creator>
		<pubDate>Fri, 01 Feb 2008 15:19:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-35607</guid>
		<description>&lt;p&gt;&lt;strong&gt;@ Barry&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Your logic is correct but unfortunately google throws a wrench into it.  For unknown reasons, &lt;em&gt;at least I can&#039;t figure it out&lt;/em&gt;, The google-analytics.com servers are configured to return a random &lt;code&gt;Last-Modified&lt;/code&gt; date EVERY single time a browser requests &lt;code&gt;http://www.google-analytics.com/ga.js&lt;/code&gt;  which of course means that ga.js CANNOT be cached by any browser.  Therefore, every time a browser loads a page that includes the ga.js file from google, it has to make a 304 If-Modified-Since request to see if the file has changed.&lt;/p&gt;

&lt;p&gt;Because google returns a different Last-Modified date EVERY single time, your browser has to follow up the 304 If-Modified-Since request with a FULL GET request, meaning it has to re-download the entire file, for every single page load.&lt;/p&gt;

&lt;p&gt;This is wayyyyyyyyyyyyyyyyyyyy slower than hosting it on your own server, for obvious reasons.&lt;/p&gt; 

&lt;p&gt;Of course, hosting it on your own server wouldn&#039;t be much faster UNLESS you implement server-side caching, which I take full advantage of on AskApache.com, so, my site loads much faster in regards to ga.js.&lt;/p&gt;

&lt;p&gt;Also don&#039;t forget about HTTP/1.1 ability to use persistant connections.  Basically this means that when a client/browser requests &lt;code&gt;http://www.askapache.com/linux-unix/ga-urchin-speed.html&lt;/code&gt;, it caches the reverse DNS for askapache.com, and opens a persistant connection to my server.  So, followup requests for additional resources like images, css files, js files, etc.. all happen using the same connection, which equates to speed.&lt;/p&gt;  

&lt;p&gt;So If a client already has a persistant connection to my server, and If I have solid caching set up on my server, and If I want my site to be faster, I will host ga.js locally.  When google changes their caching policy, then of course it will be faster to NOT host ga.js locally, and your suggestions will be absolutely correct.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p><strong>@ Barry</strong></p>
<p>Your logic is correct but unfortunately google throws a wrench into it.  For unknown reasons, <em>at least I can&#8217;t figure it out</em>, The google-analytics.com servers are configured to return a random <code>Last-Modified</code> date EVERY single time a browser requests <code>http://www.google-analytics.com/ga.js</code>  which of course means that ga.js CANNOT be cached by any browser.  Therefore, every time a browser loads a page that includes the ga.js file from google, it has to make a 304 If-Modified-Since request to see if the file has changed.</p>
<p>Because google returns a different Last-Modified date EVERY single time, your browser has to follow up the 304 If-Modified-Since request with a FULL GET request, meaning it has to re-download the entire file, for every single page load.</p>
<p>This is wayyyyyyyyyyyyyyyyyyyy slower than hosting it on your own server, for obvious reasons.</p>
<p>Of course, hosting it on your own server wouldn&#8217;t be much faster UNLESS you implement server-side caching, which I take full advantage of on AskApache.com, so, my site loads much faster in regards to ga.js.</p>
<p>Also don&#8217;t forget about HTTP/1.1 ability to use persistant connections.  Basically this means that when a client/browser requests <code>http://www.askapache.com/linux-unix/ga-urchin-speed.html</code>, it caches the reverse DNS for askapache.com, and opens a persistant connection to my server.  So, followup requests for additional resources like images, css files, js files, etc.. all happen using the same connection, which equates to speed.</p>
<p>So If a client already has a persistant connection to my server, and If I have solid caching set up on my server, and If I want my site to be faster, I will host ga.js locally.  When google changes their caching policy, then of course it will be faster to NOT host ga.js locally, and your suggestions will be absolutely correct.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Hunter</title>
		<link>http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-35452</link>
		<dc:creator>Barry Hunter</dc:creator>
		<pubDate>Wed, 30 Jan 2008 12:55:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.askapache.com/linux-unix/ga-urchin-speed.html#comment-35452</guid>
		<description>I&#039;ve seen things like this suggested before (non Analytics), but this is assuming you have global connectivity better than Google. On the whole your server might be closer to you, but its quite possible Google have a datacenter closer to many of your visitors. 

On a remote server in the UK (so no local user to prime the DNS), from Google takes, 0.7s, but from yours 1.7s then once the DNS has been primed, 0.4s from Google and then 0.8s from your z. server. 

Also this negates caching in some cases as its quite possible a user has the file loaded from visiting a another website, upon visiting your site they have to download it again. 

Save yourself the bother of maintaining it, and the bandwidth and let Google host it, I say :)</description>
		<content:encoded><![CDATA[<p>I&#8217;ve seen things like this suggested before (non Analytics), but this is assuming you have global connectivity better than Google. On the whole your server might be closer to you, but its quite possible Google have a datacenter closer to many of your visitors. </p>
<p>On a remote server in the UK (so no local user to prime the DNS), from Google takes, 0.7s, but from yours 1.7s then once the DNS has been primed, 0.4s from Google and then 0.8s from your z. server. </p>
<p>Also this negates caching in some cases as its quite possible a user has the file loaded from visiting a another website, upon visiting your site they have to download it again. </p>
<p>Save yourself the bother of maintaining it, and the bandwidth and let Google host it, I say :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
