Documentation

All the information you need in one place

Nelio A/B Testing parameter is messing my Google Analytics reports. How do I fix it?

First of all, note that there are no integrations between Nelio A/B Testing and Google Analytics and there are some differences in data collected from Nelio A/B Testing and Google Analytics.

Nelio A/B testing adds a tracking script 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 includes a special parameter added by our script. This parameter, named nab, tells Nelio A/B Testing which alternative has to be loaded for each visitor.

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 one variant from the other by looking at the nab query arg.

Is it possible to ignore the nab parameter in Google Analytics?

Yes, it is. If you go to your Google Analytics admin page, you’ll see an option called View Settings (third column, first item):

Google Analytics settings to exclude a parameter.
Google Analytics settings to exclude a parameter.

If you click there, you’ll see a setting called “Exclude URL Query Parameters”. Simply add the param named nab there and it should no longer mess your analytics.

Don’t forget that Google Analytics does not reprocess data. In other words, you won’t be able to remove parameters from previous data—only data received from that moment on will ignore nab (as well as any other param you add, for that matter).