Cardinal Path’s response to COVID-19 Cardinal Path is sharing all we know to help marketers during COVID-19.  Learn more.

The developers of Google Website Optimizer have tried their hardest to make their product work in tandem with Google Analytics. Here at VKI, we have found that for the most part, they work great together. However, there are a few situations where GWO can interfere with GA or vice versa. Here is one such situation.

The Problem

There is a well-known problem when implementing an A-B test in Website Optimizer on a page that has Google Analytics installed. If you follow the instructions for installing the control script, and place it right at the top of the original page, you will lose referral information about how visitors got to the landing page. A detailed explanation of the problem and the solution can be found on Ophir Prusak’s blog.

This solution fixes all the referral information except for when visitors come in by a campaign from a search engine (for example AdWords). In this case, one little piece of information is lost: the search terms a visitor typed in to the search engine when they saw your campaign.

Here’s how it works:

  1. A visitor performs a search on the search engine
  2. A visitor clicks on your campaign-tagged link.
  3. They are taken to the original landing page
  4. The referral information is tracked as coming from the ad campaign. Also, the campaign terms value is set because the referring URL is the search engine, and it includes the search terms in the URL.
  5. The visitor is redirected by GWO to another version of the page, passing along the campaign parameters in the URL
  6. GA sees the campaign parameters and rewrites the campaign information. Because the browser now reports the referral as the original landing page, the search terms are not in the referral URL and the campaign terms information is lost!

Why would we care if the search terms are missing? Well, if you are using this well known filter, which appends the actual search terms to the broad match terms, then you may be missing some key information that makes the filter work.

The Solution

Here’s an easy and simple fix. Add the following code to all your variation pages (not the original) right before the call to _trackPageview().

 

The code checks to see if the previous page the visitor viewed has any campaign variables set in the query string (gclid, utm_campaign, utm_source etc). If campaign information exists, the code then compares the referring URL to the current URL. If they are the same, then we prevent GA from overwriting our campaign information.

So the full Google Analytics Tracking Code (GATC) will look like this

 

Voila, no lost information!

What’s _setCampaignTrack?

For those of you wondering what _setCampaignTrack function is and what the heck it does, here’s a brief overview. The function _setCampaignTrack enables or disables campaign tracking and stops the campaign cookie (__utmz) from being written or overwritten. All other information is recorded as usual. Normally, you wouldn’t want to disable this functionality. But sometimes – like in our case – we want to disable campaign tracking. The key thing for us is stopping GA from overwriting the campaign cookie that was set on the original landing page.

Sharing is caring!

Popular

COVID-19 Crisis Navigator​

In partnership with Dentsu, Cardinal Path helps you distill the overwhelming news and information into a bi-weekly report highlighting emerging trends and insights during the pandemic.

EXPLORE THE REPORT

Analytics Rising Logo

FREE VIRTUAL EVENT

October 14

Practical Strategies Delivered By Top Minds in Digital Marketing

Register for #AnalyticsRising and get a Starbucks Gift Card when you share the news.

Message Sent

Thank you.

Click here to download access the tool.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Success!
Your message was received.

Thank you.

Message Sent

Thank you for registering.

Thank you for submitting the form.

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Message Sent

Thank you for registering.

Thank you for your submission.

Message Sent

Thank you for registering.

Thank you for registering.​

Paid media spend by Government websites increased a whopping 139% YoY in 2020.

2020 Online Behavior Live Dashboard

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

2020 Online Behavior Live Dashboard

Message Sent

Thank you for registering.

Thank you for submitting the form.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for your submission.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Thank you for registering.

Cardinal Path is continuing with its series of free training. Next we are conducting training on Google Data Studio. Check it out here.
Cardinal Path hosted a live session to connect with you and answer all your questions on Google Analytics.
Get all the expertise and none of the consultancy fees in this not-to-be-missed, rapid-fire virtual event.

Message Sent

Success! Thank you
for reaching out.