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.
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:
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.
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!
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.
A fundamental question underpinning even the most basic reports in Google Analytics 4 (GA4) is…
Google Analytics 4 (GA4) has introduced several customizable reports through its Exploration feature, one of…
Businesses of all sizes are constantly having to navigate through mountains of data to make…
This website uses cookies.