<?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>r-williams &#187; analytics</title>
	<atom:link href="http://www.r-williams.com/tag/analytics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.r-williams.com</link>
	<description></description>
	<lastBuildDate>Fri, 01 Aug 2008 18:17:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Unobtrusively add Google Analytics code to a page with jQuery</title>
		<link>http://www.r-williams.com/2008/07/unobtrusively-add-analytics-with-jquery/</link>
		<comments>http://www.r-williams.com/2008/07/unobtrusively-add-analytics-with-jquery/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 09:55:59 +0000</pubDate>
		<dc:creator>rob</dc:creator>
				<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.r-williams.com/?p=5</guid>
		<description><![CDATA[The standard analytics code is only 400 bytes or so.. Spread over a few thousand pages that 400 bytes soon eats into your bandwidth costs.
Most of the sites i currently work on use jQuery to add additional functionality without being to obtrusive to people that have JavaScript turned off. 
JavaScript has to be turned on [...]]]></description>
			<content:encoded><![CDATA[<p>The standard analytics code is only 400 bytes or so.. Spread over a few thousand pages that 400 bytes soon eats into your bandwidth costs.</p>
<p>Most of the sites i currently work on use <a href="http://jquery.com">jQuery</a> to add additional functionality without being to obtrusive to people that have JavaScript turned off. </p>
<p>JavaScript has to be turned on for Google&#8217;s code to work! So we can safely inject the code when the page is fully loaded and clients that have JavaScript turned off will be none the wiser.</p>
<p>Place the following code into a site wide file that loads after <a href="http://jquery.com">jQuery</a> and change the tracker code (gaTrackCode) to the one you received from analytics.</p>
<pre name="code" class="javascript:nocontrols:nogutter">
// google analytics tracking code
jQuery(document).ready(function($) {
  var gaTrackCode = "UA-123456789";
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

  jQuery.getScript(gaJsHost + "google-analytics.com/ga.js", function(){
    var pageTracker = _gat._getTracker(gaTrackCode);
    pageTracker._initData();
    pageTracker._trackPageview();
  });
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.r-williams.com/2008/07/unobtrusively-add-analytics-with-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
