type:
integration
system:
Google Analytics
name:
Campaign Tracking Tutorial
description:
Track your advertising campaigns in Google Analytics
tag:
analytics, tracking, tutorial

Using FoxyCart 2.0? Google Analytics is now a configuration option within your store's administration. Take a look at Store Analytics for more information.

Google Analytics Campaign Tracking

What it is

With Google Analytics you can track inbound links as campaigns. For example, if you send out an email to 1,000 people you could tag and track the links to your site in the email. Then you could track the sales (or other goals) generated from that email campaign separately.

How to do it

Use Google's Link Builder to create your links. The rest will be handled automatically (assuming you've actually set up Google Analytics in the first place).

Suggestions

If you're using scripts that rely on the URL (like Digg scripts) or other dynamic site functionality you might want to use a link like this (with the anchor, #):

http://www.yourdomain.com/testing.html#utm_source=newsletter&utm_medium=email&utm_campaign=valentines-day-email

instead of the default query string, ?:

http://www.yourdomain.com/testing.html?utm_source=newsletter&utm_medium=email&utm_campaign=valentines-day-email

The reason for doing this is that some code (like the Digg script that generates “Digg This” links) interprets any additional querystrings as a different page. So index.html and index.html?urm_source=blah… would generate different Digg links. Not so hot.

In order to make this happen, you'll need to add some script to your Google Analytics call. This is described here. It will look something like this:

<script type="text/javascript"> 
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); 
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); 
</script> 
<script type="text/javascript"> 
   var pageTracker = _gat._getTracker("UA-12345-1"); 
   pageTracker._setAllowAnchor(true);
   pageTracker._trackPageview(); 
</script>

The important line is the pageTracker._setAllowAnchor(true); bit. Check the aforementioned PDF for details. It's actually a good read.

Site Tools