How Do I Prevent My Analytics Tool Recording a Hit on Original When a Split URL Variation is shown

Whenever you are running a split URL experiment, all your traffic will go to the original URL and from there, Convert script will eventually redirect to a variation URL (if variation is to be presented to that specific visitor).

Sometimes you might notice that in your analytics software, original URL is still showing as receiving all the traffic (even though the variation URLs are showing as receiving the right portion of the traffic. So, all in one, it's giving the false impression of an increase in pageviews where each variation has the right percentage but original has the sum of all plus its own percentage (exactly or close to that).


To fix this please follow the following steps:

Solve Analytics Problems

1) make sure convert experiments tracking code is placed on page BEFORE your analytics software tracking code; this will probably solve the issue in most of the situations.

2) to make sure no traffic is recorded on original URL whenever the variation is presented, wrap your analytics software tracking code like presented below:

if(!convert || !convert.isRedirect) {
         // your analytics tracking code here

Example of wrapping the google analytics tracking code: 

<script type="text/javascript">
if(!convert || !convert.isRedirect) {
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX']);
(function() {var ga=document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + ''; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})(); 
Have more questions? Submit a request