<?xml version="1.0" encoding="utf-8"?>

			<rss version="2.0">
			<channel>
			<title>Erik Vold&apos;s Blog - Google Analytics</title>
			<link>http://erikvold.com/blog/index.cfm</link>
			<description>The Robots Are Coming</description>
			<language>en-us</language>
			<pubDate>Fri, 09 Aug 2013 08:34:43 -0400</pubDate>
			<lastBuildDate>Sun, 21 Nov 2010 18:32:00 -0400</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>admin@erikvold.com</managingEditor>
			<webMaster>admin@erikvold.com</webMaster>
			
					<item>
						<title>Status Update: Week 46</title>
						<link>http://erikvold.com/blog/index.cfm/2010/11/21/status-update-week-46</link>
						<description>
							
							&lt;h2&gt;Done&lt;/h2&gt;
&lt;p&gt;It was a pretty slow week, I mainly just worked on patches for Mozilla Lab&apos;s Prospector and answering questions on the Google Analytics and Website Optimizer help forums this week.&lt;/p&gt;
&lt;h3&gt;Mozilla lab&apos;s Prospector&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;findSuggest: Clicking a word overwrites the last word in the find field instead of replacing the existing find field (&lt;a rel=&quot;external&quot; rev=&quot;vote-for&quot; target=&quot;_blank&quot; href=&quot;https://github.com/mozilla/prospector/issues/issue/33&quot;&gt;Issue #33&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;queryStats: Bug fix for an exception when running add-on (&lt;a rel=&quot;external&quot; rev=&quot;vote-for&quot; target=&quot;_blank&quot; href=&quot;https://github.com/mozilla/prospector/issues/issue/48&quot;&gt;Issue #48&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;queryStats: failed to work and disable itself when installing by proxy file or putting xpi into extensions folder manually (&lt;a rel=&quot;external&quot; rev=&quot;vote-for&quot; target=&quot;_blank&quot; href=&quot;https://github.com/mozilla/prospector/issues/issue/49&quot;&gt;Issue #49&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Next&lt;/h2&gt;
&lt;p&gt;
Still working on finding resolutions to the remaining bugs blocking Scriptish 0.1..
&lt;/p&gt; 
						</description>

						
							<category>Status Update</category>
						
							<category>Firefox Add-ons</category>
						
							<category>Google Website Optimizer</category>
						
							<category>Google Analytics</category>
						
						<pubDate>Sun, 21 Nov 2010 18:32:00 -0400</pubDate>
						<guid>http://erikvold.com/blog/index.cfm/2010/11/21/status-update-week-46</guid>
						
					</item>
					
					<item>
						<title>Tracking Outbound Links - The Really Right Way</title>
						<link>http://erikvold.com/blog/index.cfm/2009/12/17/tracking-outbound-links--the-really-right-way</link>
						<description>
							
							&lt;p&gt;
About 5 months ago Eric Vasilik wrote a post on his &lt;a title=&quot;GWO Tricks Blog&quot; rel=&quot;external nofollow&quot; target=&quot;_blank&quot; href=&quot;http://gwotricks.com/&quot;&gt;GWO Tricks&lt;/a&gt; blog about &lt;a title=&quot;Tracking Outbound Links -- The Right Way&quot; rel=&quot;external nofollow&quot; rev=&quot;vote-against&quot; target=&quot;_blank&quot; href=&quot;http://www.gwotricks.com/2009/07/tracking-outbound-links-right-way.html&quot;&gt;Tracking Outbound Links -- The Right Way&lt;/a&gt; which was ment to point out a solution for the problem with &lt;a title=&quot;How do I manually track clicks on outbound links?&quot; rel=&quot;external nofollow&quot; rev=&quot;vote-against&quot; target=&quot;_blank&quot; href=&quot;http://www.google.com/support/analytics/bin/answer.py?hl=en&amp;answer=55527&quot;&gt;the technique outlined in the Analytics Help Center article called &amp;quot;How do I manually track clicks on outbound links?&amp;quot;&lt;/a&gt;, is that it suffers from a &lt;a title=&quot;Race Condition - Wikipedia&quot; rel=&quot;external nofollow info&quot; data-source=&quot;Wikipedia&quot; target=&quot;_blank&quot; href=&quot;http://en.wikipedia.org/wiki/Race_condition&quot;&gt;Race Condition&lt;/a&gt; which may mean the tracking doesn&apos;t take place. If you haven&apos;t read Eric&apos;s article, please do.
&lt;/p&gt;
&lt;p&gt;
Well as readers of my blog would know, I recently wrote a &lt;a title=&quot;Click Tracking JavaScript Library Now Available&quot; rev=&quot;vote-for&quot; target=&quot;_blank&quot; href=&quot;http://erikvold.com/blog/index.cfm/2009/12/11/click-tracking-javascript-library-now-available&quot;&gt;JavaScript click tracking library&lt;/a&gt; which can be &lt;a title=&quot;erikvold / click-tracking-js-lib&quot; rel=&quot;external&quot; rev=&quot;vote-for&quot; target=&quot;_blank&quot; href=&quot;http://github.com/erikvold/click-tracking-js-lib&quot;&gt;found at GitHub here&lt;/a&gt;. In &lt;a title=&quot;Click Tracking JavaScript Library Now Available&quot; rev=&quot;vote-for&quot; target=&quot;_blank&quot; href=&quot;http://erikvold.com/blog/index.cfm/2009/12/11/click-tracking-javascript-library-now-available&quot;&gt;the blog post&lt;/a&gt; I mention that I implemented Eric Vasilik&apos;s &amp;quot;Right Way&amp;quot; to track links, but today I started thinking about this some more.
&lt;/p&gt;
&lt;p&gt;
I decided to do some searching on how to cancel a click event, and I found &lt;a title=&quot;Event.stop()&quot; rel=&quot;external nofollow&quot; target=&quot;_blank&quot; href=&quot;http://particletree.com/notebook/eventstop/&quot;&gt;a great old blog post from 2006 by Ryan Campbell pretty quickly which mentions a method implemented by Prototype called Event.stop()&lt;/a&gt;. So I decided to dig in to the Prototype code to see what Event.stop() did exactly, so I could extract it, and I found that it does two things, one is to stop the event propagation, and the second is to stop the default behavior for the event. At the end of the post Ryan said that it not work for Safari 2.0.3, which is why it could not be relied on at the time, but today Safari 2.0.3 is dead, and I tested Safari 3 out which works. In fact I decided to do some PPK style testing and try test cases on every browser I could.
&lt;/p&gt;
&lt;p&gt;
After seeing that Event.stop() had two purposes I wanted to find out why this was done, and found &lt;a title=&quot;Event.stop() - Prototype JS&quot; rel=&quot;external nofollow&quot; target=&quot;_blank&quot; href=&quot;http://www.prototypejs.org/api/event/stop&quot;&gt;this documentation page for Event.stop()&lt;/a&gt;, which says this was done &amp;quot;because stopping one of those aspects means, in 99.9% of the cases, preventing the other one as well&amp;quot;, but in the case of simply click tracking we don&apos;t really want to stop the event propagation, we just want to stop the default action from being triggered eventually. So here is what my update to Eric&apos;s example looks like:
&lt;/p&gt;
&lt;br&gt;<![CDATA[
&lt;a id="example" href="http://www.example.com"&gt;Click me&lt;/a&gt;
&lt;script type="text/javascript"&gt;
function doGoal(e){
  if(!e) var e = window.event;

  var targ;
  if ( e.target ) targ = e.target;
  else if ( e.srcElement ) targ = e.srcElement;
  // Safari..
  if ( targ.nodeType == 3 ) targ = targ.parentNode;

  setTimeout('document.location = "' + targ .href + '"', 100);

  try{
    var pageTracker=_gat._getTracker("UA-123456-1");
    pageTracker._trackPageview("http://www.example.com");
  }
  catch(err){}

  if (e.preventDefault) e.preventDefault(); // w3c
  else e.returnValue  = false; // for ie
}
if ( document.body.addEventListener ) {
  // w3c
  document.getElementById('example').addEventListener( "click", doGoal, false );
}
else if ( document.body.attachEvent ) {
  // ie
  document.getElementById('example').attachEvent( "onclick", doGoal );
}
&lt;/script&gt;
]]>&lt;br&gt;
&lt;p&gt;
To try the code above see the &lt;a rel=&quot;external nofollow&quot; href=&quot;http://erikvold.com/tests/javascript/gwoReallyRightClickTracking.html&quot;&gt;test page here&lt;/a&gt;. I have tested this out on IE6+, FF2+, Opera9+, Safari for the iPhone OS 3.0, Google Chrome, and Safari3+ on MacOSX and WindowsXP and they all work, so I am pretty confident that this is going to work for something like ~99% of web users today, and since it would not error even for a user using Safari 2 (which I wasn&apos;t able to test), and Safari 2 is so slow, there is a good chance the user would still be tracked anyhow.
&lt;/p&gt;
&lt;p&gt;
If anyone else could try this out on some other browsers at let me know what they find good or bad that would be nice so that I can add them to the list above. The best way to test the test page is to comment out the setTimeout line, and make sure that clicking the link doesn&apos;t do anything.
&lt;/p&gt;
&lt;p&gt;
The beautiful part about this method is that it is totally unobtrusive JavaScript code, and will work even if you are using the onclick attribute for other site functionality (even though you shouldn&apos;t ever use the onclick attribute).
&lt;/p&gt;
&lt;p&gt;
Merry Clicking!
&lt;/p&gt;
&lt;p&gt;
P.S. The &lt;a title=&quot;erikvold / click-tracking-js-lib&quot; rel=&quot;external&quot; rev=&quot;vote-for&quot; target=&quot;_blank&quot; href=&quot;http://github.com/erikvold/click-tracking-js-lib&quot;&gt;Click Tracking JavaScript Library&lt;/a&gt; has been updated to use this really right method, check it out if you haven&apos;t already!
&lt;/p&gt; 
						</description>

						
							<category>Javascript</category>
						
							<category>Productivity</category>
						
							<category>Google Website Optimizer</category>
						
							<category>Analytics</category>
						
							<category>Google Analytics</category>
						
						<pubDate>Thu, 17 Dec 2009 04:15:00 -0400</pubDate>
						<guid>http://erikvold.com/blog/index.cfm/2009/12/17/tracking-outbound-links--the-really-right-way</guid>
						
					</item>
					</channel></rss>