<?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>Colin Temple&#187; Web Analytics</title>
	<atom:link href="http://colintemple.com/writing/category/web-analytics/feed/" rel="self" type="application/rss+xml" />
	<link>http://colintemple.com/writing</link>
	<description>Business analyst, philosophy student</description>
	<lastBuildDate>Thu, 12 Jan 2012 01:26:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Vandalism with Google Analytics exploits</title>
		<link>http://www.napkyn.com/blog/2011/08/05/google-analytics-vandalism/</link>
		<comments>http://www.napkyn.com/blog/2011/08/05/google-analytics-vandalism/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 14:20:18 +0000</pubDate>
		<dc:creator>Colin Temple</dc:creator>
				<category><![CDATA[Web Analytics]]></category>
		<category><![CDATA[Web Tracking]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[Google Analytics]]></category>

		<guid isPermaLink="false">http://www.napkyn.com/?p=612</guid>
		<description><![CDATA[Google Analytics has a design approach to web analytics software that differs from many of its competitors. Whereas some tools require you to pre-define anything you want to track  (such as events, page names and campaign data), Google Analytics allows you to define these in the code or URL of a page, and simply accepts [...]]]></description>
			<content:encoded><![CDATA[<p>Google Analytics has a design approach to web analytics software that differs from many of its competitors. Whereas some tools require you to pre-define anything you want to track  (such as events, page names and campaign data), Google Analytics allows you to define these in the code or URL of a page, and simply accepts whatever data is thrown at it. This greatly cuts down on the cost, in both time and money, of implementing and maintaining a Google Analytics account. The ease of implementation has been a huge win for Google Analytics.</p>
<div style="width: 250px; font-size: 0.9em; float: right; margin: 0 0 1em 1em;"><img class="alignnone size-full wp-image-613" title="Keep your Trash out of my Google Analytics" src="http://www.napkyn.com/n/wp-content/uploads/2011/08/trash-into-ga.png" alt="" width="250" height="209" /></div>
<p>However, this philosophy comes at a price. Because it indiscriminately accepts any data it&#8217;s given, <em>it accepts any data it&#8217;s given</em>. The result is that, if someone with the right skills is feeling particularly malicious, they can vandalize and seriously distort your business&#8217; data. There are two ways this can be done.</p>
<p>We&#8217;ve been aware of these potential issues for some time now, but we wrestled a bit with the decision of whether or not to post this. On one hand, we like to share our knowledge and, since this is a very real fact about Google Analytics, it&#8217;s good for GA users to be aware of it. On the other hand, we&#8217;re potentially teaching people <em>how </em>to mess with someone&#8217;s GA deployment. Ultimately we decided on transparency and honesty &#8212; after all, we&#8217;re also going to tell you what you can do to protect yourself from these. But we must begin with a caveat: we do not endorse doing anything like this. We offer this information so you can be aware of potential security risks with your own data, and take the necessary steps to protect your data integrity.  We are strong supporters of the <a href="http://www.webanalyticsassociation.org/?page=codeofethics">Web Analyst&#8217;s Code of Ethics</a>, and though that code doesn&#8217;t say much about messing with others&#8217; data, the idea is generally to be open and honest with data.</p>
<p><strong>(Update: </strong>I should also point out that Google Analytics is not alone in being vulnerable to some of this. The approach to campaigns and ease of copying other data makes it easier than with some tools, I think, but those stem from Google&#8217;s strengths rather than weakness. I offer Google Analytics up because they don&#8217;t have a service level agreement for everyone, and hence it&#8217;s up to you to protect some of your data. Despite any vulnerability, I do want to be clear that Google Analytics is a fine tool and this alone is not cause for alarm, just something to be aware of when implementing this tool, and by extension, others like it.)</p>
<p>With that out of the way, here are the potential exploits we&#8217;ve seen:</p>
<p><span id="more-612"></span></p>
<h2><strong>Campaign Vandalism<br />
</strong></h2>
<p>Google Analytics makes campaigns tracking easy. Unlike tools like Adobe SiteCatalyst which store campaign tracking codes and convert them into useful data, Google Analytics sets campaign names directly in the URL query parameters, accepting any campaign name that it receives. This saves you time managing all your campaigns and channels, and makes setting up Google Analytics significantly faster. But with GA merely accepting any campaign names it gets, what&#8217;s to stop me from visiting your site using a bogus campaign name?</p>
<p><strong>What&#8217;s the problem?</strong></p>
<p>Campaigns in Google Analytics work by adding the names of campaigns, media and sources to URLs. For instance, if you want to track a summer email campaign that links to www.example.com, you may enter a URL like this:</p>
<div style="padding: 1em; border: 1px dotted #444444; background: none repeat scroll 0% 0% #ffffff;"><code>http://www.example.com/?utm_source=<span style="color: #008000;"><strong>newsletter</strong></span>&amp;utm_medium=<span style="color: #008000;"><strong>email</strong></span>&amp;utm_campaign=<span style="color: #008000;"><strong>SummerBlast</strong></span></code></div>
<p>In this example, you&#8217;re pushing though three pieces of information: the source of your list (newsletter), the medium over which you&#8217;re marketing (email) and the name of the individual campaign (SummerBlast). This data will be recorded in Google Analytics, no questions asked. You don&#8217;t even have to tell Google about the campaign ahead of time.</p>
<p>But what&#8217;s to stop me from visiting your site on this URL?</p>
<div style="padding: 1em; border: 1px dotted #444444; background: none repeat scroll 0% 0% #ffffff;"><code>http://www.example.com/?utm_source=<span style="color: #008000;"><strong>magic</strong></span>&amp;utm_medium=<strong><span style="color: #008000;">spaceship</span></strong>&amp;utm_campaign=<span style="color: #008000;"><strong>Stupidhead</strong></span></code></div>
<p>The answer is nothing. If I were to visit a GA-tracked website with those query parameters attached, their Google Analytics implementation would show that someone came to their site magically, by means of a spaceship, through a campaign called Stupidhead. I did this to one of my own sites, and here&#8217;s what I got.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-619" style="border: 1px solid #444;" title="Campaign Vandalism in Google Analytics" src="http://www.napkyn.com/n/wp-content/uploads/2011/08/magic-spaceship-campaign.png" alt="" width="570" height="84" /></p>
<p><strong>How dangerous is it?</strong></p>
<p>The most someone can do is create a bunch of meaningless data. The effect of a single vandal acting alone would be minimal, though an extremely determined vandal could set up a sort of vandalism bot &#8212; an automated software that repeatedly visits your website using falsified campaign data.</p>
<p>If you&#8217;re smart about your reporting, you&#8217;re probably more concerned about your <em>converting</em> campaigns. In order for vandals to mess with those reports, they&#8217;d have to become converting visitors. They may not have a problem with filling out a lead generation form, but if you are running an ecommerce site, these reports have a built-in protection: vandals will have to <em>pay</em> for the opportunity to seriously mess up your reports. (However, you&#8217;ll still need to account for the second scenario below.)</p>
<p><strong>How do you fix it?</strong></p>
<p>The first step is to identify vandalism. Chances are, it will be obvious &#8212; if someone has decided to vandalize your site, it&#8217;s probably because they want you to see it. So a bogus campaign name that shows up in your reports will be clear. If you&#8217;ve been smart about maintaining a convention for your campaign naming, you should have an easier time detecting falsified campaign information, though a determined vandal could spoof your own conventions.</p>
<p>Getting rid of the campaign data isn&#8217;t as easy. In fact, it&#8217;s impossible. What you can do instead is segment it out, so that you see only data from non-vandals. To do this, you need to create an advanced segment. Creating a new custom segment (using the &#8216;Advanced Segments&#8217; area at the top of a report in the new Google Analytics interface), you can choose to exclude campaigns, media or sources that contain the offending terms.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-620" style="border: 1px solid #444;" title="Exclude vandalized campaigns" src="http://www.napkyn.com/n/wp-content/uploads/2011/08/exclude-stupidhead.png" alt="" width="570" height="101" /></p>
<p>The problem here is that if you&#8217;re the victim of serious vandalism, such as from the bot scenario given above, you have to use this segment every time you look at a report in Google Analytics. That&#8217;s a pain.</p>
<p>If you&#8217;re a large organization and you&#8217;re afraid of receiving an attack to your Google Analytics account, you may consider running more than one analytics solution, or copying the relevant data to your own datamart. The larger you are financially, the more likely such an attack is, but the more resources you&#8217;ll have to back-up your data.</p>
<p><strong>What should Google do?</strong></p>
<p><strong></strong>Probably nothing. I think that the fact that you don&#8217;t have to do campaign management within Google Analytics is a plus. It cuts down the overhead &#8212; every organization should have some method to the madness of creating campaigns and campaign names, but the extra work of punching data into your web analytics tool isn&#8217;t always worth the benefit, especially for smaller organizations.</p>
<p>Given the fact that traffic has to convert, and actually spend money if you&#8217;re an ecommerce site, in order to mess with valuable reports. If someone really wanted to hit your site hard with this, the most they could do is become a nuisance. It won&#8217;t destroy your reporting, but it will make it harder to pull clean data.</p>
<p>However, since Google is gradually approaching the enterprise market with its Analytics product,  its product team may consider providing two options for campaign management: both the current consume-everything version, and an internally-managed campaign list in the style of SiteCatalyst. The benefit would be for large customers, who have the resources to properly manage their campaigns, to be able to do so risk-free.</p>
<h2><strong>Fake Data Injection<br />
</strong></h2>
<p><strong></strong>Ok, so, if I want to, I can mess up the campaign data a bit. And if I want to mess up your revenue sources, then at least I have to pay you for the opportunity to do so, and it may not be so bad.  But what if I want to mess up the rest of your data? Surely, I wouldn&#8217;t be able to do that, right?</p>
<p>Wrong. Unless you&#8217;ve set up filters to prevent this, Google Analytics will accept data for your Google Analytics tracking account from any server, as long as it sends the web property ID for your website.</p>
<p><strong>What&#8217;s the problem?</strong></p>
<p>Because Google Analytics accepts this data from anywhere, anyone can create a web page using your Google Analytics tracking code, view it, and have traffic, events or ecommerce data show up in your Google Analytics report.</p>
<p>For example, what happens to your reports if I create a fake transaction, using your Google Analytics tracking code, with a transaction of -$90 million? Here&#8217;s what happens:</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-622" style="border: 1px solid #444;" title="Huge Negative Transaction" src="http://www.napkyn.com/n/wp-content/uploads/2011/08/huge-negative-transaction.png" alt="" width="385" height="155" /></p>
<p style="text-align: left;">The other days in that report aren&#8217;t at zero dollars. They range from $50,000 &#8211; $100,000, but you can&#8217;t see the trends because the fake transaction has skewed everything.</p>
<p><strong>How dangerous is it?</strong></p>
<p>The damage here is greater, in that it will severely distort any reports. Someone could take an obvious step, like the above examples, of pushing huge transactions into your Google Analytics account. However, the vandalism could be more subtle: one could push several smaller transactions with false source data to try and misguide you, or push events that you can&#8217;t reconcile with your order management system.</p>
<p>The effect of this and the campaign vandalism method I mentioned above can be compounded. Recall that you&#8217;d have to buy something to mess with revenue source data with the method above? It turns out that, if you fake realistic-looking transactions <em>while using</em> spoofed campaigns, you can make an even bigger mess of things.</p>
<p>One limiting factor here is that the visits have to be run from a server that&#8217;s connected to the Internet and can host web pages. As a result, you can use the Hostnames report in Google Analytics to identify where the fake data came from. This does mean that if someone wishes to vandalize your data in this way, they will have to do so carefully, otherwise they may be identifiable. Potential vandals would have to go to greater lengths to ensure their anonymity.</p>
<p><strong>How do you fix it?</strong></p>
<p>Finding the fake data could be tricky. In the case of revenue and transaction data, you probably have an order management system with which you can compare the data. However, when you&#8217;re strictly looking at Google Analytics, the fake data may not be obvious if the vandal has chosen to be sneaky about it. The first step is to check your Hostnames report. Hostnames are the domain names or IP addresses from which your website is viewed. In the new Google Analytics, you can find the list of hostnames that have been used to view your site from the <strong>Visitors &gt; Technology &gt; Network</strong> report.</p>
<p>If Google Analytics code executes on hostnames that you don&#8217;t own, you&#8217;ll want to investigate the problem. In some cases, those hostnames will simply be search engine caches or translation services that are copying your analytics code. However, if you notice transactions or strange events and campaign data from suspicious hostnames, then you may want to look into the matter.</p>
<p>There are a couple of ways to actually fix the problem. The first is an <em>ad hoc </em>approach &#8212; if someone drops a fake transaction into your system, <a href="http://www.google.com/support/analytics/bin/answer.py?hl=en-US&amp;answer=72290">simply remove it</a> by executing some JavaScript. This requires you to write a custom JavaScript that basically makes an inverted version of the transaction, with negated quantity, revenue, shipping and tax values. This is annoying, but quick enough to get rid of a single transaction.  You can also handle it the way I suggested handling vandalized campaigns above, using custom segmentation.</p>
<p>However, if you want to prevent yourself from these attacks entirely, then you&#8217;ll need to add some filters to your Google Analytics profiles (or create new filtered versions of your main profiles). The goal here would be to create a list of hostnames &#8212; the domain names and subdomains that you use for your website &#8212; and ONLY accept data from those hosts. Now, you&#8217;ll probably want to set up your filters on a <em>new profile</em>, which is a filtered version of your original. That way, you have 100% of the data collected by your site, but also a clean/safe copy to work with.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-621" style="border: 1px solid #444;" title="Include Only Domain" src="http://www.napkyn.com/n/wp-content/uploads/2011/08/include-only-domain.png" alt="" width="522" height="305" /></p>
<p>The example filter I&#8217;ve given here will only count traffic, events and transactions from the domain name &#8216;example.com&#8217;. A better way might be to only include traffic from specific IP addresses, if you know the IP addresses of your website(s)&#8211;this could prevent attempts to spoof your hostname and push vandalism that appears to be legitimate. In either case, <strong>be sure to keep this up-to-date!</strong> If you change your domains, subdomains or IP addresses, it may affect your filtered profile and cut out some legitimate, valuable data.</p>
<p>One quick note: Sometimes you&#8217;ll see additional domains in your list that are from hostnames that have a legitimate purpose. For instance, Google will serve up your site when it shows either a cached version or a translated version &#8212; in both cases, the hostname includes &#8216;googleusercontent.com&#8217;. Bing also shows page caching on cc.bingj.com. You may want to exclude data from caches or translated versions of your pages, but if you&#8217;d prefer to see all of it, include data from those domains as well.</p>
<p><strong>What should Google do?</strong></p>
<p>Google should provide these filters as standard options. You should be able, when creating a profile in Google Analytics, to specifiy what host names and/or IP addresses you&#8217;re willing to accept data from, and be able to provide an on/off switch for accepting data from other sources. Making this option more prominent may help businesses be aware of the issue and protect themselves from day one.</p>
<p>The are more technically complex, and secure, methods of limiting these kinds of problem that Google could consider. One option is to make use of server-side code in conjunction with the JavaScript to authenticate an API key before data is accepted.</p>
<p>At any rate, rumblings of a paid, enterprise-focused Google Analytics can be heard from the horizon. If a service level agreement becomes available to some Google Analytics customers, data integrity and security will be chief concerns.</p>
<p>Until next time,</p>
<p>Colin</p>
<p><strong>UPDATE: </strong>Just a quick note of clarification. Although I focused this post on Google Analytics, I should clarify that GA is not the only tool vulnerable to this &#8212; especially the second method of vandalism. The first method is the easiest thing, and that&#8217;s more specific to GA. This post came out of an internal discussion about the campaign vandalism. To be clear, this kind of thing isn&#8217;t particularly common, and as Emer mentions in a comment below, it tends to be a result of negligence when people copy code or designs, rather than a malicious attempt. So, there&#8217;s no need for immediate concern for most people, but I think it&#8217;s worth being aware of what you can do to protect yourself from this inherent vulnerability in most analytics tools.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napkyn.com/blog/2011/08/05/google-analytics-vandalism/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Track LinkedIn Share Buttons in Google Analytics</title>
		<link>http://www.napkyn.com/blog/2011/08/02/linkedin-share-buttons-google-analytics/</link>
		<comments>http://www.napkyn.com/blog/2011/08/02/linkedin-share-buttons-google-analytics/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 15:03:53 +0000</pubDate>
		<dc:creator>Colin Temple</dc:creator>
				<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Web Analytics]]></category>
		<category><![CDATA[Web Tracking]]></category>
		<category><![CDATA[event tracking]]></category>

		<guid isPermaLink="false">http://www.napkyn.com/?p=593</guid>
		<description><![CDATA[I&#8217;ve been building up a technical post series on tracking social media hook-ups in Google Analytics. I wrote about tracking Google +1 Votes before Google automated it. After they unveiled new Social reports in GA, I followed up with an update on tracking Facebook Like buttons. Next on the docket: LinkedIn Sharing  &#8230; because as [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-595" style="float: right; margin: 0 0 1em 1em;" title="LinkedIn tracking in Google Analytics" src="http://www.napkyn.com/n/wp-content/uploads/2011/07/linkedin-share-GA.png" alt="" width="148" height="155" />I&#8217;ve been building up a technical post series on tracking social media hook-ups in Google Analytics. I wrote about <a href="http://www.napkyn.com/blog/2011/06/02/track-google-plus-one-buttons-google-analytics/">tracking Google +1 Votes</a> before Google automated it. After they unveiled new Social reports in GA, I followed up with an update on <a href="http://www.napkyn.com/blog/2011/07/06/track-facebook-like-google-analytics/">tracking Facebook Like buttons</a>. Next on the docket: LinkedIn Sharing  &#8230; because as analysts, to be ready to answer the tough questions, you really should be <a href="http://www.napkyn.com/blog/2011/06/23/events-track-everything/">tracking everything</a>.</p>
<p>The method of tracking for LinkedIn buttons differs a little bit from the others I&#8217;ve posted so far. Currently, LinkedIn does not provide a callback function that executes when an action is completed &#8212; there&#8217;s no flag in the code that says &#8220;visitor shared something, now what?&#8221;. Instead, we have to build our own JavaScript function that we can bind to an action. In order to do so, this example uses <a href="http://jquery.com/">jQuery</a>, a popular JavaScript library.<span id="more-593"></span></p>
<p>The first step is to get your button code snippet from LinkedIn. LinkedIn calls this service <a href="http://www.linkedin.com/publishers">LinkedIn for Publishers</a>. When you generate the code, it will look something like this:</p>
<div style="padding: 1em; border: 1px dotted #444444; background: none repeat scroll 0% 0% #ffffff;"><code><span style="color: #0000ff;">&lt;script</span> <span style="color: #800000;">type</span>=<span style="color: #008000;">"text/javascript"</span> <span style="color: #800000;">src</span>=<span style="color: #008000;">"http://platform.linkedin.com/in.js"</span><span style="color: #0000ff;">&gt;&lt;/script&gt;&lt;script</span> <span style="color: #800000;">type</span>=<span style="color: #008000;">"in/share"</span> <span style="color: #800000;">data-url</span>=<span style="color: #008000;">"http://example.com/article/"</span> <span style="color: #800000;">data-counter</span>=<span style="color: #008000;">"top"</span><span style="color: #0000ff;">&gt;&lt;/script&gt;</span></code></div>
<p>This script from LinkedIn above generates new HTML which is inserted into the page in order to create the &#8216;Share&#8217; button and its functionality. The code generated includes a new <code><span style="color: #0000ff;">&lt;div&gt;</span></code> element, which has the class name <code>IN-widget</code>.</p>
<p>This gives us the chance to reference the generated button with a little code of our own. Using the jQuery <code><span style="color: #0000ff;">.ready</span></code> event handler &#8212; to ensure that the code does not execute until LinkedIn is finished building the button &#8212; we construct a new function that binds to the &#8220;click&#8221; event for all objects with the class name &#8216;<code>IN-widget</code>&#8216;. In this function, we include the Google Analytics social tracking code, to create a new social event.</p>
<div style="padding: 1em; border: 1px dotted #444444; background: none repeat scroll 0% 0% #ffffff;"><code><span style="color: #0000ff;">$</span>(<span style="color: #800000;">window</span>).<span style="color: #0000ff;">ready</span>(<span style="color: #0000ff;">function</span>() <span style="color: #800000;">{</span><br />
<span style="color: #0000ff;">$</span>(<span style="color: #008000;">'.IN-widget'</span>).<span style="color: #0000ff;">click</span>(<span style="color: #0000ff;">function</span>() {<br />
<span style="color: #0000ff;">_gaq</span>.<span style="color: #0000ff;">push</span>(<span style="color: #800000;">[</span><span style="color: #008000;">'_trackSocial'</span>, <span style="color: #008000;">'LinkedIn'</span>, <span style="color: #008000;">'Share'</span>, <span style="color: #800000;">window.location.href</span><span style="color: #800000;">]</span>);<br />
<span style="color: #800000;">}</span>);<br />
<span style="color: #800000;">}</span>);</code></div>
<p>This new code can be added pretty much anywhere on your page &#8212; you may want to include it right after the code LinkedIn gives you to keep them together, or put it in your header if that&#8217;s how you prefer to organize your site.</p>
<p>Note that in this example, the last parameter, <span style="color: #800000;"><code>window.location.href</code></span>, will send the current URL along as the resource shared. In different systems, you may prefer to output the URL directly, rather than through JavaScript. For instance, in <a href="http://wordpress.org/">WordPress</a>, you may replace the last parameter with the permalink for a post:</p>
<div style="padding: 1em; border: 1px dotted #444444; background: none repeat scroll 0% 0% #ffffff;"><code><span style="color: #0000ff;">_gaq</span>.<span style="color: #0000ff;">push</span>(<span style="color: #800000;">[</span><span style="color: #008000;">'_trackSocial'</span>, <span style="color: #008000;">'LinkedIn'</span>, <span style="color: #008000;">'Share'</span>, <span style="color: #008000;">'<span style="color: #000080;">&lt;?php the_permalink<span style="color: #000000;">();</span> ?&gt;</span>'</span><span style="color: #800000;">]</span>);</code></div>
<p>Now, there is one issue which must be kept in mind. In the case of the Facebook and Google +1 buttons I&#8217;ve previously shared, the social event code only fires after something has been shared. That&#8217;s the benefit of the callback function provided by those services. In the case of LinkedIn, however, what we&#8217;re really tracking are clicks to the share button &#8212; it&#8217;s possible for someone to cancel sharing after clicking the button, so you may get an inflated total.</p>
<p>With that caveat in mind, you&#8217;re all set! Once you&#8217;ve added this JavaScript, your LinkedIn shares will appear in the new social reports in Google Analytics. You can find these reports under &#8220;<strong>Visitors &gt; Social&#8221; </strong>in the new version of GA. With this, your web analyst can help you determine what impact these buttons have on your site and your business. For instance, whether frequently-shared articles get much more <em>converting </em>traffic from LinkedIn, and whether the people who share things are also the people who convert themselves.</p>
<p>Until next time,</p>
<p>Colin</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napkyn.com/blog/2011/08/02/linkedin-share-buttons-google-analytics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Events in Web Analytics: A Case for Tracking Everything</title>
		<link>http://www.napkyn.com/blog/2011/06/23/events-track-everything/</link>
		<comments>http://www.napkyn.com/blog/2011/06/23/events-track-everything/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 19:45:00 +0000</pubDate>
		<dc:creator>Colin Temple</dc:creator>
				<category><![CDATA[Web Analytics]]></category>
		<category><![CDATA[Web Tracking]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[event tracking]]></category>
		<category><![CDATA[Google Analytics]]></category>

		<guid isPermaLink="false">http://www.napkyn.com/?p=499</guid>
		<description><![CDATA[Image Credit: jared via Flickr Everything that happens on a website is an event. We&#8217;re in a strange place with this &#8216;events&#8217; business in web analytics right now. Event tracking is still relatively new and many are only now really discovering them. The events paradigm allows you to track activities that were previously outside the [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center; font-size: 0.8em;"><img class="alignnone size-full wp-image-527" style="border: 1px solid #444;" title="Events" src="http://www.napkyn.com/n/wp-content/uploads/2011/06/events.jpg" alt="" width="580" height="130" /><br />
Image Credit: <a href="http://www.flickr.com/photos/generated/2084287794/">jared via Flickr</a></p>
<p><strong>Everything that happens on a website is an event.</strong></p>
<p>We&#8217;re in a strange place with this &#8216;events&#8217; business in web analytics right now. Event tracking is still relatively new and many are only now really discovering them. The events paradigm allows you to track activities that were previously outside the realm of measurement by firing off a JavaScript codes that say, &#8220;hey, something happened!&#8221;.</p>
<p>This leads us into a bit of misunderstanding. Traditionally, web analytics involved looking at page views. Some page views were boring. Other page views were conversions. Some other page views were somewhere in between, part of a conversion funnel. Web analytics tools became much more relevant when they started tracking ecommerce conversions, so you could see how much money was being made. So far, so good.<br />
<span id="more-499"></span></p>
<p>Events showed up, in part, to respond to the technological development of the web. Suddenly, important stages of that funnel were no longer page views. With methods like <abbr title="asynchronous JavaScript and XML">AJAX</abbr>, some sites suddenly had their entire shopping cart process happen on one page, with each step loading within the page. Page views don&#8217;t tell you what happened there, so event tracking came to the rescue in order to track these new &#8220;events&#8221; alongside your traffic and transactions.</p>
<p>What event tracking highlights is not that there <em>was </em>good tracking and then new technologies broke it. What it shows instead is that the older way of doing things was broken. It tracked only one kind of event: page views. Sometimes, it tracked two: page views and transactions. Good. Not good enough.</p>
<p>Page views are events. Transactions are events. Clicks are events. Chat interactions are events. Searches are events. Customer reviews are events. You get the idea: <strong>everything that happens on a website is an event</strong>. It&#8217;s not that these new event things are an addition to what&#8217;s there, it&#8217;s that the old way of tracking interaction on a website is incomplete. It forced you into one or two types of event, and ignored the rest.</p>
<p>What Google Analytics, Yahoo! Web Analytics, Adobe SiteCatalyst and other tools are now doing, which needs to be done, is allowing you to determine, as an organization, what kinds of events are happening on your website and which ones are relevant to a conversion.</p>
<p><strong>Everything that happens on a website can be tracked.</strong></p>
<p><img class="alignnone size-full wp-image-528" style="float: right; margin: 0 0 1em 1em; border: 1px solid #777;" title="Events in Google Analytics" src="http://www.napkyn.com/n/wp-content/uploads/2011/06/events-ga.png" alt="" width="370" height="152" />At <a href="http://www.napkyn.com/">Napkyn</a>, we don&#8217;t really do implementations, almost as a rule. Our focus is on helping our clients expand the value of their sites. If we sold developer time, we&#8217;d be focused too much on building implementation frameworks and running up project hours, which isn&#8217;t valuable. But we do review our clients&#8217; implementations and make our recommendations about what else should be tracked &#8212; what data we need to tell them how to grow their online business.</p>
<p>When we make these recommendations to clients, more often than not, the answer is something like, &#8220;wow, you can really track that?&#8221; Sometimes that sparks a further list of, &#8220;what about this, and this, and this?! Can you track these?&#8221; The answer to those questions, 95% of the time, is &#8220;yes, we can track that.&#8221;</p>
<p>Strictly speaking, <em>any </em>user interaction on a website can be tracked. This includes anything that&#8217;s clicked on, moused over, spoken with. I say, &#8220;strictly speaking&#8221;, because the things we can&#8217;t track are the little bits that aren&#8217;t on the website itself. Obviously, things like whether the planes are on schedule at O&#8217;Hare and whether or not it&#8217;s raining in Fiji are off-limits for a web analytics tool, unless you happen to be the O&#8217;Hare airport or a news outlet in Fiji. Less obviously, things that are contained within iframes (small windows within a site that load in content from another site) as well as some externally-hosted JavaScript applications can&#8217;t be tracked by the page they&#8217;re on.   This includes some versions of Facebook Like buttons and other social media sharing icons.</p>
<p><strong>Everything that happens on a website <em>should</em> be tracked.</strong></p>
<p>That claim goes beyond my analyst&#8217;s desire to have the whole picture, to sift through every bit of data I can to get killer insights. This isn&#8217;t a quest to know everything about everyone who browses a website. This is about knowing how valuable each ingredient is. You don&#8217;t want useless clutter, but you don&#8217;t want to throw out anything good. So, we need data to determine the value of every interactive piece of a website.</p>
<p>So, everything on your site should be worth tracking. The reasoning is simple: <strong>If there&#8217;s something on your site that&#8217;s not worth tracking, it&#8217;s not worth having on your site.</strong></p>
<p><img class="alignnone size-full wp-image-529" style="float: right; margin: 0 0 1em 1em; border: 1px solid #777;" title="Omniture Custom Events" src="http://www.napkyn.com/n/wp-content/uploads/2011/06/custom-events-omniture.png" alt="" width="236" height="136" />Of course, you have to prioritize what tracking you&#8217;ll add first. If you&#8217;re missing it, the first things you should track are your<strong> macro conversions </strong>&#8211; the ultimate goals of your website: Sales. Lead forms. Donations. This will depend on what your site is about, but you get the idea. This is crucial, and web analytics is next to useless without it.</p>
<p>Next up, track your<strong> micro conversions</strong> &#8212; conversion-related events that drive towards a conversion. An add-to-cart button is a micro conversion. We can argue about semantics, but I count things like newsletter sign-ups as micro conversions. They&#8217;re not the goal of the site, but they get you something valuable: permission to market to someone later.</p>
<p><strong>Engagement events</strong> are third on my list. Some others, like <a href="http://www.kaushik.net/">Avinash Kaushik</a>, count these as micro conversions. This is all semantics, of course, but I like to, at a higher level, differentiate between events that are and are not driving someone towards being a customer. Signing up for marketing emails does that. Adding a product to a cart does that. Clicking a Facebook &#8220;Like&#8221; button does not. These events may still be valuable and certainly show that the visitor is engaged in your website, but they don&#8217;t directly help that visitor become a customer. Other examples include filling out a feedback form or commenting on your blog.</p>
<p>Anything outside of that is <strong>noise</strong>. External links on your blog? Noise. Social media links that take people <em>away </em>from a product page and towards Facebook, Twitter, etc.? Noise. (Yes: That someone &#8220;liked&#8221; a product page without leaving it is valuable. That someone left your conversion-focused site to <em>look at</em> your Facebook page is noise.) Should you track noise? Sure! After all, if you can prove that a feature is useless or even hurting conversions, then you have a case to rid yourself of it. On the other hand, you may be surprised by what the data tells you &#8212; after all, if intuition were perfect, we analysts wouldn&#8217;t have jobs.</p>
<p>You won&#8217;t look at all of this at once, and this isn&#8217;t data for executives. Executives are already drowning in metrics &#8212; this is data that should be at the ready for analysts when hard questions come up. And when the time comes around to make iterative changes or a full redesign, it&#8217;s extremely valuable to be able to see what role each component of your website plays in the overall visitor experience, and most importantly, converting traffic into business.</p>
<p>When such a time comes, you&#8217;ll be thankful that your <a href="http://www.napkyn.com/analyst-program/">web analyst</a> has the data at hand to answer those questions. And if you can get your head out of the traditional page-views&#8211;centric approach, you&#8217;ll stop worrying about what you can track and start thinking about where your next revenue lift should come from.</p>
<p>Until next time,</p>
<p>Colin</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napkyn.com/blog/2011/06/23/events-track-everything/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The website re-launch checklist</title>
		<link>http://www.napkyn.com/blog/2011/03/15/website-relaunch-checklist/</link>
		<comments>http://www.napkyn.com/blog/2011/03/15/website-relaunch-checklist/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 16:15:37 +0000</pubDate>
		<dc:creator>Colin Temple</dc:creator>
				<category><![CDATA[Search Engine Optimization]]></category>
		<category><![CDATA[Web Analytics]]></category>
		<category><![CDATA[ecommerce]]></category>

		<guid isPermaLink="false">http://www.napkyn.com/?p=385</guid>
		<description><![CDATA[First, a quick introduction: I&#8217;m Colin, an analyst here at Napkyn. I&#8217;ve been working at Napkyn for several months now, mainly with some of our Omniture-powered enterprise clients, but this is my first time contributing to the blog. We&#8217;re well into 2011 and coming up to the end of the fiscal year for many businesses. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-428" src="http://www.napkyn.com/n/wp-content/uploads/2011/03/checklist.jpg" alt="" width="140" height="200" />First, a quick introduction: I&#8217;m Colin, an analyst here at <a href="http://www.napkyn.com/">Napkyn</a>. I&#8217;ve been working at Napkyn for several months now, mainly with some of our Omniture-powered enterprise clients, but this is my first time contributing to the blog.</p>
<p>We&#8217;re well into 2011 and coming up to the end of the fiscal year for many businesses. With pressure to plan out the next 12 months in order to continually grow, many of our clients are looking to refresh or relaunch their websites. (We&#8217;re looking at doing the same ourselves&#8211;we&#8217;re doing some cool new things that we&#8217;d like to brag about!)</p>
<p>As <a href="http://www.napkyn.com/analyst-program/">web analysts</a>, we&#8217;ll be the first to tell you that updating a site&#8217;s design won&#8217;t immediately equal performance improvement. Without planning, it can easily go either way: a relaunch can offer major improvement to your revenue performance, but it can also kill your traffic, and even with an amazing conversion rate, fewer visitors means fewer visitors to convert.</p>
<p>So, here&#8217;s the checklist:</p>
<p><span id="more-385"></span></p>
<p><strong>1. Look at the data</strong></p>
<p>Obviously, as web analysts, this is near and dear to us at Napkyn. But it&#8217;s something every business should do when making changes to their marketing efforts. You essentially have two options when deciding what sorts of changes you make to your website. You can:</p>
<ol>
<li>guess, or</li>
<li>know.</li>
</ol>
<p>If you guess, you could throw out the best-converting pieces of your website. Worst case scenario: your business fails entirely. Looking at your current data will let you know which parts of your site are working, and which aren&#8217;t. Worst case scenario: You do as well as you did before.</p>
<p>Everybody wants a sexy brand and that&#8217;s not a bad thing, but good design is not success. I&#8217;ve seen beautiful sites fail and ugly sites make millions. At the end of the day, you probably want changes that make you more money. Look at your data to get insights on what works well for your business and compare it to others&#8217; data and best practices to get a sense for what has worked before.</p>
<p>Of course, not everyone has a head for this stuff, so if you&#8217;re not sure about how to move from guess to know, <a href="http://www.napkyn.com/analyst-program/">we can help with that</a>.</p>
<p><strong>2. Manage your URLs</strong></p>
<p>Next up, a tactical tip. If at all possible, try to minimize the changes to your URL structure. Keep in mind that search engines don&#8217;t index<em> websites</em>, but rather <em>web pages</em> &#8212; and they do this by the URL. Every URL that you remove from your site is a page lost from Google&#8217;s index. Chances are good that you remember from when you first set up your website, getting good rankings can take a while. You don&#8217;t want to risk having to start over. The number one cause of lost traffic after a site relaunch is almost always a drop in search traffic.</p>
<p>There are some cases where keeping your URL structure is not possible. This can happen because you change content management systems or ecommerce software vendors, and the old structure simply isn&#8217;t possible in the new software. Many good systems allow you to set the rules for how URLs are generated, but sometimes this isn&#8217;t available. Fair enough.</p>
<div style="width: 188px; font-size: 0.9em; float: right; margin: 0 0 1em 1em;"><img class="size-full wp-image-429" title="redirecting" src="http://www.napkyn.com/n/wp-content/uploads/2011/03/redirecting.jpg" alt="" width="188" height="200" /><br />
If your redirects look like this, you&#8217;re doing it wrong. Go for a seamless HTTP 301 redirect.</div>
<p>What you&#8217;ll need to do is make sure that every URL on your site still goes somewhere. The best way to do this is with an HTTP redirect &#8212; specifically, using the <strong>HTTP 301 &#8220;Moved Permanently&#8221;</strong> code. This is a message that is sent by your server to a browser, search engine or any other device that visits your site, and tells them that a page moved, and where it went. Other methods, such as meta refreshes and other HTTP redirects are not as effective in keeping search engine listings, so be sure to use this one whenever possible.</p>
<p>If at all possible, configure your server with a listing of all of your old URLs and their new locations. That way, specific product listings, articles or other pages aren&#8217;t lost. If you&#8217;re raking well in Google for selling blue widgets, don&#8217;t redirect your old blue widgets page to your homepage &#8212; point it to your <em>new</em> blue widgets page. This will make sure that your search rankings, incoming links, shopping feed listings and bookmarks are all preserved, and will help potential customers find what they&#8217;re looking for.</p>
<p>A new website almost always means a change in search traffic. This will help you minimize the risk of a natural search free-fall.</p>
<p><strong>3. Keep your customers in the loop</strong></p>
<p>If your business has tends to bring customers back for more, or you have prominent customer login or customer service  areas of your site, you want to be sure that you don&#8217;t alienate them with your new changes.</p>
<p>In customer service areas, inform customers early that the site will be re-launching soon. If you rely on customer involvement with your site, pull a Twitter and let them test the new interface with an option to switch back for now. If that&#8217;s not a viable option, provide linked messages to customers like this: &#8220;Looking for your order history? Our new site files orders right in your <span style="text-decoration: underline;">user profile</span>.&#8221;</p>
<p>This is relevant to my next point, preparing to measure the results. An increase in page views (relative to visits) isn&#8217;t always a good thing when you relaunch a site. Often it&#8217;s a sign of existing customers or visitors familiar with your site who get lost in your site. Visitors who are already familiar with your site may be looking for something in particular, and if it&#8217;s moved, they can become frustrated.</p>
<p><strong>4. Get ready to measure the switch</strong></p>
<p>If you followed item #1, then you&#8217;re making these changes for a reason. Don&#8217;t forget to close the loop, either &#8212; you need to define the metrics that will determine whether or not this change was a good one. <strong>How will you know that you&#8217;ve won? </strong>Make sure that you&#8217;re prepared to handle, and try to make predictions about how the flow of traffic.</p>
<p>Then, once your new site has been online for a while, you&#8217;ll be able to compare the data against the plan, and learn whether or not the changes you made had the intended impact.</p>
<p>The technical side to this involves making sure that you actually can measure the change with some confidence. If you&#8217;re making significant changes to the deployment of your web analytcs tool, you&#8217;ll want to be sure that you&#8217;re not comparing apples to oranges with this change. If you&#8217;re switching tools, try running them concurrently for a time to be sure that they&#8217;re on the same page.</p>
<p><strong>5. Develop a testing plan</strong></p>
<p>Even the brightest marketing minds don&#8217;t get everything right the first time. Your new website may be miles ahead of your old one, but without data on its performance it&#8217;s tough to be certain how it will fare. So, once your new site is launched, you&#8217;re not done.</p>
<p>When measuring the switch (item 4 on our checklist), you&#8217;ll probably notice a few areas that don&#8217;t do quite as well as they did before, or didn&#8217;t improve as much as the rest of the site. These may be individual products or product categories that perform differently, or specific traffic sources that react differently to your site.</p>
<p>Identifying the less-successful areas of your redesign early gives you an opportunity to ensure that you continue to make the proper revisions. Start testing areas of your redesign by using A/B or multivariate testing tools. If you had two competing layouts for a new page on your site, test both! Sometimes the results will confirm your intuition, other times they will surprise you.</p>
<p><strong>6. T</strong><strong>hink of everything </strong></p>
<p>Easier said than done to be sure, so that&#8217;s a joke. But if you&#8217;re tracking your business through high-level metrics, you&#8217;re better equipped to understand where major changes fit in and how to avoid missteps. As <a href="http://www.napkyn.com/analyst-program/">web analysts</a>, our job is to make the big numbers bigger, so when you&#8217;re clear about high-level business performance, the tactical stuff falls into place.</p>
<p>This list isn&#8217;t exhaustive, but following these guidelines can help you make informed decisions around your relaunch, and prevent you from throwing out the things that work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.napkyn.com/blog/2011/03/15/website-relaunch-checklist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clean up your event tracking with jQuery</title>
		<link>http://colintemple.com/writing/2010/08/event-tracking-jquery/</link>
		<comments>http://colintemple.com/writing/2010/08/event-tracking-jquery/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 02:54:51 +0000</pubDate>
		<dc:creator>Colin Temple</dc:creator>
				<category><![CDATA[Web Analytics]]></category>
		<category><![CDATA[event tracking]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[web analysis]]></category>

		<guid isPermaLink="false">http://workwebplay.com/?p=113</guid>
		<description><![CDATA[In my last post, I went through the basics of setting up Google Analytics event tracking. In doing so, I showed how to create click events using the onclick event for things like links and images. However, littering your code with onclick events can be a bit messy, and if you&#8217;re anything like me, you [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post, I went through the basics of setting up <a href="http://workwebplay.com/2010/08/06/google-analytics-event-tracking/">Google Analytics event tracking</a>. In doing so, I showed how to create click events using the <code>onclick</code> event for things like links and images. However, littering your code with <code>onclick</code> events can be a bit messy, and if you&#8217;re anything like me, you prefer your code to be a little cleaner.<span id="more-113"></span></p>
<p>Enter jQuery. If you&#8217;re a web developer and you haven&#8217;t taken <a href="http://jquery.com/">jQuery</a> out for a spin yet, then you need to <a href="http://www.amazon.com/gp/product/0980576857?ie=UTF8&amp;tag=sweetbuysnet-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0980576857">do a little reading</a>. Among jQuery&#8217;s many features is its ability to easily select any element on an HTML page from your JavaScript code, and then manipulate or watch that element.</p>
<p>Watch it like a hawk.</p>
<p>The advantage for event tracking? You can neatly organize your event tracking codes, putting them all in one place &#8212; in your header or an external JavaScript file &#8212; rather than littered throughout your code. It makes tracking your tracking easy, and it can even speed up the deployment of powerful event tracking codes.</p>
<p>Let&#8217;s look at a quick example. Suppose that I have a link on my site, and every time that link is clicked, I&#8217;m tracking it as an event in Google Analytics. My code may look something like this:</p>
<div style="background: #fff; border: 2px dotted #eee; padding: 1em; margin-bottom: 1em;"><code>&lt;a  href="http://www.google.ca/" onclick="_gaq.push(['_trackEvent', 'External Links', 'Click', 'google.ca']);"&gt;Google.ca&lt;/a&gt;</code></div>
<p><strong>Clean it up with jQuery</strong><br />
The details of the link aren&#8217;t important, but essentially I&#8217;m tracking clicks on external links, in this case one that goes out to Google Canada. Here, I&#8217;m using the <code>onclick</code> attribute to assign the action to the link. What jQuery lets me do is move that out of the link. I can replace the JavaScript with an ID in my link:</p>
<div style="background: #fff; border: 2px dotted #eee; padding: 1em; margin-bottom: 1em;"><code>&lt;a  href="http://www.google.ca/" id="GoogleOut"&gt;Google.ca&lt;/a&gt;</code></div>
<p>And then move the tracking code to a <code>&lt;script&gt;</code> area in my header:</p>
<div style="background: #fff; border: 2px dotted #eee; padding: 1em; margin-bottom: 1em;"><code><br />
&lt;script type="text/javascript"&gt;<br />
$(document).ready(function(){<br />
$('#GoogleOut').click(function(){<br />
_gaq.push(['_trackEvent', 'External Links', 'Click', 'google.ca']);<br />
});<br />
});<br />
&lt;/script&gt;</code></div>
<p>What we&#8217;ve done is created a function that will execute on <code>$(document).ready</code>, which is a jQuery handler for the moment that the DOM &#8212; the set of objects on the page &#8212; is fully loaded and ready for manipulation by JavaScript. We then create another function that is bound to the <code>click</code> event of the link we created, which we reference by its ID, <code>GoogleOut</code>. The selector style is the same as CSS: we use the &#8216;#&#8217; symbol for IDs, and the dot &#8216;.&#8217; for classes.</p>
<p><strong>One code for multiple events</strong><br />
Now, we have the advantage of moving all of our event tracking code to this same <code>$(document).ready</code> function, listing them one after another. That helps with the managability, but we still have to set up IDs for each link. What if we have several external links on a page? It would be as tedious to give them each an ID as it would to manage all of the onclicks.</p>
<p>For this, we can use jQuery&#8217;s ability to not only select multiple elements on a page, but gain access to individual elements. First, let&#8217;s change our link code. Rather than give it an unique ID, let&#8217;s give it a class name, &#8220;external&#8221;, which can be used for all of the external links on our site.</p>
<div style="background: #fff; border: 2px dotted #eee; padding: 1em; margin-bottom: 1em;"><code>&lt;a  href="http://www.google.ca/" class="external"&gt;Google.ca&lt;/a&gt;</code></div>
<p>Next, let&#8217;s modify our code to select all external links, instead of just our Google one.</p>
<div style="background: #fff; border: 2px dotted #eee; padding: 1em; margin-bottom: 1em;"><code><br />
&lt;script type="text/javascript"&gt;<br />
$(document).ready(function(){<br />
$('a.external').click(function(){<br />
_gaq.push(['_trackEvent', 'External Links', 'Click', $(this).attr('href')]);<br />
});<br />
});<br />
&lt;/script&gt;</code></div>
<p>You&#8217;ll notice that not only did I change the selector to <code>'a.external'</code>, but I changed the last parameter of the Google Analytics event tracking code to <code>$(this).attr('href')</code>. In my original code, I had written in &#8216;google.ca&#8217; so that we would see in the Google Analytics reports that the click out was on the link to Google, specifically. Now, I want to track all external links on my site, not just to Google.</p>
<p>In this case, I&#8217;ve used jQuery code to select the <code>href</code> attribute (using the <code>.attr()</code> method) of whatever link was clicked (which we specify by <code>$(this)</code>). The <code>href</code> attribute, of course, contains the URL of the link. So, not only does this code now track my link to Google, but it will track each and every external link on my website, as long as I tag them with the <code>external</code> class name, and tell me which external links have been clicked.</p>
<p>By now the power of jQuery for event tracking should be clear &#8212; not only can you use it to clean up your code, but you can track multiple events with a single line of code. You may even be able to add event tracking to large sites without changing much more than the header code. jQuery selectors will allow you to grab existing elements on your web pages without dabbling in their individual code.</p>
<p>If you&#8217;d like to learn jQuery, I highly recommend Sitepoint&#8217;s <a href="http://www.amazon.com/gp/product/0980576857?ie=UTF8&amp;tag=sweetbuysnet-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0980576857">jQuery: Novice to Ninja</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=sweetbuysnet-20&amp;l=as2&amp;o=1&amp;a=0980576857" border="0" alt="" width="1" height="1" />. I have a copy, and it&#8217;s a great resource, both for those who want to dip a toe into the jQuery waters and for those who want to expand their skills with jQuery and JavaScript in general.</p>
<p>It&#8217;s powerful stuff for neat, efficient coding of event tracking. The example I used, specifically, can help you determine which external links on your site are useful, and which aren&#8217;t. For example, using this data a <a href="http://www.napkyn.com/analyst-program/">web analyst</a> could tell you whether the outbound links on your site are helping to complement your site or lend credibility to interested buyers &#8212; or if they&#8217;re just sending visitors away for good.</p>
]]></content:encoded>
			<wfw:commentRss>http://colintemple.com/writing/2010/08/event-tracking-jquery/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Event Tracking with Google Analytics</title>
		<link>http://colintemple.com/writing/2010/08/google-analytics-event-tracking/</link>
		<comments>http://colintemple.com/writing/2010/08/google-analytics-event-tracking/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 20:27:13 +0000</pubDate>
		<dc:creator>Colin Temple</dc:creator>
				<category><![CDATA[Web Analytics]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[event tracking]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://workwebplay.com/?p=111</guid>
		<description><![CDATA[It&#8217;s been quite a while since the Google Analytics team introduced event tracking, but many people I talk to don&#8217;t understand it. In some cases, they don&#8217;t even know it&#8217;s there. Nevertheless, event tracking is one of the most useful tools for getting data into Google Analytics and it opens up analysis on many things [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been quite a while since the Google Analytics team introduced event tracking, but many people I talk to don&#8217;t understand it. In some cases, they don&#8217;t even know it&#8217;s there. Nevertheless, <strong>event tracking</strong> is one of the most useful tools for getting data into Google Analytics and it opens up analysis on many things we just couldn&#8217;t see before.<span id="more-237"></span></p>
<p><strong>What&#8217;s Event Tracking?</strong></p>
<p>Traditionally, web metrics were entirely based on page views. We look at what pages visitors see, and in what order they see them. But that&#8217;s not how the web works anymore&#8230; things are not just page-by-page. You can search a Google map and then move around or drag your location pins without reloading the page. You can post your Facebook status updates and see new tweets come in on Twitter without reloading. You can watch, pause and rewind videos, without reloading. JavaScript, which enables this interaction, is more important than ever to using the web.</p>
<p>Event tracking allows you to gather data when these things happen. Older techniques for tracking things like video plays involved forging URLs &#8212; using a snippet of code that would &#8220;pretend&#8221; that a page was loaded so that we could track the event. With proper event tracking, we no longer need to view things as URLs. We can track events as what they are &#8212; non-pageview events.</p>
<p><strong>Getting Started</strong></p>
<p>Here&#8217;s what you need to know to get started using events in Google Analytics:</p>
<p>First, Google has set up several fields for each event, for the purpose of categorizing them. Events are grouped by Category, Action, Label and Value. Let&#8217;s look at how they play together.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-141" title="Google Analytics Event Groupings" src="http://workwebplay.com/wp-content/uploads/2010/08/Analytics-Event-Groupings.png" alt="" width="667" height="310" /></p>
<p>The above diagram shows four events that are grouped into two categories. The events are represented by the coloured boxes.</p>
<p>Let&#8217;s consider the first category of events, &#8220;Videos&#8221;. This event category will relate to actions that are taken on videos throughout the website. In other words, all events that take place with videos on the site, including videos played, paused, downloaded or shared, will be tracked in this one category.</p>
<p>The next level down is the Action. As the name suggests, actions are the specific thing that was done by the user to trigger this event. In the case of these videos, we have an action for &#8220;Play&#8221; and an action for &#8220;Pause&#8221;.  We can find out pure metrics for actions, such as how many videos were played by a specific segment within a time frame, or we can use them to group specific events and drill down by event type.</p>
<p>On the next level is the label. For our videos, we&#8217;re using the label to indicate which video an action was performed on. For instance, the first event in the diagram is a &#8220;Play&#8221; action labeled &#8220;Training Video&#8221;. Now I know specifically which video was played. The next action has the same label, but is of the &#8220;Pause&#8221; type &#8212; meaning that the training video was paused, triggering this event.</p>
<p>The last number is &#8220;value&#8221;. Value is an integer field which, in the case of my videos, is left blank. Values are used to provide specific counts that are useful to the event. For instance, if the event is the removal of an item from a shopping cart, I may use the &#8220;Value&#8221; field to indicate the dollar amount of the item removed. Then, I can know the total value of all products that were removed from carts prior to purchases.</p>
<p>Our next event category does make use of the values. This category is called &#8220;Contact Form&#8221;, and is used on a website for events related to that form. Our first event&#8217;s action is a form error, which means a failure to send the form because something went wrong.  The label is used to indicate the type of form error, in this case, an &#8220;Invalid Email&#8221;. We&#8217;ve also included a value, &#8220;3&#8243;. That value is, for this event, the number of errors that the specific visitor has encountered so far. Thus, we know that this invalid email was the third error encountered by the user.</p>
<p>The last event is also for the contact form, in this case tracking a successful submission of the form (the Action), and the type of request that was sent (the Label).</p>
<p>Now, you don&#8217;t necessarily need to use Categories, Actions, Labels and Values in the exact way that I&#8217;ve laid out. What matters is that you formulate a method for tracking events and stick to it.</p>
<p><strong>The Code: Tracking an Event</strong></p>
<p>To actually implement the tracking on your site, you&#8217;ll need to add a little bit of JavaScript code. The code I present here uses the asynchronous method of tracking. This is a new method of tracking that Google recently deployed as its standard tracking method. You don&#8217;t <em>have</em> to use the asynch. method to use event tracking, but it may be a good time to upgrade anyways.</p>
<p>You can tell if you have the asynch method by looking at the Google Analytics tracking code on your site. If it begins with the following:</p>
<div style="background: #fff; border: 2px dotted #eee; padding: 1em; margin-bottom: 1em;"><code>var _gaq = _gaq || [];</code></div>
<p>Then you&#8217;re ready to go. If not, just log into your Google Analytics account, re-copy your tracking code and update your site.</p>
<p>Now, you just need to add tracking codes to the events on your site. Suppose, for example, that you have an image gallery on your site, and that clicking on an image enlarges it. Your code for a particular image may look something like this:</p>
<div style="background: #fff; border: 2px dotted #eee; padding: 1em; margin-bottom: 1em;"><code>&lt;img src="foo.jpg" alt="" /&gt;</code></div>
<p>Let&#8217;s say you want to track how many people click on this image. You&#8217;ll want to add the tracking code to the <strong>onclick</strong> event for that image. Onclick is a JavaScript event that allows you to execute code when someone clicks on something. To do so, add this code.</p>
<div style="background: #fff; border: 2px dotted #eee; padding: 1em; margin-bottom: 1em;"><code>&lt;img src="foo.jpg" alt="" onclick="_gaq.push(['_trackEvent', 'Images', 'Enlarged', 'foo.jpg']);" /&gt;</code></div>
<p>Let&#8217;s examine the code for that event more closely. The code to track an event in Google Analytics is as follows:</p>
<div style="background: #fff; border: 2px dotted #eee; padding: 1em; margin-bottom: 1em;"><code>_gaq.push(['_trackEvent', 'CATEGORY', 'ACTION', 'LABEL', 'VALUE']);</code></div>
<p>For our event, we coded it as follows:</p>
<div style="background: #fff; border: 2px dotted #eee; padding: 1em; margin-bottom: 1em;"><code>_gaq.push(['_trackEvent', 'Images', 'Enlarged', 'foo.jpg']);</code></div>
<p>The first field in the _gaq.push() function is called &#8216;_trackEvent&#8217;. What it does is obvious &#8212; it tells Google Analytics that we want to track an event. The next field is the category. We set it to &#8220;Images&#8221;, because that&#8217;s what we&#8217;re dealing with. The action is the next field, which I set to &#8220;Enlarged&#8221; to tell us that someone clicked on an image to enlarge it. The last field is for the label, which I set to the filename of the image that is being enlarged, so that I can track how many times each image is enlarged.</p>
<p>Notice how I didn&#8217;t add a fifth field for the value. I&#8217;m not tracking a value here at all, so I can omit that bit. In fact, you can also omit labels if you don&#8217;t need them.</p>
<p>Let&#8217;s look at another example: tracking external links. If someone clicks on a link that takes them outside of your site, you don&#8217;t have access to the data for the page they land on, so you wouldn&#8217;t know it happened. With events, you can trigger a bit of JavaScript to occur right before they leave your site. For example, let&#8217;s say I want to track how many people click on the link to my Twitter account. All I need to do is add an event:</p>
<div style="background: #fff; border: 2px dotted #eee; padding: 1em; margin-bottom: 1em;"><code>&lt;a href="http://twitter.com/cailean" onclick="_gaq.push(['_trackEvent', 'External Links', 'Click', 'Twitter']);"&gt;Follow me on Twitter&lt;/a&gt;</code></div>
<p>Now, I can track who clicked on the link to my Twitter profile, and how many times that link was clicked.</p>
<p><strong>Reporting Event Data</strong></p>
<p>Once you have your tracking set up, you can view events as they occur. Note that you don&#8217;t need to set up events in Google Analytics before you track the codes. Just like you don&#8217;t need to add every URL into Google Analytics manually, GA will track event data as it comes in automatically.</p>
<p>You can find the event tracking under Content &gt; Event Tracking. Here, you can view events by Category, Action or Label&#8230; or you can drill-down into the heirarchy to see specific subsets of the data (such as all Clicks for a particular link). You can also segment this data just as you can with normal page view data, so you can see which videos were played by people who bought products, or whether or not Canadians had a hard time filling out your forms.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-143" title="Google Analytics Events" src="http://workwebplay.com/wp-content/uploads/2010/08/Google-Analytics-Events.png" alt="" width="500" height="232" /></p>
<p><strong>Taking Action on the Data</strong></p>
<p>Event tracking is a great tool to give you some more data, but as always, the value of web analytics is always in the insights that data brings. This is where a <a href="http://www.napkyn.com/analyst-program/">web analyst</a> can dive into the data and come up with actionable things you can do to meet and exceed the business goals of your site.</p>
<p>In the meantime, I&#8217;ll talk a little more about improving and organizing your event tracking in some upcoming posts. Be sure you don&#8217;t miss them by <a href="http://feeds2.feedburner.com/WorkWebPlay">subscribing to Work, Web, Play</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://colintemple.com/writing/2010/08/google-analytics-event-tracking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Is your web traffic seasonal?</title>
		<link>http://colintemple.com/writing/2008/07/seasonal-web-traffic/</link>
		<comments>http://colintemple.com/writing/2008/07/seasonal-web-traffic/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 21:35:21 +0000</pubDate>
		<dc:creator>Colin Temple</dc:creator>
				<category><![CDATA[Web Analytics]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[publishing]]></category>
		<category><![CDATA[trends]]></category>

		<guid isPermaLink="false">http://workwebplay.com/?p=7</guid>
		<description><![CDATA[As we go about our lives throughout the year, our patterns change. In the summer, we&#8217;re more likely to be on vacation, or outside enjoying the sun. In the winter, we&#8217;re more likely to spend more time indoors, maybe at the computer. Your occupation might also change dramatically from season to season, whether you&#8217;re a [...]]]></description>
			<content:encoded><![CDATA[<p>As we go about our lives throughout the year, our patterns change. In the summer, we&#8217;re more likely to be on vacation, or outside enjoying the sun. In the winter, we&#8217;re more likely to spend more time indoors, maybe at the computer. Your occupation might also change dramatically from season to season, whether you&#8217;re a student, botanist, hockey player or lifeguard.<span id="more-7"></span></p>
<p>So it&#8217;s no surprise, then, that the time of year will make a big difference on your web traffic. Of course, any ecommerce or consumer-focused site will notice a lift in the November-December holiday season. But what other factors influence your traffic?</p>
<p>I was just looking through my Google Analytics account when I noticed that one of my sites, <a href="http://www.ancient-mythology.com/">Ancient-Mythology.com</a>, had picked up a bit over the past two weeks. I took a step back and looked at the charts for the past two months, and realized that my traffic was coming out of a two-month lull. Curious, I took a look at the past 22 months of data. The answer was obvious.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-6" title="Seasonal Web Traffic" src="http://workwebplay.com/wp-content/uploads/2008/07/seasonal-traffic.jpg" alt="" width="481" height="55" /></p>
<p>It doesn&#8217;t take a degree in rocket surgery to put this one together. As my clever clip-art inserts demonstrate, my traffic was down every summer and during the Christmas holidays. This is a strong indicator that my mythology site is being used primarily by students, most of whom are probably working on a high school class project, or studying humanities or religion in college.</p>
<p>We tend to look at our stats on a week-to-week or month-to-month basis, but there&#8217;s plenty to be learned by looking at the big picture. So take a look at your stats over the past couple of years. Your niche may have an annual pattern &#8212; and you might learn who&#8217;s really visiting your site, as I did.</p>
<p>Once you&#8217;ve figured this out, capitalize on it. Organize your marketing campaigns and major site updates according to these patterns, so your site is at its prime when you have the most visitors. Use this data to determine the needs of your visitors at the time, as well. For example, I might see success if I were to advertise or affiliate with other student resources, or services offering essay-writing help.</p>
]]></content:encoded>
			<wfw:commentRss>http://colintemple.com/writing/2008/07/seasonal-web-traffic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

