Question

My boss for some reason wants to try to implement A/B Testing (or Split Testing) in JavaScript. Anyone know of any good JavaScript packages/libraries/solutions to implement A/B Testing?

Was it helpful?

Solution

Here's this: http://ejohn.org/blog/genetic-ab-testing-with-javascript/

Are you trying to test the marketability of your site or the performance of your code or what?

Assuming marketability, you could simply have some JS that appends a class name to your body tag (+ whatever else) based on a random number. Then record the random choice and outcome (when the visitor clicks something, also record which random layout they were presented with) via whatever analytics engine you use. You could also consider using cookies to ensure returning visitors get the same treatment.

I don't know of a code quality a/b framework for JS but the idea would be similar. Define what constitutes higher quality (lower milliseconds of execution time?), run the variations of the code and see which comes out ahead. Tools like JMeter and JSUnit might be helpful for these purposes.

OTHER TIPS

I have found this simple, open-source JS tool quite useful: https://github.com/jamesyu/cohorts

It doesn't have all the features you might want, but it's free, flexible, pretty well and tidily written, and you can always hack on it to support additional requirements.

Supports Google Analytics (via event tracking) and other back-ends.

Maxymiser is really slick and functions almost entirely in JavaScript (from the programmer's perspective). It is expensive though. This is the one we ended up going with.

You can try this: ABalytics.js - A JavaScript Library For Client-Side A/B Testing With Google Analytics

It's a neat little package, which allows you to perform A/B Testing purely on the client-side using JavaScript, while storing results in Google Analytics.

There's also Google Site Optimizer.

This question is four years old and still coming in searches, so here's a new (May 2013) Javascript A/B testing library:

https://github.com/maccman/abba

Comes with a little Sinatra server app to collect the data and show results.

With a couple of line of JS you can also implement an A/B test. You only have to store the group membership in a persistent cookie and do the decisions based on that. For A/B testing the measurement is the most important part. This can be done very easily with Google Analytics like on the following blog: simple ab test in Google Analytics

If you are using a server side language I recommend doing the split testing on the server as this will allow you to save the results. in javascript you will have to use jsonp or other ugly smelly things to save the results of your split tests.

I wrote a small article on this for asp.net mvc. It may inspire you to implement something similar in whatever backend language u use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top