Free Consultation

How to do A/B Testing in Ruby on Rails using Split gem | Inkoop Blog

A/B testing (or split testing) is a test which tells how to onboard users in the best efficient way. We talk about how to perform A/B testing in Ruby on Rails using Split gem.

Posted by Ameena on 15 Oct 2018

A/B testing (or split testing) is a test which tells how to onboard users in the best efficient way.
It is mainly about determining which version of the web page gets more attention from the users who are using the application. Version here means having a different image, or different colour of heading or text, or having different layout etc.

A/B testing terminologies

Experiment

An A/B experiment is a set of rules for matching visitors to content and recording their conversions.

Variation

Every experiment contains a set of variations that each change the visitor's experience in a different way. Variations define the code that should be applied on a page to change the experience.

Installation of Split gem

Add the gem split in the Gemfile and bundle it.

# Gemfile

gem 'split'

Methods in the Split gem

There are mainly two methods to use in the split gem -

1. ab_test()

It is used to create an experiment and generate different variations for your experiment. It takes name of the experiment as first argument and next options are the variations that you want for the experiment.

You should call this method where you want the user to see your variations of the experiment.

<a href="/url"><%= ab_test "view", "Look", "View", "Please View" %></a>

2. ab_finished()

It is used to mark your experiment a successful conversion. It takes name of the experiment as first argument.

You should call this method where you want to decide the conversion success rate of the experiment.

ab_finished("view")

Sample experiment

I am performing A/B test experiment to check how many users click the button to see the hotel detail page. Variations of the experiment is the text of the button - Look, View, Please View.

Variation 1

The text of the button for this variation is Look

Image1
Image1

Variation 2

The text of the button for this variation is View

Image2
Image2

Variation 3

The text of the button for this variation is Please View

Image3
Image3


Result of the experiment

You can find the conversion success of each variation of the experiment in the split dashboard. You can type in the url of your application and add /split in the end.

Split Dashboard

The result of my experiment is that users have liked the second variation, which is the button with text 'View' (Variation 2) has maximum clicks.

Image4
Image4

Contact us to setup your A/B testing suite.

Keep Coding !!!

Ameena


We support the Open Source community.



VueJS Logo
Bulma Logo

Have a Project in mind?