Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Kurufootwear A/B test implementation w/ M2 and Google Optimize

Find the descruption of Kurufootwear A/B test implementation w/ M2 and Google Optimize: https://gist.github.com/kshaa
/2764f6921c7a4ad356166621ee6c35e1

Kurufootwear AB test implementation

Requirements

Ability to test two different variations of pages


Tests need to have not only CSS, JS changes (native Google Optimize experience), but also structural, large changes
Should be incorporated with Google Optimize, which client already uses.
Has to work properly on multi-instance infrasctructure
A/B traffic splitting must be jitter-free (no obvious glitchiness)

Implementation brainstorm

We knew Enterprise edition had an integration with some Google service to create an AB test experience and we reimplementing, copying that.
However, we didn't have access to enterprise and it might've taken a lot of time to understand it's code and to integrate it.

We considered making a barebones framework for splitting traffic server side. While that would provide us with immediately loaded & ready A/B
test pages, that might have issues with the multi-instance server set up and would also take a lot of time and thinking.

After a lot of brainstorming with their dedicated developer Jim, we came up with a very simple idea of how to reuse the traffic splitting functionality
of Google Optimize and to have only a barebones modification for layout loading on server side.

Implementation

Setting up server side

Before M2 generates the page layout, we check the request URL for an AB test query parameter and depending on it load additional layouts.
This reuses core M2 layout extension/overriding and is very easy to implement. (Literally one observer)

For example on such a request URL:

http://www.example.com/customer/account/login?v=x,y

These are the layouts that will be loaded:

customer_account_login_ab_x.xml
customer_account_login_ab_y.xml

Setting up client side redirects

For actually splitting the traffic to "Control" URL and "B test" URL, we use Google Optimize.

Target testable URL's with wildcarded URL's or direct URL's.


For "Control" flow, do nothing
For "X test" flow, create a javascript redirect to same URL w/ query ?v=x

You might also like