A/B Testing and Web Performance
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.
Join the DZone community and get the full member experience.Join For Free
a/b testing (or split testing) is a method of comparing two or more versions of a web page 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.
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.
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 from 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 tools or client-side tools.
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.
synchronous code allows the js to load sequentially one after the other starting from the
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.
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.
Published at DZone with permission of Kameerath Abdul Kareem, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.