ABalytics.js: pure js + Google Analytics A/B testing

ABalytics.js library allows you to do simple A/B testing working only on your client-side code. All data is registered as custom variables in your website Google Analytics profile, so you don’t need to configure anything server side.
GA screenshot

Features

  • Easy to set up
    • You just list the possible variants, the randomization is handled automatically
    • You just mark the html elements you want to test on with a class, the substitution is automatic
    • No need to set anything up server side, the data is stored on Google Analytics
  • Consistent user experience: The selected variant is stored in a cookie, so the user will see the same one when coming back
  • No external dependencies: Pure javascript, you just need to include GA
  • Flexible: You can conduct multiple, independent experiments at the same time. Each experiment will use a custom variable slot

Usage

1. Include abalytics.js

2. Define your tests and configure GA

3. Apply the experiment classes to your html content

4. Call applyHtml() on load

NB: If you’re using jQuery in your website, it’s even better to call applyHtml in the $(document).ready(…) handler

5. Run your experiment

Publish your code, wait for some visitors to come…

6. Analyze your data

ABalytics works best if you defined some goals on Google Analytics.

In GA, go to Audience->Custom->Custom Variables. You will find your experiements names in the available slots.

Click on the experiment name you want to analyze to see how many visits where recorded for each variant. Then click on “Goal set 1” to see the goal conversion rate for each variant. Simple and easy!

Advanced options

If you are already using some custom variables, you can have ABalytics start from a slot > 1 using

Goto : https://github.com/danmaz74/ABalytics

Leave a Reply