Skip to content
andrew edited this page Jun 30, 2011 · 16 revisions

This tutorial covers getting started with split on a Rails 3.0 app.

Installation

First lets create our rails app:

$ gem install rails
$ rails new split-example
$ cd split-example

We'll also need redis (2.0 or greater) installed on for split to store its data.

If you are on a mac, you can install redis using homebrew:

$ brew install redis

And then follow the instructions.

If you are on ubuntu or debian you can install redis using apt-get:

$ sudo apt-get install redis-server

Otherwise you can compile it from source using he instructions on the redis.io website: http://redis.io/download

Note: redis is not officially supported on windows

Then we need to add split as a dependency, so we add the following to our Gemfile:

gem 'split'

If you are using Ruby 1.8.x then you will likely want to also use the SystemTimer gem if you want to make sure the Redis client will not hang.

Put the following in your gemfile as well:

gem 'SystemTimer'

Then update your bundle with:

$ bundle install

Config

Split is designed to work out of the box and requires zero configuration but there are a number of configuration options that can be overridden if you need something off the beaten track.

Robot detection

Split ignores visitors that appear to be robots or spiders to avoid skewing any results, by default compares the useragent of the visit with this regular expression:

/\b(Baidu|Gigabot|Googlebot|libwww-perl|lwp-trivial|msnbot|SiteUptime|Slurp|WordPress|ZIBB|ZyBorg)\b/i

You can override this by putting the following code in config/initializers/split.rb:

Split.configure do |config|
  config.robot_regex = /my_custom_robot_regex/
end

Ignore visits from certain ip addresses

Split also has the ability to ignore visits from a range of ip addresses, you may wish to ignore yourself or people from your office from skewing the results so you can add the following code to config/initializers/split.rb:

Split.configure do |config|
  config.ignore_ip_addresses << '81.19.48.130'
end

Note: config.ignore_ip_addresses expects an array of ip addresses

Redis configuration

Split.redis

Defining an A/B test

  • ab_test
  • finished

Viewing the results

  • added the dashboard
  • what the results mean
  • futher reading

Clone this wiki locally