Wednesday, February 29, 2012

Rails A/B testing with Split on Heroku

I recently decided to start doing some A/B testing on The last time I tried A/B testing I used Google website optimizer, it worked fairly well but I did not like how difficult it was to setup a test. This time I looked around for A/B testing tools for rails. I ended up finding split and so far I have been very happy with the results. The documentation is fairly good but it did take a little fiddling to get it working on Heroku.

First off add the Redis to Go add-on in Heroku, the Nano plan is free and has been sufficient for my needs so far. Install redis on the dev server. I use a mac so that was as simple as "brew install redis" and then I followed the brew instructions for getting redis to start on login.

To install the split gem add the following to the Gemfile

 gem 'split', '0.3.3', :require => 'split/dashboard'

To set the development environment up in a way that is compatible to how Redis to Go is configured on Heroku add the following to config/environments/development.rb

ENV['REDISTOGO_URL'] = 'redis://localhost:6379'
Then create an initializer for redis in config/initializers/redis.rb and put the following in that file.
uri = URI.parse(ENV['REDISTOGO_URL'])
REDIS = =>, :port => uri.port, :password => uri.password, :username => uri.user)
To configure split to use the applications redis configuration create config/initializers/split.rb and add the following.
Split.redis = REDIS

To setup the split dashboard add the following to config/routes.rb

mount Split::Dashboard, :at => 'split'
To add authentication to the dashboard add the following to config/initializers/split.rb
Split::Dashboard.use Rack::Auth::Basic do |username, password|
  username == 'username' && password == 'password'

Setting up an A/B test is super easy just follow the instructions in the split README.


Note: These instructions are for rails 3.x, the listed resources do have instructions for earlier versions of rails.


Joel Kemp said...

Thanks for this! Very clean and concise.

Unknown said...

Thanks, always nice to hear when someone thinks one of my posts was useful.

Unknown said...

Nathan, thanks for your helpful post. One quick question, I hope you know the answer to: I noticed the css styling of the Split dashboard page is gone on Heroku. Have you encountered the same problem and if so, have you solved it?

Thanks, Pascal

Pierre Olivier Martel said...

Pascal, I think it has to do with the way Heroku compiles the assets on the Cedar stack. I tried to find a fix but finally resolved to copying the Split assets to the Public folder. Far from ideal but it works...

Phil Whelan said...

Hi Nathan,

Great post! I'm working on building a similar service, so woud be great to get your feedback and pick your brains. More info here


Aadita kumar said...

Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..

Android Training in Chennai

Jeffy said...

Thank you for sharing such a nice and interesting blog with us. Hope it might be much useful for us. keep on updating...!!
seo company in india
digital marketing company in india
seo company in chennai
digital marketing company in chennai

Ven hudson said...

Thanks for sharing the article. I would like to recommend that users should also try A/B testing Tool by MockingFish. It' a good tool and really helpful for all those who are searching for a good tools for there website.

for ict 99 said...

I have read your blog its very attractive and impressive. I like it your blog.

Digital Marketing Company in Chennai Digital Marketing Agency

SEO Company in India SEO Services in India

Digital Marketing Company in Chennai

smarther3 said...

This blog explains the details about changing the ways of doing that business. That is understand well and doing some different process. Provides he best output of others. Thanks for this blog.

Mobile App Development Company in India

reginald surict said...

Hey, I encourage you to read the following post to know how to catch a cheater.

ASO Services said...

Thanks a lot for sharing this with all of us, I like it and we can communicate. Do you need buy app ratings and reviews. To boost app ranking and double app downloads now.

Lauren Gottlieb said...

Thank you for such a well written article. It’s full of insightful information and entertaining descriptions. Your point of view is the best among many. seo services kc

hotmail said... email login inbox. For detail instructions– How to Create New Hotmail Account. Go to the official website of

Tanika Co Valda said...

Great Article
Final Year Project Domains for CSE
Project Centers in Chennai

JavaScript Training in Chennai
JavaScript Training in Chennai

SEO KILLER said...

“I really loved reading your blog. It was very well authored and easy to understand” China SEO Company

NOOR said...

Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. Webmetrix Group Search Engine Optimization

SEO KILLER said...

SEO Internet marketing can help any company through their site to sell products SirLinksalot Search engine optimization is not easy, but with the right SEO tools, your website promotion task just got a lot easier

fortnite said...

This higher conversion rate is simply one more of the advantages of SEO services that can't be matched by any other form of marketing. review You can use keywords in your description that can also be used as tags.

Navin Prakash said...

Such a nice article thanks for sharing this with us. Really so impressible and interesting post. You’re doing a great job Man, Keep it up.
Excel Training in Chennai
Excel Course in Chennai
Tableau Training in Chennai
Linux Training in Chennai
Oracle Training in Chennai
Advanced Excel Training in Chennai
Graphic Design Courses in Chennai
Oracle DBA Training in Chennai
Pega Training in Chennai
corporate training in chennai
Power BI Training in Chennai
Excel Training in Anna Nagar

akshaya said...

This jot down is more responsible and resourceful.I could see the great effort taken by you to make the write-up more sensible. Web Designing Course Training in Chennai | Web Designing Course Training in annanagar | Web Designing Course Training in omr | Web Designing Course Training in porur | Web Designing Course Training in tambaram | Web Designing Course Training in velachery

Pankaj Singh said...

Thanks for this amazing blog, visit Ogen Infosystem for creative web design and development services at an affordable price.
Best Website Designing Company in Delhi