Upcoming LunaMetrics Seminars
Pittsburgh, Jan 12-16 Boston, Jan 12-16 New York City, Jan 26-30 Denver, Feb 9-13

How to Track Conversions for Both Internal and External Campaigns

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:

http://www.anything.com/buy-ebook.html?from=promo

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”:

http://www.anything.com/buy-ebook.html?campname=e-book&camplink=home-page-banner

http://www.anything.com/buy-ebook.html?campname=e-book&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.

Internal campaigns in the Content Pages report

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.

Internal campaigns in the Top Events report

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.

Conversion Data in Custom Variables report

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]);"

For the other alternative where you make up your own campaign parameters, I suggest adding _setCustomVar to the page that’s the target of the link, right before the usual call to _trackPageview. You can use a little Javascript to read the URL and write the custom variable according to the campaign parameters that appear there. For example, if the URL is:

http://www.anything.com/buy-ebook.html?campname=e-book&camplink=side-nav-feature

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.

Dorcas Alexander

About Dorcas Alexander

Dorcas Alexander is a Digital Analyst working with Google Analytics. Her path to LunaMetrics included stints in ad agency creative, math, computer science, language technology research, and corporate training. She loves to learn and teach what she’s learned. One of the top-rated tournament Scrabble players in Pennsylvania, Dorcas has an insatiable drive to compete and win. “Impossible” is not in her vocabulary.

http://www.lunametrics.com/blog/2012/01/26/track-conversions-internal-external-campaigns/

36 Responses to “How to Track Conversions for Both Internal and External Campaigns”

Jessica says:

Thank you so much for this post! Its very helpful. Follow-up question for you. If a user comes in organically, then clicks on an internal promotion link with a campaign tracking code on it, does the visit still get split? Does the 2nd part of the visit get attributed to the new campaign (and its associated traffic source info – e.g. medium, source etc.)

Thanks!

Dorcas Alexander Dorcas Alexander says:

Hi Jessica, Yes, the visit is split and a new visit begins as soon as GA records a traffic source that is different from the current one. So it doesn’t matter whether the current source is an AdWords click or an email campaign or an organic search or something else. If you’ve used utm parameters for internal campaigns, they’re almost certainly going to be different from the visitor’s actual external traffic source. And that means a new visit starts as far as GA is concerned. Hope that helps clarify things!

Marc says:

Why not just use utm_campaign or utm_content? Won’t that leave the original utm_source and utm_medium untouched and still see the visit as a single visit?

Dorcas Alexander Dorcas Alexander says:

Hi Marc, Good question. The problem is that Google Analytics won’t recognize utm_campaign or utm_content unless utm_source is also present in the URL. I wondered about this myself a few months ago, so I simply tried it and that was the result.

Marc says:

Thanks for the info, I had been meaning to test it myself.

If you use custom campaign parameters, can GA show all page views together or will the page views always be separated?

Dorcas Alexander Dorcas Alexander says:

They will be separated, but you can address this in a couple of ways. You can keep them separated in one profile, and in another profile roll them up by removing the custom parameters (edit the profile settings in that profile and list the custom parameters under “Exclude URL Query Parameters”). Or you can look at data for one page at a time, by searching the content report for the root URL without any parameters. The table will still list the URLs with different parameters separately, but you can look at the scorecard summary at the top of the table to see the totals for each metric.

Marc Perry says:

I’ve been searching quite a while to find info on tracking internal ad campaigns. Simple and thorough explanation. Thank you!

Kristina says:

The post is very useful, thanks for it.
I have a question: how is it possible to track a conversion from the same visitor that comes from different sources?

Dorcas Alexander Dorcas Alexander says:

Hi Kristina, If I understand your question correctly, the answer is in the Multi-Channel Funnel reports. There you will see all the different sources for the past 30 days for a conversion, in what Google Analytics calls the “conversion path”. Look under Conversions > Multi-Channel Funnels > Top Conversion Paths. If you have many types of conversions, at the top left of this report you can choose a single Goal (or choose Transactions if you have e-Commerce). You can read more in the official documentation about Multi-Channel Funnels. Hope that helps!

Yousef says:

Hi Dorcas,

Thanks for your post. Don’t you think the Multi-Channel Funnels remove some of the disadvantages of the session-split?

In your example, the email campaign would register as an “assisted conversion” right?

Any other disadvantages to using tracking for internal links?

Dorcas Alexander Dorcas Alexander says:

Hi Yousef, While it’s true that you can look at assisted conversions in Multi-Channel Funnel reports, it’s not ideal because you’re inflating the number of visits to your site every time you split a session. All of the metrics that take number of visits as the denominator (Pages/Visit, Bounce Rate, just to name a couple) will be affected. Much better to base your data on true sessions, which will lessen the possibility for misinterpretation.

MIke says:

Hi Dorcas,

I’m trying to track campaigns from 1 site to Another. Example – Email Campaign > Site A > Site B. While keeping same tags. Is this possible?
Thx.

Dorcas Alexander Dorcas Alexander says:

Hi Mike, Yes, it is possible. You need to have the basic GA tracking code on both Site A and Site B, along with some customized code to track a visit across both sites. You need the customized code so that GA will use the existing GA cookies from Site A (with your email campaign info) instead of writing new GA cookies for Site B (dropping your campaign info). The type of customized code you need depends on how Site A and Site B are related. You need code for subdomain tracking if they share the same domain, e.g. Site A = http://www.mysite.com and Site B = store.mysite.com. You need a little more code to do cross-domain tracking if they do not share the same domain, e.g. Site A = http://www.mysite.com and Site B = http://www.myotherwebsite.com. See details in the official Google documentation here: https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite.

Mike says:

Thanks.

It looks like i need cross-domain tracking! Currently i have the 2 domains with 2 different UA numbers. Would they need to be under the same UA? Don’t really want to mess up any historical data.

Dorcas Alexander Dorcas Alexander says:

No, they do not have to have the same UA to share source/campaign information. They only have to have the same UA if you want to tie conversions on one site to entrances/events on another site, i.e. you would need to track a visitor’s activities all in one visit.

shailen says:

Hi Dorcas,

Thank you for this valuable information.
I have a more complex issue: I have an anonymous website (www.siteanonymous.fr dummy for understanding) with some banners that points (target=_blank) to a 3rd Party Booking Engine. So far so good. I am using Track Event in GA.
My issue is that i am using the same banners on multiple platforms (Social Medias, forums,blogs …) and i cant track those banners since they link directly to the Booking Engine that i dont have access to its GA.

What i did is that i setup a relay page in between like below:
link banner on http://www.siteanonymous.fr has been setup to http://www.relaywebsite.com/permanent_redirection.php?utm_source=siteanonymous&utm_medium=banner&utm_campaign=villas-treat (with a 301 permanent redirection to the Booking Engine https).

In another words: the same schema
siteanonymous.fr -> relaywebsite.com(301 permanent redirection) -> Booking Engine(https)

I thought using the utm_source for various sources like FaceBook, Twitter … like this:
permanent_redirection.php?utm_source=facebook&utm_medium=minibanner&utm_campaign=villas-treat
permanent_redirection.php?utm_source=twitter&utm_medium=minibanner&utm_campaign=villas-treat

I also create an Event Tracker on the anonymous website for the trigger banners and set up Goal on the Relay website with the URL Destination= permanent_redirection.php

UNFORTUNATELY GA is not recording the 301 REDIRECTION on the RELAY WEBSITE :(

Is there a solution for it please or another way of doing it … much simpler …lol.

Please note that i can provide the real websites involved if necessary.

Thanks in advance.

Kind regards,
Shailen

Dorcas Alexander Dorcas Alexander says:

Hi Shailen, Since 301 redirects by definition happen on the server side, the page never loads in a browser and GA’s scripts never get fired. You can, however, use server-side code to send __utm.gif requests to GA that look like pageviews of permanent_redirection.php (and will match your goal setup). Keep in mind that these server-side hits will all be single-page “visits” i.e. “bounces”, so you’ll probably want to create a new separate profile that includes server-side hits with everything else – and exclude the server-side hits from all your other profiles.

Paul says:

Thanks Dorcas for the article and great follow up q&a… you answered more that one question I had.

Martin Donov says:

Thanks for the great post
I was just struggling with my messed up GA campaign results (:

I have one stupid question..
I’m using an ad server (Adtech) for loading my Internal campaigns/banners. In this case scenario, how can use the “event tracking” for my internal campaigns

We have the code of the ad banner in our ad server platform. Do I have to put the event tracking code there..

Enjoy your day,
Martin
(:

Shaun says:

Does using utm codes to track internal campaigns affect bounce rates. I am seeing very high bounce rates for traffic sources, but low bounce rate for internal campaigns. I believe this is due to visitors landing on the home page where most links are utm tagged for internal campaign.

Super helpful article BTW.

Dorcas Alexander Dorcas Alexander says:

Hi Martin, I’m not familiar with how AdTech serves banners, but if it is possible to get event tracking code in there (and you will need to do that so you can pass the specifics of which ad is being served), it may still be difficult to capture that data as part of the same visit as the rest of the visitor’s clicks. This is because the ad may be served in an iFrame and the content may be on a different domain from your website, so it will look like a separate visit. I say “difficult” but not “impossible” because you can try to implement cross-domain tracking to tie the clicks together into one visit. See Google Analytics Help for more info about cross-domain tracking.

Dorcas Alexander Dorcas Alexander says:

Hi Shaun, Bounce rates definitely will be affected if visitors click a utm-tagged internal campaign on the first page of their visit. The true traffic sources of those visits will look like they resulted in bounces, when the reality is that visitors continued their visits by clicking on your internal campaigns.

Vladas says:

Very good post! We actually track both external incoming and internal traffic with UTF parameters. And now we know the way out from the problem!
We will fix it right now! THANK YOU!

Dmitry says:

Thank you for the post! It turns out that using custom variables we can track conversions only for one internal campaign because custom variable stores only 1 value. It seems easier to use advanced segments to view conversions for each campaign. Am I right? Thanks once again :)

Dorcas Alexander Dorcas Alexander says:

Hi Dmitry, Custom variables can store many values. When you have implemented them, each value will get its own row in the Custom Variables report (under Audience > Custom in the GA interface).

Tony says:

In your example you set the opt_scope to 2 which is session level. My question is, my website has multiple banners which I’ve included tracking. By using session level, won’t it only track the first banner the user clicks? So if they click on a jewelry banner and then a shoe banner I should only see tracking for jewelry correct? Do you suggest changing it to visitor or page level to track the multiple banner clicks?

Dorcas Alexander Dorcas Alexander says:

Hi Tony, Sorry for the delayed reply. By using session level, it will only track the last banner the user clicks. The session level variable is overwritten throughout the session so the last value wins. The same is true for a visitor-level variable. So if you want to keep track of every banner a user clicks, you must use a page-level custom variable. Using page-level custom variables has its own drawbacks when it comes to reporting via the standard custom variable reports, however. See my post on Why You Need a Custom Report for Page-Level Custom Variables for more explanation.

Casey says:

Hey Dorcas! I have a question regarding adding my own custom variables for internal tracking of my links. I’m trying to obtain the actual conversions that took place from a specific banner I’m tracking. Is this available in the Content > Pages report? I can’t seemt o find it. Thanks!

Dorcas Alexander Dorcas Alexander says:

Hi Casey, Conversion data is related to sessions, not pages (hits), which is why you don’t see conversions in the Pages report. You need a custom variable to tie internal campaigns to conversions. See what I wrote in this blog post under the heading: “Combine with Custom Variables for Goal Data” which explains how to do it.

Chris says:

Hey Dorcas,

Can event tracking be setup to work with sites that serve “House Ads” aka internal campaigns dynamically?

Let’s say I want to track the success or all house ads, but there are 50 different versions of the ad and they are served dynamically across the site. These same ads share inventory with paid advertisers that we do not want to track.

Do you understand my issue?

Chris

Dorcas Alexander Dorcas Alexander says:

Hi Chris, I think I understand your issue and the answer is, yes, you can use event tracking just on house ads but only if there is some way to distinguish them from the paid ads… Do the ads have unique labels? Are they called from different paths within the inventory? Whatever the distinguishing feature is, you have to be able to write a condition that triggers the event tracking. Have a chat with the team or vendor who knows how the code works that serves house ads and paid ads from the same inventory and then you’ll know for sure whether or not it is possible.

Quaid says:

Hello,how are you?
So I am lost. I put and AD ON Bidvertiser.I see clicks and conversions. How and where do I check these Conversions?Everybody is giving me the Runaround.
Thanks.

Gail says:

I admit I am a newbie, and find this discussion difficult to understand. What I am trying to do: the website is for a church. I have each sermon as a link to an mp3 file within the website. The church wants to know how many times each sermon is accessed (onclick counter). What is my approach? Code? Thanks!

Dorcas Alexander Dorcas Alexander says:

Hi Gail, You want to fire a GA event every time someone clicks a link to a sermon and, yes, this means adding code to the page. The code is described in the developer’s guide for GA event tracking. Once you understand how the basic concept works, you may want to use jQuery to automatically detect when someone clicks a sermon link, rather than hard-coding every link on the page (and having to update the code every time a new link is added). See my colleague Alex Moore’s recent post for a handy jQuery code generator which may be helpful when you reach that point.

Anne says:

Hi Dorcas, I was wondering if you could help me out. I have a website that is running several campaigns (offline marketing such as brochures, posters, as well as online – PPC, Display and I also want to track internal promotions e.g. we have homepage banners that lead to the campaign). I am able to track if for the others but I am having difficulty doing it for internal.
My question is how to measure leads (setup as goals in Google Analytics) from people visiting the homepage banner. I was wondering if the best way to do this is to create a custom advanced segment to include the landing page (e.g. http://www.domain.com/campaign-page?campaign-name=fake-campaign&campaign-link=homepage-banner) which will then filter out the results when I visit the goals screen in Google Analytics or either click ‘Visits with Conversions’ preset advanced segment as well. Do you think this is a good way to go about it or is there a better solution?

Dorcas Alexander Dorcas Alexander says:

Hi Anne, The best solution is to add a custom variable as I describe in the article, because then GA will pre-calculate goal data for you. However, advanced segments such as the ones you describe will work. The disadvantages of advanced segments can be minor (slightly less convenient than pre-calculated data) or they can be major (they can cause data to be sampled at a rate that makes your report less accurate). Advanced segments work by asking GA to calculate data “on the fly”, i.e. at the time you request it. So if your site has a lot of traffic and/or you are looking at a longer date range, when you apply an advanced segment the data may be sampled. If it is sampled, you’ll see a yellow bar at the top of the report stating that the report is based on 52% of data or some other amount, instead of all your data. GA samples data in order to display the report more quickly. See our recent blog post about sampling in GA and ways to deal with it.