Back to topic list

A/B testing

A/B testing is such important practice that enduro support it out of the box and setting it up could not be any easier.

Creating A/B variants

Let’s say we have a page in the root folder named contact.hbs. To create an A/B test variant just duplicate this file and add @tag at the end of it’s name. Another file’s name could for example be contact@bigbutton.hbs.

Serving files

The two files: contact.hbs and contact@bigbutton.hbs will be served with a 50% chance. You can create as many variants as you want and they will always be served in equal ratio.

Analyzing results

You’ll have to use third-party tools to analyze which variant is more successful.

Analyzing results with Google analytics

You can pass page visit as an event and pass a goal event as another event. See this example:

ga('send', 'event', 'contacttest', 'visit', 'smallbutton')

$('button.learn-more').click(function () {
    ga('send', 'event', 'contacttest', 'goal', 'smallbutton')

This code will register event under name contacttest and uses eventValue attribute to differentiate between A/B variants.

For user interface consistency, users that received variant A will also receive variant A on any subsequent reloads. This is guaranteed by a cookie.

Back to topic list

Shout out to pexels and freepik