Nelio A/B Testing and Google Analytics have different tracking methods, which means you may find differences in the number of visitors tracked from these tools. The following are some of the most commonly reported issues and their reasons:
How to differentiate variants in Google Analytics
Nelio A/B Testing adds a tracking JavaScript at the very beginning of your website’s HTML structure. We do this so that it (hopefully) runs before any other scripts, including Google Analytics. When our tracking script runs, the first thing it does is check if the current page is under test. If it is, it performs a JavaScript redirection to a different URL that will include some testing parameters. Thus, for example, a page like https://example.com/tested-page/
will become https://example.com/tested-page/?nab=x
(where x is the variant the user is supposed to see; 0 is the control version, 1 is version B, and so on).
Since Nelio A/B Testing performs the JavaScript redirection before any other script runs, this “first visit” won’t be tracked in your Google Analytics. However, once the user lands in https://example.com/tested-page/?nab=x
, this one will, and that’s the URL Google Analytics will track. Therefore, you’ll be able to tell apart from one variant from the other by looking at the nab
query arg.
However, note that it is possible to ignore the nab
parameter in Google Analytics.
“Pageviews” data in Google Analytics and “(Tested) Page Views” in Nelio A/B Testing give different results
Pageviews data in Google Analytics is the total number of visits on the website. Google Analytics tracks all visits to a page (both first-time visitors as well as returning users).
(Tested) page views in Nelio A/B Testing also implement this approach: they count both first-time and returning visitors. However, not all visitors accessing a certain page are counted by Nelio A/B Testing. Only those visitors that participate in the test will be included in the results. Visitors may be excluded from an experiment if you limited the percentage of users that may participate in your tests.
Google Analytics kicks in before Nelio does
In principle, the previously mentioned JavaScript redirection is executed before Google Analytics kicks in. But under some circumstances, Google Analytics’ code may begin to execute on the original page itself before the redirection to the variant. This could trigger an additional page view on the original page.
This unwanted behavior occurs when using plugins that combine or merge scripts without taking into account the original execution order. The same may occur when using plugins that add the async attribute to JavaScript tags breaking the logical order of execution of scripts.
Nelio A/B Testing should work properly in most scenarios. If you find problems like the ones explained here, do not hesitate to contact us. We’ll provide assistance to fix any issue you may encounter here.