Blog Post

A/B Testing and Web Performance

Companies use A/B testing to test major interface changes by only rolling out the new version to a segment of their visitors and measuring the reaction.

A/B testing (or split testing) is a method of comparing two or more versions of a webpage or app against each other to determine which one has better response or conversion rate.

A/B tests allow you to test one version of images, colors, headings, forms etc… against one another. Layout choices such as where you place the elements, or functionality choices like when and how you display messages can also be tested.

It can also be used to improve drastic changes like redesigning a page by only serving it to a portion of your visitors. Companies use this strategy to test major interface changes by only rolling out the new version to a segment of their visitors and measuring how that group reacts.

Performance Impact

While A/B testing helps in achieving better conversion rates and making good decisions in site redesign, on the other hand, it may also impact the web performance.

Most A/B testing software creates an additional step in loading and rendering a web page. Many of these use a technology based on JavaScript that is executed on the visitor’s browser. The client-side JavaScript creates a variation of your test page by doing manipulations on your browser. The script modifies the source code as the page is loaded and all the variations are rendered by the browser; the page variation cannot be implemented until the elements that need to be modified are first loaded. During this process you may notice elements on the page changing as loading progresses.

Another issue resulting from A/B testing is flickering. This happens when the website visitor sees the original page content for a fraction of time before the page variation loads or before the testing script changes the targeted elements causing a delay. The presence of such scripts can block certain sections of the page from rendering and slow it down even more.

The image below shows data collected from an experiment that tested the page performance with and without the A/B testing tag. We can clearly see form the result that the page without the testing JS is faster.

When we drill down further to the request level, we can see the full impact of the testing tag. The JS request itself contributes an average of almost 600 ms to the overall response time of the page.

Breaking down the different components of the network that makes up the response time of the JS tag gives us the following details.

The page load time is directly impacted by the size of the variation code used on the page. The JS content would require some additional time to parse, execute and make changes to the original content thus adding to the delay in rendering the page variations on the visitor’s browser.

Type of Testing Tools

A/B testing can be performed by choosing either server-side or client-side tools.

1. Server-side:

Server-side tools do not perform any changes in the browser, instead, a randomly picked version of the test page is served. It requires the developers to get involved in the testing process for creating different versions of the page. Server-side testing requires more investment and work. However, the server-side tools offer greater flexibility and control. They protect your end user privacy and security better.

2. Client-side:

This is the most common type of testing tool. As we have seen earlier, client-side tools use JavaScript to perform the manipulation/changes at the visitor’s browser. Client-side tools are easier to use; you can get the tests set up and running faster without burning many resources.

Client side JavaScript can be made to load either synchronously or asynchronously.

(Image source: KeyCDN)

Synchronous: Synchronous code allows the JS to load sequentially one after the other starting from the <head> tag. Loading synchronously reduces the risk of flickering but it adds an overhead to the page load time as the page doesn’t render anything else while the JavaScript is loading. The users must wait until the JavaScript is loaded and parsed before the rest of the page renders.

Asynchronous: Asynchronous loading allows multiple scripts to load simultaneously reducing the page load time. This technique is usually preferred as page load time is an important factor. However, asynchronous loading doesn’t guarantee that the variation script will load before the targeted elements loads. This could cause flickering but it is possible to implement certain tweaks to minimize it.

3. Proxy server method:

Another type of tool acts as a proxy server between the visitor’s browser and your server and it controls the site content that is presented to the visitor. It eliminates most of the problems that occur with client-side tools, while retaining the robustness of server-side tools.

The following best practices can help you reap the benefits of A/B testing while also mitigating the risks it presents to web performance:

  • Serve the testing tag from CDN/multi-CDN to ensure it is delivered as fast as possible.
  • Make sure that everything loads fast by moving the site to a fast web host or by employing performance-tuning techniques such as compression and/or image optimization.
  • Limit the changes to a few HTML elements. Adding variations to numerous elements will make flickering more likely.
  • Ensure any asynchronous code in the page is configured to hide the original page until the testing script is fully loaded and executed.
  • The script can be implemented with a timeout value. This is useful in cases where the users have a slow internet connection. If the script doesn’t get loaded within the timeout threshold, the users are provided the original content instead of performing slow changes.
  • It is not wise to integrate the A/B testing tool script within the tag manager as this might cause delays in loading the tags.
  • Make sure that the order of execution of the various JS matches the order of elements on the original page. If the starting line of your script tries to make changes to the HTML element at the bottom, it will not happen until all the page is loaded and cause a delay.
  • Structure the variation code in such a way the changes are implemented from top to bottom.
This is some text inside of a div block.

You might also like

Blog post

Windows 11: Run a better traceroute

Blog post

The power of synthetic data to drive accurate AI and data models

Blog post

Traceroute InSession: A traceroute tool for modern networks