<?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>Sarah DeAtley &#187; issues</title>
	<atom:link href="http://www.sarahdeatley.com/blog/tag/issues/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sarahdeatley.com</link>
	<description>information + analysis + design</description>
	<lastBuildDate>Mon, 17 May 2010 06:29:28 +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>Having issues with event tracking in Google Analytics? Read on&#8230;</title>
		<link>http://www.sarahdeatley.com/blog/2009/07/29/having-issues-with-event-tracking-in-google-analytics-read-on/</link>
		<comments>http://www.sarahdeatley.com/blog/2009/07/29/having-issues-with-event-tracking-in-google-analytics-read-on/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 05:40:48 +0000</pubDate>
		<dc:creator>Sarah</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Web Analytics]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[burke]]></category>
		<category><![CDATA[google analytics]]></category>
		<category><![CDATA[issues]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[problems]]></category>
		<category><![CDATA[The Grok]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.sarahdeatley.com/blog/?p=333</guid>
		<description><![CDATA[
			
				
			
		
Note: feel free to ping me or leave a comment if you are having major issues!
Yesterday the event tracking on a site was not working, and someone thought it might be that I had missed a call to the ga.js file or some extra Javascript. My first thought was &#8220;This is why I hate Javascript.&#8221; [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px; margin-bottom: 5px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.sarahdeatley.com%2Fblog%2F2009%2F07%2F29%2Fhaving-issues-with-event-tracking-in-google-analytics-read-on%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.sarahdeatley.com%2Fblog%2F2009%2F07%2F29%2Fhaving-issues-with-event-tracking-in-google-analytics-read-on%2F&amp;source=sarahd23&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p><em><strong>Note: feel free to ping me or leave a comment if you are having major issues!</strong></em></p>
<p>Yesterday the <a href="http://www.sarahdeatley.com/blog/2009/07/07/event-tracking-in-google-analytics/" target="_self">event tracking </a>on a site was not working, and someone thought it might be that I had missed a call to the ga.js file or some extra Javascript. My first thought was &#8220;This is why I hate Javascript.&#8221; That thought recurred throughout my investigation process, but I decided to save some people time and effort by posting a few things you could check before giving up and crying. My particular example was an onClick event, but the same things could apply to other situations.</p>
<ol>
<li><strong>Check the JavaScript call<em>. </em></strong>So you must understand that Javascript (which I shall now write as JS) can be the best and worst scripting language. Very powerful and can do cool things like animation (and your analytics tracking), but also a pain in that you must be very careful with syntax and punctuation. One easy way to see if your JS is creating errors is by installing the <a href="https://addons.mozilla.org/en-US/firefox/addon/60" target="_blank">Web Developer&#8217;s Toolbar </a>in Firefox, it will show you when there are JS errors and a myriad of other useful things.<br />
<blockquote style="font-size: 15px"><p><em>Example</em>: <strong>onclick=&#8221;pageTracker._trackEvent(&#8220;Foo&#8221;,&#8221;Bar&#8221;,&#8221;JS&#8221;);&#8221;</strong> This will be wrong because you have double quotation marks instead of apostrophes within the parentheses. So the page will read it as &#8220;pageTracker.trackEvent(&#8221; which will not do anything. Fix it like this: <strong>onclick=&#8221;pageTracker._trackEvent(&#8216;Foo&#8217;,'Bar&#8217;,'JS&#8217;);&#8221;</strong>.</p></blockquote>
</li>
<li><strong>Is the variable actually pageTracker? </strong>In most cases, if you&#8217;re not changing the Google Analytics code that is on every page, it should be pageTracker. If the variable is named anything else, like movieTracker or pageCounter, then you need to fix the call in the onClick and change it to: onclick=&#8221;movieTracker._trackEvent(&#8230;);&#8221; This is the part of the code you want to pay attention to:<br />
<blockquote style="font-size: 15px"><p>try {<br />
<em>var <strong>pageTracker</strong></em> = _gat._getTracker(&#8220;UA-xxxxxx-x&#8221;);<br />
<strong><em>pageTracker</em></strong>._trackPageview();<br />
} catch(err) {}</p></blockquote>
</li>
<li><strong>Where your code at?</strong> This ended up being my problem. People recommend that the GA code should be inserted at the footer of the page to not slow down the loading time of a page. The catch is, the JS file/definition of the variable pageTracker may need to be at the top of the page for _trackEvent to do its thing. If you try moving the code with the ga.js file to the head of the page, it should help. Or it helped me anyway.</li>
</ol>
<p>As much as I hate debugging JS, I think it has really helped me to have knowledge of how it works, so if this is all kinds of confusing, try working through the <a href="http://http://www.w3schools.com/JS/default.asp" target="_blank">W3C tutorials</a>.</p>
<h3>Misc.</h3>
<p><a href="http://www.grokdotcom.com/2009/07/29/turning-web-analytics-into-nonprofit-success/" target="_blank">The Grok delivers</a>!! I was tweeting with <a href="http://twitter.com/thegrok" target="_blank">@TheGrok</a> and I asked if there was any way he could post about web analytics for non-profits. Brendan Regan wrote an awesomely helpful post about it. I will probably comment more about it later, but still, very cool.</p>
<p>And for those who use Twitter, #wa is being deprecated in favor of #measure. See Web Analytics Demystified for an <a href="http://blog.webanalyticsdemystified.com/weblog/2009/07/measure-is-the-new-wa-in-twitter.html" target="_blank">explanation</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sarahdeatley.com/blog/2009/07/29/having-issues-with-event-tracking-in-google-analytics-read-on/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
