Tracking your Offline Campaigns
DiggBlinkRedditDeliciousTechnorati
article by Srirangan
by Amit Singh
If you run offline campaigns, for example on TV or in print, you may be considering how to best track campaign ROI. Offline campaigns that refer the reader or viewer to a URL can be tracked using Google Analytics. Here are four approaches you can use.
As an example, let's imagine that www.googlestore.com runs an offline print campaign which points readers to googlestore.com/coolstuff. The purpose of the hypothetical Coolstuff campaign is to market unique Google gift items. The Coolstuff marketers want to see conversion rates and measure revenue and ROI on their offline campaign. Specifically, they want to be able to see a line item in the Campaign Conversion report and the Campaign ROI report for the Coolstuff campaign.
Approach #1 - Meta Refresh
------------------------------
When a browser client requests a URL associated with an offline campaign (for example, the www.googlestore.com/coolstuff for our hypothetical campaign), the web server can return an HTML document containing a meta-refresh tag which redirects the visitor to the appropriate landing page.
The HTML code is
<html>
<head>
<title>Coolstuff</title>
<!-- Include the Google Analytics tracking code to additionally track page views of /coolstuff i.e. the redirect page. This step does not affect offline campaign tracking.-->
<!-- INSERT YOUR GOOGLE ANALYTICS TRACKING CODE HERE -->
<!--
Use meta tag to redirect the client to the actual landing page/details/coolstuff.html
2 additional query parameters have been added
utm_source offline Source of the campaign is offline.
utm_campaign Coolstuff Name of the campaign.
The browser will wait for 2 second before requesting the redirected webpage.
__utm.js must be included on the destination page.
-->
<meta http-equiv="refresh" content="2; url=/details/coolstuff.html ?utm_source=offline &utm_campaign=Coolstuff">
</head>
<body>
.
.
.
</body>
</html>
While this approach will satisfy most needs, it has the following drawbacks. First, there is no guarantee that the JavaScript tracking code will complete execution before the page redirects. One solution to this is to wait two seconds before redirecting, thereby reducing the chance of the pageview not being tracked.
The second drawback is that it does not exclude visitors who may have clicked the link and who were therefore not really referred by the offline campaign. There is, however, a way of excluding visitors who clicked the link online; see Approach #2.
Approach #2 - Exclude Referrals.
------------------------------
Use this approach if you want to include in your campaign tracking only visitors who actually typed the URL into their browser.
The HTML code is
<html>
<head>
<title>Coolstuff</title>
<!--
Include the Google Analytics tracking code to additionally track page views of /coolstuff i.e. the redirect page.
This step does not affect offline campaign tracking.
-->
<!-- INSERT YOUR GOOGLE ANALYTICS TRACKING CODE HERE -->
/*
Function redirect(destination, source, campaign)
Redirects user to the destination page.
If user typed URL in the address bar, additionally adds campaign variables. Does not add campaign variables for users coming from clicks. Reads the document.referrer property to check if user typed web address.
Params:
destination - URL of destination page. Maybe absolute or relative.
source - Campaign source
campaign - Campaign name.
*/
function redirect(destination, source, campaign)
{
if ( ! top.document.referrer || top.document.referrer == "" )
{
if ( source && campaign )
{
destination = destination + "?" + "utm_source=" + source + "&" + "utm_campaign=" + campaign;
}
}
window.location.href = destination;
}
</script>
</head>
<body
onload="redirect('/details/coolstuff.html', 'offline', 'Coolstuff')">
</body>
</html>
Approach #3 - No redirect is needed because the destination URL contains the content.
------------------------------
Let's assume that googlestore.com/coolstore contains all the content and there is no need for a second page. In this case, you'll need to reload the page with the campaign variables appended to the URL.
The HTML code is
<html>
<head>
<title>Coolstuff</title>
<!--
Include the Google Analytics tracking code to additionally track pageviews of /coolstuff i.e the redirect page. This step does not affect offline campaign tracking.
-->
<!--
INSERT YOUR GOOGLE ANALYTICS TRACKING CODE HERE
-->
/*
Function addCampaignTagsAndRedirect(source, campaign)
Adds campaign tags and redirects to self. Checks if current URL has campaign tags to avoid self-redirecting loop Does not validate integrity of passed in params. Expects current URL to not have query parameters.
Params:
destination - URL of destination page. Maybe absolute or relative.
source The source often terms like'print-nytimes'
campaign Name of campaign.
*/
function addCampaignTagsAndRedirect(source, campaign)
{
var url = top.location.href;
if (
url.indexOf('utm_source') == -1 &&
url.indexOf('utm_campaign') == -1
)
{
top.location.href = url + '?' +
'utm_source=' + source + '&' +
'utm_campaign=' + campaign;
}
}
</script>
</head>
<body onload="addCampaignTagsAndRedirect('offline', 'Coolstuff')">
.
.
.
</body>
</html>
To prevent duplicate visits from affecting report data, you will need to add an exclude filter ignoring request stems of type /coolstuff (i.e. without the query parameters). Add this filter to your profile.
Note that a call to urchinTracker('/coolstuff?utm_source=print&utm_campaign=Coolstuff') will not work. The urchinTracker() function is not designed to handle campaign variables.
Approach #4 - Use the redirecting functionality of your web server.
------------------------------
Web servers often allow the creation of aliases for documents that they serve. For example,
/coolstuff => /details/coolstuff.html?utm_source=print &utm_campaign=Coolstuff
redirects requests to www.googlestore.com/coolstuff to www.googlestore.com/details/coolstuff.html and adds the campaign tracking variables. Please note that this syntax is just used to illustrate the concept, for exact syntax, refer to your web server documentation.
Google Analytics uses JavaScript to track campaigns; make sure that your redirect approach allows the campaign variables to appear in the browser's address bar.