Documentation

All the information you need in one place

How to remove Nelio scripts from pages that are NOT under test

In order to run the tests, Nelio A/B Testing adds a tracking script at the beginning of the HTML structure of your website. When executed, it checks if the current page is under test and, if so, performs a JavaScript redirect to a URL with parameters that will indicate which variant to show to the visitor.

However, you can modify the plugin settings to remove Nelio scripts from pages thar are not under test as follows:

  1. Make sure that in the plugin behavior settings you have disabled Add testing query args nab to all URLs to speed up page loading times when browsing your site.
Nelio A/B Testing plugin behavior settings
Nelio A/B Testing plugin behavior settings.

As you may already know, alternative content is loaded by appending a special query arg (nab) in tested URLs that tell WordPress which variant should be loaded. When a visitor is on a page in your website (be it under test or not), our plugin will look at all the internal links it contains and, if a link points to a tested page, it will add the appropriate nab query arg to said link. This way, if the visitor clicks on the link to browse to a tested page, the browser will request the correct variant easily.

  1. Limit Goal Tracking to Tested Pages

By default, Nelio’s A/B tests track conversion actions across your entire website. For example, if you had a test on your pricing page and you wanted to track clicks to a call-to-action button with a .nelio-cta class. By default, a click to that tracking element (i.e., an element with class .nelio-cta) from any page on your website will be a conversion.

However, you can limit track conversion events only on certain pages. In the Goal Tracking settings, select Tested Pages or Custom Pages to have Nelio A/B Test track conversion actions only on tested pages only or the pages you specify when creating a test, respectively.

This way, by disabling A/B Query args and limiting goal tracking, Nelio scripts will only be included in pages being tested.