<?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>Dwight Jack Diary &#187; Google Analytics Outbound Tracking</title>
	<atom:link href="http://www.dwightjack.com/diary/tag/google-analytics-outbound-tracking/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dwightjack.com/diary</link>
	<description>Diary of music, design and code</description>
	<lastBuildDate>Tue, 13 Jul 2010 20:46:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Google Analytics Outbound Link Tracking with jQuery</title>
		<link>http://www.dwightjack.com/diary/2008/12/30/google-analytics-outbound-link-tracking-with-jquery/</link>
		<comments>http://www.dwightjack.com/diary/2008/12/30/google-analytics-outbound-link-tracking-with-jquery/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 20:27:41 +0000</pubDate>
		<dc:creator>Dwight Jack</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Google Analytics Outbound Tracking]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery plugin]]></category>

		<guid isPermaLink="false">http://www.dwightjack.com/diary/?p=67</guid>
		<description><![CDATA[A simple jQuery plugin to track links with Google Analytics]]></description>
			<content:encoded><![CDATA[<p>A usefull feature of Google Analytics is the ability to track outbound links with a simple call to a JS function, which tracks a click on a link to a specifed URL path. You can read more about this subject <strong><a href="http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&amp;answer=55527" target="_blank">here</a></strong>.</p>
<p>The matter is that the code presented by the help page requires an <strong>onClick</strong> attribute, which is actually  deprecated in XHTML.</p>
<p>To overcome this problem here is a simple jQuery plugin which converts any <strong>rev </strong>(or other given) attribute to a Google Analytics friendly tracking path (for both old and new versions of the app). Here is a sample code:</p>
<pre><code>&lt;a href="http://www.externalwebsite.com" rev="outbounds www.externalwebsite.com"&gt;visit this site&lt;/a&gt;
</code></pre>
<p>Is tracked as <code>/outbounds/www.externalwebsite.com</code></p>
<p>To apply this plugin call it inside a document loaded function, for example:</p>
<pre><code>$("a").colt();</code></pre>
<p>This calls the plugin on all A tags with an attribute <strong>rev</strong>.<br />
Moreover you can use a custom element attribute by just passing it to the function:</p>
<pre><code>$("a").colt("title");
</code><code></code></pre>
<p>And finally here is the source code:<br />
<a href=http://www.dwightjack.com/diary/wp-content/plugins/download-monitor/download.php?id=2>jQuery.colt.js (908 bytes)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dwightjack.com/diary/2008/12/30/google-analytics-outbound-link-tracking-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
