How to Track Conversions for Both Internal and External Campaigns/
January 26, 2012
After you learn about campaign tagging for Google Analytics, you may be excited that you can add all that extra information to a simple little link – so excited that you want to put campaign tags on every kind of promotional link that leads to a web page on your site. But there’s one kind of link that should never get campaign tags. You should never put GA campaign tags on internal banners or on-site promotions that lead from one page of your site to another.
Why You Shouldn’t Use GA Campaign Tags for Internal Promotions
Imagine this sample scenario: A visitor clicks an email campaign link from your latest marketing effort and lands on your site. Google Analytics records the traffic source and starts collecting data for the visit. Of course you hope that the visitor will continue to view pages on your site and maybe even convert on an important goal like registering for an upcoming conference or buying your latest e-book. When they do, you’ll be able to attribute that conversion to the campaign and evaluate that campaign’s success.
But what happens if the visitor clicks an internal banner with campaign tags before they convert? Google Analytics records a new traffic source and starts a whole new visit. So now you have at least two problems: You’ve split what was really one visit into two visits, skewing your data. And you can’t tie the original email link directly to the conversion, because the conversion happens in a separate visit.
To track internal promotions without splitting visits and losing credit for conversions, try one of these instead:
- Add your own campaign parameters (not GA campaign tags) to the links and view the data in your Content/Pages reports
- Use event tracking when a visitor clicks an internal banner or promotional link and view the data in your Content/Events reports
Alternative #1: Add Your Own Campaign Parameters
The first method involves making up your own tags, ones that GA won’t recognize and will pass right along into your Pages reports with the rest of the URL. Instead of utm_source or utm_medium, for example, you might simply add something like “from=promo” to the target link:
Or you could use a more detailed scheme if, for example, you run internal promotions with many types of links in different places. So you might have one parameter similar to campaign name, like “campname=e-book”, and another parameter that describes the links, like “camplink=home-page-banner” or “camplink=side-nav-feature”:
As long as you stay away from Google Analytics utm parameters, these types of URLs will appear in your Content/Pages reports and you can tell by the number of pageviews exactly how many times a visitor clicked the tagged link to arrive there.
Alternative #2: Use Event Tracking
The second method involves adding a bit of code to the link on the page. Inside the anchor tag (a href=”…”) include an onclick event like this (a href=”…” onclick=”…”). And in the onclick event, add the event tracking code using an event category and action like “internal promo” and “home-page-banner”:
onclick="_gaq.push(['_trackEvent', 'internal promo', 'home-page-banner', this.href]);"
After the event category and action it’s a good idea to include the optional event label. For the label you can simply write the target (href) of the link, using this.href.
View this data in your Content/Events reports by drilling into Top Events through the “internal promo” category, where you can see the how many times someone clicked each of your different internal promotional links.
Combine with Custom Variables for Goal Data
Okay, so where’s the goal data? You may have noticed that Google Analytics has Goal tabs in Traffic Sources reports, but not in Content reports. The whole point of these alternatives was to keep your original traffic source intact so you could tie it to a conversion. But you probably also want to know how well your internal promotions lead to conversions, too, right? Of course you do.
Well, there’s another set of reports that has Goal tabs, where you can combine conversion data with a set of dimensions that you define, and that’s the Audience set of reports. You can write a custom variable with the parameters or event data you created in either alternative described above. And then you can easily compare goal conversion data in a single table that lists all your internal promotions.
The thing to remember when writing custom variables is that the data needs to piggyback on a _trackPageview or _trackEvent call.
For the event tracking alternative, add _setCustomVar to the onclick event, like this:
onclick="_gaq.push(['_setCustomVar', 1, 'internal promo', 'home-page-banner', 2]);_gaq.push(['_trackEvent', 'internal promo', 'home-page-banner', this.href]);"
The resulting custom variable code (placed before the call to _trackPageview) could be something like this:
_gaq.push(['_setCustomVar', 1, 'e-book', 'side-nav-feature', 2]);
In both cases I’ve set a session-level custom variable (indicated by the number 2 above), and I’ve set the custom variable to slot number 1 (out of 5). If you are already using that slot then you’ll need to assign it to another one. Read our post about how to keep track of custom variable slots and scopes for more guidance.
No More Split Visits
Avoid the split-visit problem. Keep visit data together by keeping internal and external promotions separate. Track your external campaigns with GA’s utm parameters and try one of the above alternatives for internal campaign tracking. And tie both external and internal promotions to conversion data to evaluate the success of each.
What methods do you use for tracking internal promotions? And how do you tie them to conversion data? Please share in the comments.