split 3.0.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.eslintrc +1 -1
- data/.github/ISSUE_TEMPLATE/bug_report.md +24 -0
- data/.rspec +1 -0
- data/.rubocop.yml +6 -1155
- data/.rubocop_todo.yml +679 -0
- data/.travis.yml +46 -2
- data/Appraisals +12 -1
- data/CHANGELOG.md +116 -0
- data/CODE_OF_CONDUCT.md +3 -3
- data/CONTRIBUTING.md +54 -5
- data/Gemfile +1 -0
- data/LICENSE +1 -1
- data/README.md +209 -118
- data/Rakefile +1 -0
- data/gemfiles/4.2.gemfile +1 -1
- data/gemfiles/5.0.gemfile +1 -2
- data/gemfiles/5.1.gemfile +9 -0
- data/gemfiles/5.2.gemfile +9 -0
- data/gemfiles/6.0.gemfile +9 -0
- data/lib/split/algorithms/block_randomization.rb +1 -0
- data/lib/split/alternative.rb +6 -3
- data/lib/split/combined_experiments_helper.rb +37 -0
- data/lib/split/configuration.rb +17 -2
- data/lib/split/dashboard/helpers.rb +2 -2
- data/lib/split/dashboard/pagination_helpers.rb +86 -0
- data/lib/split/dashboard/paginator.rb +16 -0
- data/lib/split/dashboard/public/style.css +9 -0
- data/lib/split/dashboard/views/index.erb +5 -1
- data/lib/split/dashboard/views/layout.erb +1 -1
- data/lib/split/dashboard.rb +6 -1
- data/lib/split/engine.rb +6 -2
- data/lib/split/experiment.rb +34 -22
- data/lib/split/goals_collection.rb +1 -0
- data/lib/split/helper.rb +17 -3
- data/lib/split/persistence/cookie_adapter.rb +53 -15
- data/lib/split/persistence/dual_adapter.rb +54 -12
- data/lib/split/redis_interface.rb +2 -3
- data/lib/split/trial.rb +4 -6
- data/lib/split/user.rb +5 -1
- data/lib/split/version.rb +1 -1
- data/lib/split.rb +9 -1
- data/spec/alternative_spec.rb +12 -0
- data/spec/combined_experiments_helper_spec.rb +57 -0
- data/spec/dashboard/pagination_helpers_spec.rb +200 -0
- data/spec/dashboard/paginator_spec.rb +37 -0
- data/spec/dashboard_helpers_spec.rb +2 -2
- data/spec/dashboard_spec.rb +37 -16
- data/spec/encapsulated_helper_spec.rb +1 -1
- data/spec/experiment_spec.rb +45 -6
- data/spec/helper_spec.rb +143 -80
- data/spec/persistence/cookie_adapter_spec.rb +90 -23
- data/spec/persistence/dual_adapter_spec.rb +160 -68
- data/spec/split_spec.rb +7 -7
- data/spec/trial_spec.rb +20 -0
- data/spec/user_spec.rb +11 -0
- data/split.gemspec +17 -7
- metadata +53 -19
data/README.md
CHANGED
|
@@ -1,97 +1,29 @@
|
|
|
1
|
-
# [Split](
|
|
2
|
-
|
|
3
|
-
Split is a rack based ab testing framework designed to work with Rails, Sinatra or any other rack based app.
|
|
4
|
-
|
|
5
|
-
Split is heavily inspired by the Abingo and Vanity rails ab testing plugins and Resque in its use of Redis.
|
|
6
|
-
|
|
7
|
-
Split is designed to be hacker friendly, allowing for maximum customisation and extensibility.
|
|
1
|
+
# [Split](https://libraries.io/rubygems/split)
|
|
8
2
|
|
|
9
3
|
[](http://badge.fury.io/rb/split)
|
|
10
|
-
[](
|
|
4
|
+
[](https://travis-ci.org/splitrb/split)
|
|
11
5
|
[](https://codeclimate.com/github/splitrb/split)
|
|
12
6
|
[](https://codeclimate.com/github/splitrb/split/coverage)
|
|
7
|
+
[](https://github.com/RichardLitt/standard-readme)
|
|
8
|
+
[](https://www.codetriage.com/splitrb/split)
|
|
13
9
|
|
|
10
|
+
> 📈 The Rack Based A/B testing framework https://libraries.io/rubygems/split
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
Split is a rack based A/B testing framework designed to work with Rails, Sinatra or any other rack based app.
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<a href="https://opencollective.com/split/backer/0/website" target="_blank"><img src="https://opencollective.com/split/backer/0/avatar.svg"></a>
|
|
20
|
-
<a href="https://opencollective.com/split/backer/1/website" target="_blank"><img src="https://opencollective.com/split/backer/1/avatar.svg"></a>
|
|
21
|
-
<a href="https://opencollective.com/split/backer/2/website" target="_blank"><img src="https://opencollective.com/split/backer/2/avatar.svg"></a>
|
|
22
|
-
<a href="https://opencollective.com/split/backer/3/website" target="_blank"><img src="https://opencollective.com/split/backer/3/avatar.svg"></a>
|
|
23
|
-
<a href="https://opencollective.com/split/backer/4/website" target="_blank"><img src="https://opencollective.com/split/backer/4/avatar.svg"></a>
|
|
24
|
-
<a href="https://opencollective.com/split/backer/5/website" target="_blank"><img src="https://opencollective.com/split/backer/5/avatar.svg"></a>
|
|
25
|
-
<a href="https://opencollective.com/split/backer/6/website" target="_blank"><img src="https://opencollective.com/split/backer/6/avatar.svg"></a>
|
|
26
|
-
<a href="https://opencollective.com/split/backer/7/website" target="_blank"><img src="https://opencollective.com/split/backer/7/avatar.svg"></a>
|
|
27
|
-
<a href="https://opencollective.com/split/backer/8/website" target="_blank"><img src="https://opencollective.com/split/backer/8/avatar.svg"></a>
|
|
28
|
-
<a href="https://opencollective.com/split/backer/9/website" target="_blank"><img src="https://opencollective.com/split/backer/9/avatar.svg"></a>
|
|
29
|
-
<a href="https://opencollective.com/split/backer/10/website" target="_blank"><img src="https://opencollective.com/split/backer/10/avatar.svg"></a>
|
|
30
|
-
<a href="https://opencollective.com/split/backer/11/website" target="_blank"><img src="https://opencollective.com/split/backer/11/avatar.svg"></a>
|
|
31
|
-
<a href="https://opencollective.com/split/backer/12/website" target="_blank"><img src="https://opencollective.com/split/backer/12/avatar.svg"></a>
|
|
32
|
-
<a href="https://opencollective.com/split/backer/13/website" target="_blank"><img src="https://opencollective.com/split/backer/13/avatar.svg"></a>
|
|
33
|
-
<a href="https://opencollective.com/split/backer/14/website" target="_blank"><img src="https://opencollective.com/split/backer/14/avatar.svg"></a>
|
|
34
|
-
<a href="https://opencollective.com/split/backer/15/website" target="_blank"><img src="https://opencollective.com/split/backer/15/avatar.svg"></a>
|
|
35
|
-
<a href="https://opencollective.com/split/backer/16/website" target="_blank"><img src="https://opencollective.com/split/backer/16/avatar.svg"></a>
|
|
36
|
-
<a href="https://opencollective.com/split/backer/17/website" target="_blank"><img src="https://opencollective.com/split/backer/17/avatar.svg"></a>
|
|
37
|
-
<a href="https://opencollective.com/split/backer/18/website" target="_blank"><img src="https://opencollective.com/split/backer/18/avatar.svg"></a>
|
|
38
|
-
<a href="https://opencollective.com/split/backer/19/website" target="_blank"><img src="https://opencollective.com/split/backer/19/avatar.svg"></a>
|
|
39
|
-
<a href="https://opencollective.com/split/backer/20/website" target="_blank"><img src="https://opencollective.com/split/backer/20/avatar.svg"></a>
|
|
40
|
-
<a href="https://opencollective.com/split/backer/21/website" target="_blank"><img src="https://opencollective.com/split/backer/21/avatar.svg"></a>
|
|
41
|
-
<a href="https://opencollective.com/split/backer/22/website" target="_blank"><img src="https://opencollective.com/split/backer/22/avatar.svg"></a>
|
|
42
|
-
<a href="https://opencollective.com/split/backer/23/website" target="_blank"><img src="https://opencollective.com/split/backer/23/avatar.svg"></a>
|
|
43
|
-
<a href="https://opencollective.com/split/backer/24/website" target="_blank"><img src="https://opencollective.com/split/backer/24/avatar.svg"></a>
|
|
44
|
-
<a href="https://opencollective.com/split/backer/25/website" target="_blank"><img src="https://opencollective.com/split/backer/25/avatar.svg"></a>
|
|
45
|
-
<a href="https://opencollective.com/split/backer/26/website" target="_blank"><img src="https://opencollective.com/split/backer/26/avatar.svg"></a>
|
|
46
|
-
<a href="https://opencollective.com/split/backer/27/website" target="_blank"><img src="https://opencollective.com/split/backer/27/avatar.svg"></a>
|
|
47
|
-
<a href="https://opencollective.com/split/backer/28/website" target="_blank"><img src="https://opencollective.com/split/backer/28/avatar.svg"></a>
|
|
48
|
-
<a href="https://opencollective.com/split/backer/29/website" target="_blank"><img src="https://opencollective.com/split/backer/29/avatar.svg"></a>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
# Sponsors
|
|
52
|
-
|
|
53
|
-
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/split#sponsor)]
|
|
54
|
-
|
|
55
|
-
<a href="https://opencollective.com/split/sponsor/0/website" target="_blank"><img src="https://opencollective.com/split/sponsor/0/avatar.svg"></a>
|
|
56
|
-
<a href="https://opencollective.com/split/sponsor/1/website" target="_blank"><img src="https://opencollective.com/split/sponsor/1/avatar.svg"></a>
|
|
57
|
-
<a href="https://opencollective.com/split/sponsor/2/website" target="_blank"><img src="https://opencollective.com/split/sponsor/2/avatar.svg"></a>
|
|
58
|
-
<a href="https://opencollective.com/split/sponsor/3/website" target="_blank"><img src="https://opencollective.com/split/sponsor/3/avatar.svg"></a>
|
|
59
|
-
<a href="https://opencollective.com/split/sponsor/4/website" target="_blank"><img src="https://opencollective.com/split/sponsor/4/avatar.svg"></a>
|
|
60
|
-
<a href="https://opencollective.com/split/sponsor/5/website" target="_blank"><img src="https://opencollective.com/split/sponsor/5/avatar.svg"></a>
|
|
61
|
-
<a href="https://opencollective.com/split/sponsor/6/website" target="_blank"><img src="https://opencollective.com/split/sponsor/6/avatar.svg"></a>
|
|
62
|
-
<a href="https://opencollective.com/split/sponsor/7/website" target="_blank"><img src="https://opencollective.com/split/sponsor/7/avatar.svg"></a>
|
|
63
|
-
<a href="https://opencollective.com/split/sponsor/8/website" target="_blank"><img src="https://opencollective.com/split/sponsor/8/avatar.svg"></a>
|
|
64
|
-
<a href="https://opencollective.com/split/sponsor/9/website" target="_blank"><img src="https://opencollective.com/split/sponsor/9/avatar.svg"></a>
|
|
65
|
-
<a href="https://opencollective.com/split/sponsor/10/website" target="_blank"><img src="https://opencollective.com/split/sponsor/10/avatar.svg"></a>
|
|
66
|
-
<a href="https://opencollective.com/split/sponsor/11/website" target="_blank"><img src="https://opencollective.com/split/sponsor/11/avatar.svg"></a>
|
|
67
|
-
<a href="https://opencollective.com/split/sponsor/12/website" target="_blank"><img src="https://opencollective.com/split/sponsor/12/avatar.svg"></a>
|
|
68
|
-
<a href="https://opencollective.com/split/sponsor/13/website" target="_blank"><img src="https://opencollective.com/split/sponsor/13/avatar.svg"></a>
|
|
69
|
-
<a href="https://opencollective.com/split/sponsor/14/website" target="_blank"><img src="https://opencollective.com/split/sponsor/14/avatar.svg"></a>
|
|
70
|
-
<a href="https://opencollective.com/split/sponsor/15/website" target="_blank"><img src="https://opencollective.com/split/sponsor/15/avatar.svg"></a>
|
|
71
|
-
<a href="https://opencollective.com/split/sponsor/16/website" target="_blank"><img src="https://opencollective.com/split/sponsor/16/avatar.svg"></a>
|
|
72
|
-
<a href="https://opencollective.com/split/sponsor/17/website" target="_blank"><img src="https://opencollective.com/split/sponsor/17/avatar.svg"></a>
|
|
73
|
-
<a href="https://opencollective.com/split/sponsor/18/website" target="_blank"><img src="https://opencollective.com/split/sponsor/18/avatar.svg"></a>
|
|
74
|
-
<a href="https://opencollective.com/split/sponsor/19/website" target="_blank"><img src="https://opencollective.com/split/sponsor/19/avatar.svg"></a>
|
|
75
|
-
<a href="https://opencollective.com/split/sponsor/20/website" target="_blank"><img src="https://opencollective.com/split/sponsor/20/avatar.svg"></a>
|
|
76
|
-
<a href="https://opencollective.com/split/sponsor/21/website" target="_blank"><img src="https://opencollective.com/split/sponsor/21/avatar.svg"></a>
|
|
77
|
-
<a href="https://opencollective.com/split/sponsor/22/website" target="_blank"><img src="https://opencollective.com/split/sponsor/22/avatar.svg"></a>
|
|
78
|
-
<a href="https://opencollective.com/split/sponsor/23/website" target="_blank"><img src="https://opencollective.com/split/sponsor/23/avatar.svg"></a>
|
|
79
|
-
<a href="https://opencollective.com/split/sponsor/24/website" target="_blank"><img src="https://opencollective.com/split/sponsor/24/avatar.svg"></a>
|
|
80
|
-
<a href="https://opencollective.com/split/sponsor/25/website" target="_blank"><img src="https://opencollective.com/split/sponsor/25/avatar.svg"></a>
|
|
81
|
-
<a href="https://opencollective.com/split/sponsor/26/website" target="_blank"><img src="https://opencollective.com/split/sponsor/26/avatar.svg"></a>
|
|
82
|
-
<a href="https://opencollective.com/split/sponsor/27/website" target="_blank"><img src="https://opencollective.com/split/sponsor/27/avatar.svg"></a>
|
|
83
|
-
<a href="https://opencollective.com/split/sponsor/28/website" target="_blank"><img src="https://opencollective.com/split/sponsor/28/avatar.svg"></a>
|
|
84
|
-
<a href="https://opencollective.com/split/sponsor/29/website" target="_blank"><img src="https://opencollective.com/split/sponsor/29/avatar.svg"></a>
|
|
14
|
+
Split is heavily inspired by the [Abingo](https://github.com/ryanb/abingo) and [Vanity](https://github.com/assaf/vanity) Rails A/B testing plugins and [Resque](https://github.com/resque/resque) in its use of Redis.
|
|
85
15
|
|
|
16
|
+
Split is designed to be hacker friendly, allowing for maximum customisation and extensibility.
|
|
86
17
|
|
|
18
|
+
## Install
|
|
87
19
|
|
|
88
|
-
|
|
20
|
+
### Requirements
|
|
89
21
|
|
|
90
|
-
Split currently requires Ruby 1.9.
|
|
22
|
+
Split currently requires Ruby 1.9.3 or higher. If your project requires compatibility with Ruby 1.8.x and Rails 2.3, please use v0.8.0.
|
|
91
23
|
|
|
92
|
-
Split uses
|
|
24
|
+
Split uses Redis as a datastore.
|
|
93
25
|
|
|
94
|
-
Split only supports
|
|
26
|
+
Split only supports Redis 2.0 or greater.
|
|
95
27
|
|
|
96
28
|
If you're on OS X, Homebrew is the simplest way to install Redis:
|
|
97
29
|
|
|
@@ -100,21 +32,21 @@ brew install redis
|
|
|
100
32
|
redis-server /usr/local/etc/redis.conf
|
|
101
33
|
```
|
|
102
34
|
|
|
103
|
-
You now have a Redis daemon running on 6379
|
|
35
|
+
You now have a Redis daemon running on port `6379`.
|
|
104
36
|
|
|
105
|
-
|
|
37
|
+
### Setup
|
|
106
38
|
|
|
107
39
|
```bash
|
|
108
40
|
gem install split
|
|
109
41
|
```
|
|
110
42
|
|
|
111
|
-
|
|
43
|
+
#### Rails
|
|
112
44
|
|
|
113
|
-
Adding `gem 'split'` to your Gemfile will autoload it when rails starts up, as long as you've configured
|
|
45
|
+
Adding `gem 'split'` to your Gemfile will autoload it when rails starts up, as long as you've configured Redis it will 'just work'.
|
|
114
46
|
|
|
115
|
-
|
|
47
|
+
#### Sinatra
|
|
116
48
|
|
|
117
|
-
To configure
|
|
49
|
+
To configure Sinatra with Split you need to enable sessions and mix in the helper methods. Add the following lines at the top of your Sinatra app:
|
|
118
50
|
|
|
119
51
|
```ruby
|
|
120
52
|
require 'split'
|
|
@@ -130,7 +62,7 @@ end
|
|
|
130
62
|
|
|
131
63
|
## Usage
|
|
132
64
|
|
|
133
|
-
To begin your
|
|
65
|
+
To begin your A/B test use the `ab_test` method, naming your experiment with the first argument and then the different alternatives which you wish to test on as the other arguments.
|
|
134
66
|
|
|
135
67
|
`ab_test` returns one of the alternatives, if a user has already seen that test they will get the same alternative as before, which you can use to split your code on.
|
|
136
68
|
|
|
@@ -178,12 +110,19 @@ Split has two options for you to use to determine which alternative is the best.
|
|
|
178
110
|
|
|
179
111
|
The first option (default on the dashboard) uses a z test (n>30) for the difference between your control and alternative conversion rates to calculate statistical significance. This test will tell you whether an alternative is better or worse than your control, but it will not distinguish between which alternative is the best in an experiment with multiple alternatives. Split will only tell you if your experiment is 90%, 95%, or 99% significant, and this test only works if you have more than 30 participants and 5 conversions for each branch.
|
|
180
112
|
|
|
181
|
-
As per this [blog post](
|
|
113
|
+
As per this [blog post](https://www.evanmiller.org/how-not-to-run-an-ab-test.html) on the pitfalls of A/B testing, it is highly recommended that you determine your requisite sample size for each branch before running the experiment. Otherwise, you'll have an increased rate of false positives (experiments which show a significant effect where really there is none).
|
|
182
114
|
|
|
183
|
-
[Here](
|
|
115
|
+
[Here](https://www.evanmiller.org/ab-testing/sample-size.html) is a sample size calculator for your convenience.
|
|
184
116
|
|
|
185
117
|
The second option uses simulations from a beta distribution to determine the probability that the given alternative is the winner compared to all other alternatives. You can view these probabilities by clicking on the drop-down menu labeled "Confidence." This option should be used when the experiment has more than just 1 control and 1 alternative. It can also be used for a simple, 2-alternative A/B test.
|
|
186
118
|
|
|
119
|
+
Calculating the beta-distribution simulations for a large number of experiments can be slow, so the results are cached. You can specify how often they should be recalculated (the default is once per day).
|
|
120
|
+
|
|
121
|
+
```ruby
|
|
122
|
+
Split.configure do |config|
|
|
123
|
+
config.winning_alternative_recalculation_interval = 3600 # 1 hour
|
|
124
|
+
end
|
|
125
|
+
```
|
|
187
126
|
|
|
188
127
|
## Extras
|
|
189
128
|
|
|
@@ -220,9 +159,47 @@ In the event you want to disable all tests without having to know the individual
|
|
|
220
159
|
|
|
221
160
|
It is not required to send `SPLIT_DISABLE=false` to activate Split.
|
|
222
161
|
|
|
162
|
+
|
|
163
|
+
### Rspec Helper
|
|
164
|
+
To aid testing with RSpec, write `spec/support/split_helper.rb` and call `use_ab_test(alternatives_by_experiment)` in your specs as instructed below:
|
|
165
|
+
|
|
166
|
+
```ruby
|
|
167
|
+
# Create a file with these contents at 'spec/support/split_helper.rb'
|
|
168
|
+
# and ensure it is `require`d in your rails_helper.rb or spec_helper.rb
|
|
169
|
+
module SplitHelper
|
|
170
|
+
|
|
171
|
+
# Force a specific experiment alternative to always be returned:
|
|
172
|
+
# use_ab_test(signup_form: "single_page")
|
|
173
|
+
#
|
|
174
|
+
# Force alternatives for multiple experiments:
|
|
175
|
+
# use_ab_test(signup_form: "single_page", pricing: "show_enterprise_prices")
|
|
176
|
+
#
|
|
177
|
+
def use_ab_test(alternatives_by_experiment)
|
|
178
|
+
allow_any_instance_of(Split::Helper).to receive(:ab_test) do |_receiver, experiment|
|
|
179
|
+
alternatives_by_experiment.fetch(experiment) { |key| raise "Unknown experiment '#{key}'" }
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Make the `use_ab_test` method available to all specs:
|
|
185
|
+
RSpec.configure do |config|
|
|
186
|
+
config.include SplitHelper
|
|
187
|
+
end
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Now you can call `use_ab_test(alternatives_by_experiment)` in your specs, for example:
|
|
191
|
+
```ruby
|
|
192
|
+
it "registers using experimental signup" do
|
|
193
|
+
use_ab_test experiment_name: "alternative_name"
|
|
194
|
+
post "/signups"
|
|
195
|
+
...
|
|
196
|
+
end
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
|
|
223
200
|
### Starting experiments manually
|
|
224
201
|
|
|
225
|
-
By default new
|
|
202
|
+
By default new A/B tests will be active right after deployment. In case you would like to start new test a while after
|
|
226
203
|
the deploy, you can do it by setting the `start_manually` configuration option to `true`.
|
|
227
204
|
|
|
228
205
|
After choosing this option tests won't be started right after deploy, but after pressing the `Start` button in Split admin dashboard. If a test is deleted from the Split dashboard, then it can only be started after pressing the `Start` button whenever being re-initialized.
|
|
@@ -241,6 +218,12 @@ The user will then always see the alternative they started with.
|
|
|
241
218
|
|
|
242
219
|
Any old unfinished experiment key will be deleted from the user's data storage if the experiment had been removed or is over and a winner had been chosen. This allows a user to enroll into any new experiment in cases when the `allow_multiple_experiments` config option is set to `false`.
|
|
243
220
|
|
|
221
|
+
### Reset experiments manually
|
|
222
|
+
|
|
223
|
+
By default Split automatically resets the experiment whenever it detects the configuration for an experiment has changed (e.g. you call `ab_test` with different alternatives). You can prevent this by setting the option `reset_manually` to `true`.
|
|
224
|
+
|
|
225
|
+
You may want to do this when you want to change something, like the variants' names, the metadata about an experiment, etc. without resetting everything.
|
|
226
|
+
|
|
244
227
|
### Multiple experiments at once
|
|
245
228
|
|
|
246
229
|
By default Split will avoid users participating in multiple experiments at once. This means you are less likely to skew results by adding in more variation to your tests.
|
|
@@ -377,7 +360,7 @@ end
|
|
|
377
360
|
|
|
378
361
|
If you are running `ab_test` from a view, you must define your event
|
|
379
362
|
hook callback as a
|
|
380
|
-
[helper_method](
|
|
363
|
+
[helper_method](https://apidock.com/rails/AbstractController/Helpers/ClassMethods/helper_method)
|
|
381
364
|
in the controller:
|
|
382
365
|
|
|
383
366
|
``` ruby
|
|
@@ -420,7 +403,7 @@ run Rack::URLMap.new \
|
|
|
420
403
|
"/split" => Split::Dashboard.new
|
|
421
404
|
```
|
|
422
405
|
|
|
423
|
-
However, if you are using Rails 3: You can mount this inside your app routes by first adding this to the Gemfile:
|
|
406
|
+
However, if you are using Rails 3 or higher: You can mount this inside your app routes by first adding this to the Gemfile:
|
|
424
407
|
|
|
425
408
|
```ruby
|
|
426
409
|
gem 'split', require: 'split/dashboard'
|
|
@@ -463,7 +446,7 @@ match "/split" => Split::Dashboard, anchor: false, via: [:get, :post, :delete],
|
|
|
463
446
|
end
|
|
464
447
|
```
|
|
465
448
|
|
|
466
|
-
More information on this [here](
|
|
449
|
+
More information on this [here](https://steve.dynedge.co.uk/2011/12/09/controlling-access-to-routes-and-rack-apps-in-rails-3-with-devise-and-warden/)
|
|
467
450
|
|
|
468
451
|
### Screenshot
|
|
469
452
|
|
|
@@ -475,12 +458,13 @@ You can override the default configuration options of Split like so:
|
|
|
475
458
|
|
|
476
459
|
```ruby
|
|
477
460
|
Split.configure do |config|
|
|
478
|
-
config.db_failover = true # handle
|
|
461
|
+
config.db_failover = true # handle Redis errors gracefully
|
|
479
462
|
config.db_failover_on_db_error = -> (error) { Rails.logger.error(error.message) }
|
|
480
463
|
config.allow_multiple_experiments = true
|
|
481
464
|
config.enabled = true
|
|
482
465
|
config.persistence = Split::Persistence::SessionAdapter
|
|
483
466
|
#config.start_manually = false ## new test will have to be started manually from the admin panel. default false
|
|
467
|
+
#config.reset_manually = false ## if true, it never resets the experiment data, even if the configuration changes
|
|
484
468
|
config.include_rails_helper = true
|
|
485
469
|
config.redis = "redis://custom.redis.url:6380"
|
|
486
470
|
end
|
|
@@ -507,7 +491,7 @@ Split.configure do |config|
|
|
|
507
491
|
# IP config
|
|
508
492
|
config.ignore_ip_addresses << '81.19.48.130' # or regex: /81\.19\.48\.[0-9]+/
|
|
509
493
|
|
|
510
|
-
# or provide your own filter functionality, the default is proc{ |request| is_robot? || is_ignored_ip_address? }
|
|
494
|
+
# or provide your own filter functionality, the default is proc{ |request| is_robot? || is_ignored_ip_address? || is_preview? }
|
|
511
495
|
config.ignore_filter = -> (request) { CustomExcludeLogic.excludes?(request) }
|
|
512
496
|
end
|
|
513
497
|
```
|
|
@@ -572,7 +556,7 @@ and:
|
|
|
572
556
|
ab_finished(:my_first_experiment)
|
|
573
557
|
```
|
|
574
558
|
|
|
575
|
-
You can also add meta data for each experiment, very useful when you need more than an alternative name to change behaviour:
|
|
559
|
+
You can also add meta data for each experiment, which is very useful when you need more than an alternative name to change behaviour:
|
|
576
560
|
|
|
577
561
|
```ruby
|
|
578
562
|
Split.configure do |config|
|
|
@@ -617,6 +601,8 @@ or in views:
|
|
|
617
601
|
<% end %>
|
|
618
602
|
```
|
|
619
603
|
|
|
604
|
+
The keys used in meta data should be Strings
|
|
605
|
+
|
|
620
606
|
#### Metrics
|
|
621
607
|
|
|
622
608
|
You might wish to track generic metrics, such as conversions, and use
|
|
@@ -693,6 +679,35 @@ Once you finish one of the goals, the test is considered to be completed, and fi
|
|
|
693
679
|
|
|
694
680
|
**Bad Example**: Test both how button color affects signup *and* how it affects login, at the same time. THIS WILL NOT WORK.
|
|
695
681
|
|
|
682
|
+
#### Combined Experiments
|
|
683
|
+
If you want to test how button color affects signup *and* how it affects login at the same time, use combined experiments.
|
|
684
|
+
Configure like so:
|
|
685
|
+
```ruby
|
|
686
|
+
Split.configuration.experiments = {
|
|
687
|
+
:button_color_experiment => {
|
|
688
|
+
:alternatives => ["blue", "green"],
|
|
689
|
+
:combined_experiments => ["button_color_on_signup", "button_color_on_login"]
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
Starting the combined test starts all combined experiments
|
|
695
|
+
```ruby
|
|
696
|
+
ab_combined_test(:button_color_experiment)
|
|
697
|
+
```
|
|
698
|
+
Finish each combined test as normal
|
|
699
|
+
|
|
700
|
+
```ruby
|
|
701
|
+
ab_finished(:button_color_on_login)
|
|
702
|
+
ab_finished(:button_color_on_signup)
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
**Additional Configuration**:
|
|
706
|
+
* Be sure to enable `allow_multiple_experiments`
|
|
707
|
+
* In Sinatra include the CombinedExperimentsHelper
|
|
708
|
+
```
|
|
709
|
+
helpers Split::CombinedExperimentsHelper
|
|
710
|
+
```
|
|
696
711
|
### DB failover solution
|
|
697
712
|
|
|
698
713
|
Due to the fact that Redis has no automatic failover mechanism, it's
|
|
@@ -811,12 +826,12 @@ end
|
|
|
811
826
|
|
|
812
827
|
## Extensions
|
|
813
828
|
|
|
814
|
-
- [Split::Export](
|
|
815
|
-
- [Split::Analytics](
|
|
816
|
-
- [Split::Mongoid](https://github.com/MongoHQ/split-mongoid) -
|
|
817
|
-
- [Split::Cacheable](https://github.com/harrystech/split_cacheable) -
|
|
818
|
-
- [Split::Counters](https://github.com/bernardkroes/split-counters) -
|
|
819
|
-
- [Split::Cli](https://github.com/craigmcnamara/split-cli) -
|
|
829
|
+
- [Split::Export](https://github.com/splitrb/split-export) - Easily export A/B test data out of Split.
|
|
830
|
+
- [Split::Analytics](https://github.com/splitrb/split-analytics) - Push test data to Google Analytics.
|
|
831
|
+
- [Split::Mongoid](https://github.com/MongoHQ/split-mongoid) - Store experiment data in mongoid (still uses redis).
|
|
832
|
+
- [Split::Cacheable](https://github.com/harrystech/split_cacheable) - Automatically create cache buckets per test.
|
|
833
|
+
- [Split::Counters](https://github.com/bernardkroes/split-counters) - Add counters per experiment and alternative.
|
|
834
|
+
- [Split::Cli](https://github.com/craigmcnamara/split-cli) - A CLI to trigger Split A/B tests.
|
|
820
835
|
|
|
821
836
|
## Screencast
|
|
822
837
|
|
|
@@ -824,15 +839,93 @@ Ryan bates has produced an excellent 10 minute screencast about split on the Rai
|
|
|
824
839
|
|
|
825
840
|
## Blogposts
|
|
826
841
|
|
|
827
|
-
* [A/B
|
|
828
|
-
* [Recipe: A/B testing with KISSMetrics and the split gem](http://robots.thoughtbot.com/post/9595887299/recipe-a-b-testing-with-kissmetrics-and-the-split-gem)
|
|
842
|
+
* [Recipe: A/B testing with KISSMetrics and the split gem](https://robots.thoughtbot.com/post/9595887299/recipe-a-b-testing-with-kissmetrics-and-the-split-gem)
|
|
829
843
|
* [Rails A/B testing with Split on Heroku](http://blog.nathanhumbert.com/2012/02/rails-ab-testing-with-split-on-heroku.html)
|
|
830
844
|
|
|
831
|
-
##
|
|
845
|
+
## Backers
|
|
832
846
|
|
|
833
|
-
|
|
847
|
+
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/split#backer)]
|
|
848
|
+
|
|
849
|
+
<a href="https://opencollective.com/split/backer/0/website" target="_blank"><img src="https://opencollective.com/split/backer/0/avatar.svg"></a>
|
|
850
|
+
<a href="https://opencollective.com/split/backer/1/website" target="_blank"><img src="https://opencollective.com/split/backer/1/avatar.svg"></a>
|
|
851
|
+
<a href="https://opencollective.com/split/backer/2/website" target="_blank"><img src="https://opencollective.com/split/backer/2/avatar.svg"></a>
|
|
852
|
+
<a href="https://opencollective.com/split/backer/3/website" target="_blank"><img src="https://opencollective.com/split/backer/3/avatar.svg"></a>
|
|
853
|
+
<a href="https://opencollective.com/split/backer/4/website" target="_blank"><img src="https://opencollective.com/split/backer/4/avatar.svg"></a>
|
|
854
|
+
<a href="https://opencollective.com/split/backer/5/website" target="_blank"><img src="https://opencollective.com/split/backer/5/avatar.svg"></a>
|
|
855
|
+
<a href="https://opencollective.com/split/backer/6/website" target="_blank"><img src="https://opencollective.com/split/backer/6/avatar.svg"></a>
|
|
856
|
+
<a href="https://opencollective.com/split/backer/7/website" target="_blank"><img src="https://opencollective.com/split/backer/7/avatar.svg"></a>
|
|
857
|
+
<a href="https://opencollective.com/split/backer/8/website" target="_blank"><img src="https://opencollective.com/split/backer/8/avatar.svg"></a>
|
|
858
|
+
<a href="https://opencollective.com/split/backer/9/website" target="_blank"><img src="https://opencollective.com/split/backer/9/avatar.svg"></a>
|
|
859
|
+
<a href="https://opencollective.com/split/backer/10/website" target="_blank"><img src="https://opencollective.com/split/backer/10/avatar.svg"></a>
|
|
860
|
+
<a href="https://opencollective.com/split/backer/11/website" target="_blank"><img src="https://opencollective.com/split/backer/11/avatar.svg"></a>
|
|
861
|
+
<a href="https://opencollective.com/split/backer/12/website" target="_blank"><img src="https://opencollective.com/split/backer/12/avatar.svg"></a>
|
|
862
|
+
<a href="https://opencollective.com/split/backer/13/website" target="_blank"><img src="https://opencollective.com/split/backer/13/avatar.svg"></a>
|
|
863
|
+
<a href="https://opencollective.com/split/backer/14/website" target="_blank"><img src="https://opencollective.com/split/backer/14/avatar.svg"></a>
|
|
864
|
+
<a href="https://opencollective.com/split/backer/15/website" target="_blank"><img src="https://opencollective.com/split/backer/15/avatar.svg"></a>
|
|
865
|
+
<a href="https://opencollective.com/split/backer/16/website" target="_blank"><img src="https://opencollective.com/split/backer/16/avatar.svg"></a>
|
|
866
|
+
<a href="https://opencollective.com/split/backer/17/website" target="_blank"><img src="https://opencollective.com/split/backer/17/avatar.svg"></a>
|
|
867
|
+
<a href="https://opencollective.com/split/backer/18/website" target="_blank"><img src="https://opencollective.com/split/backer/18/avatar.svg"></a>
|
|
868
|
+
<a href="https://opencollective.com/split/backer/19/website" target="_blank"><img src="https://opencollective.com/split/backer/19/avatar.svg"></a>
|
|
869
|
+
<a href="https://opencollective.com/split/backer/20/website" target="_blank"><img src="https://opencollective.com/split/backer/20/avatar.svg"></a>
|
|
870
|
+
<a href="https://opencollective.com/split/backer/21/website" target="_blank"><img src="https://opencollective.com/split/backer/21/avatar.svg"></a>
|
|
871
|
+
<a href="https://opencollective.com/split/backer/22/website" target="_blank"><img src="https://opencollective.com/split/backer/22/avatar.svg"></a>
|
|
872
|
+
<a href="https://opencollective.com/split/backer/23/website" target="_blank"><img src="https://opencollective.com/split/backer/23/avatar.svg"></a>
|
|
873
|
+
<a href="https://opencollective.com/split/backer/24/website" target="_blank"><img src="https://opencollective.com/split/backer/24/avatar.svg"></a>
|
|
874
|
+
<a href="https://opencollective.com/split/backer/25/website" target="_blank"><img src="https://opencollective.com/split/backer/25/avatar.svg"></a>
|
|
875
|
+
<a href="https://opencollective.com/split/backer/26/website" target="_blank"><img src="https://opencollective.com/split/backer/26/avatar.svg"></a>
|
|
876
|
+
<a href="https://opencollective.com/split/backer/27/website" target="_blank"><img src="https://opencollective.com/split/backer/27/avatar.svg"></a>
|
|
877
|
+
<a href="https://opencollective.com/split/backer/28/website" target="_blank"><img src="https://opencollective.com/split/backer/28/avatar.svg"></a>
|
|
878
|
+
<a href="https://opencollective.com/split/backer/29/website" target="_blank"><img src="https://opencollective.com/split/backer/29/avatar.svg"></a>
|
|
834
879
|
|
|
835
|
-
|
|
880
|
+
|
|
881
|
+
## Sponsors
|
|
882
|
+
|
|
883
|
+
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/split#sponsor)]
|
|
884
|
+
|
|
885
|
+
<a href="https://opencollective.com/split/sponsor/0/website" target="_blank"><img src="https://opencollective.com/split/sponsor/0/avatar.svg"></a>
|
|
886
|
+
<a href="https://opencollective.com/split/sponsor/1/website" target="_blank"><img src="https://opencollective.com/split/sponsor/1/avatar.svg"></a>
|
|
887
|
+
<a href="https://opencollective.com/split/sponsor/2/website" target="_blank"><img src="https://opencollective.com/split/sponsor/2/avatar.svg"></a>
|
|
888
|
+
<a href="https://opencollective.com/split/sponsor/3/website" target="_blank"><img src="https://opencollective.com/split/sponsor/3/avatar.svg"></a>
|
|
889
|
+
<a href="https://opencollective.com/split/sponsor/4/website" target="_blank"><img src="https://opencollective.com/split/sponsor/4/avatar.svg"></a>
|
|
890
|
+
<a href="https://opencollective.com/split/sponsor/5/website" target="_blank"><img src="https://opencollective.com/split/sponsor/5/avatar.svg"></a>
|
|
891
|
+
<a href="https://opencollective.com/split/sponsor/6/website" target="_blank"><img src="https://opencollective.com/split/sponsor/6/avatar.svg"></a>
|
|
892
|
+
<a href="https://opencollective.com/split/sponsor/7/website" target="_blank"><img src="https://opencollective.com/split/sponsor/7/avatar.svg"></a>
|
|
893
|
+
<a href="https://opencollective.com/split/sponsor/8/website" target="_blank"><img src="https://opencollective.com/split/sponsor/8/avatar.svg"></a>
|
|
894
|
+
<a href="https://opencollective.com/split/sponsor/9/website" target="_blank"><img src="https://opencollective.com/split/sponsor/9/avatar.svg"></a>
|
|
895
|
+
<a href="https://opencollective.com/split/sponsor/10/website" target="_blank"><img src="https://opencollective.com/split/sponsor/10/avatar.svg"></a>
|
|
896
|
+
<a href="https://opencollective.com/split/sponsor/11/website" target="_blank"><img src="https://opencollective.com/split/sponsor/11/avatar.svg"></a>
|
|
897
|
+
<a href="https://opencollective.com/split/sponsor/12/website" target="_blank"><img src="https://opencollective.com/split/sponsor/12/avatar.svg"></a>
|
|
898
|
+
<a href="https://opencollective.com/split/sponsor/13/website" target="_blank"><img src="https://opencollective.com/split/sponsor/13/avatar.svg"></a>
|
|
899
|
+
<a href="https://opencollective.com/split/sponsor/14/website" target="_blank"><img src="https://opencollective.com/split/sponsor/14/avatar.svg"></a>
|
|
900
|
+
<a href="https://opencollective.com/split/sponsor/15/website" target="_blank"><img src="https://opencollective.com/split/sponsor/15/avatar.svg"></a>
|
|
901
|
+
<a href="https://opencollective.com/split/sponsor/16/website" target="_blank"><img src="https://opencollective.com/split/sponsor/16/avatar.svg"></a>
|
|
902
|
+
<a href="https://opencollective.com/split/sponsor/17/website" target="_blank"><img src="https://opencollective.com/split/sponsor/17/avatar.svg"></a>
|
|
903
|
+
<a href="https://opencollective.com/split/sponsor/18/website" target="_blank"><img src="https://opencollective.com/split/sponsor/18/avatar.svg"></a>
|
|
904
|
+
<a href="https://opencollective.com/split/sponsor/19/website" target="_blank"><img src="https://opencollective.com/split/sponsor/19/avatar.svg"></a>
|
|
905
|
+
<a href="https://opencollective.com/split/sponsor/20/website" target="_blank"><img src="https://opencollective.com/split/sponsor/20/avatar.svg"></a>
|
|
906
|
+
<a href="https://opencollective.com/split/sponsor/21/website" target="_blank"><img src="https://opencollective.com/split/sponsor/21/avatar.svg"></a>
|
|
907
|
+
<a href="https://opencollective.com/split/sponsor/22/website" target="_blank"><img src="https://opencollective.com/split/sponsor/22/avatar.svg"></a>
|
|
908
|
+
<a href="https://opencollective.com/split/sponsor/23/website" target="_blank"><img src="https://opencollective.com/split/sponsor/23/avatar.svg"></a>
|
|
909
|
+
<a href="https://opencollective.com/split/sponsor/24/website" target="_blank"><img src="https://opencollective.com/split/sponsor/24/avatar.svg"></a>
|
|
910
|
+
<a href="https://opencollective.com/split/sponsor/25/website" target="_blank"><img src="https://opencollective.com/split/sponsor/25/avatar.svg"></a>
|
|
911
|
+
<a href="https://opencollective.com/split/sponsor/26/website" target="_blank"><img src="https://opencollective.com/split/sponsor/26/avatar.svg"></a>
|
|
912
|
+
<a href="https://opencollective.com/split/sponsor/27/website" target="_blank"><img src="https://opencollective.com/split/sponsor/27/avatar.svg"></a>
|
|
913
|
+
<a href="https://opencollective.com/split/sponsor/28/website" target="_blank"><img src="https://opencollective.com/split/sponsor/28/avatar.svg"></a>
|
|
914
|
+
<a href="https://opencollective.com/split/sponsor/29/website" target="_blank"><img src="https://opencollective.com/split/sponsor/29/avatar.svg"></a>
|
|
915
|
+
|
|
916
|
+
## Contribute
|
|
917
|
+
|
|
918
|
+
Please do! Over 70 different people have contributed to the project, you can see them all here: https://github.com/splitrb/split/graphs/contributors.
|
|
919
|
+
|
|
920
|
+
### Development
|
|
921
|
+
|
|
922
|
+
The source code is hosted at [GitHub](https://github.com/splitrb/split).
|
|
923
|
+
|
|
924
|
+
Report issues and feature requests on [GitHub Issues](https://github.com/splitrb/split/issues).
|
|
925
|
+
|
|
926
|
+
You can find a discussion form on [Google Groups](https://groups.google.com/d/forum/split-ruby).
|
|
927
|
+
|
|
928
|
+
### Tests
|
|
836
929
|
|
|
837
930
|
Run the tests like this:
|
|
838
931
|
|
|
@@ -842,23 +935,21 @@ Run the tests like this:
|
|
|
842
935
|
bundle
|
|
843
936
|
rake spec
|
|
844
937
|
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
Report Issues/Feature requests on [GitHub Issues](http://github.com/splitrb/split/issues).
|
|
848
|
-
|
|
849
|
-
Discussion at [Google Groups](https://groups.google.com/d/forum/split-ruby).
|
|
850
|
-
|
|
851
|
-
### Note on Patches/Pull Requests
|
|
938
|
+
### A Note on Patches and Pull Requests
|
|
852
939
|
|
|
853
940
|
* Fork the project.
|
|
854
941
|
* Make your feature addition or bug fix.
|
|
855
942
|
* Add tests for it. This is important so I don't break it in a
|
|
856
943
|
future version unintentionally.
|
|
857
944
|
* Add documentation if necessary.
|
|
858
|
-
* Commit
|
|
859
|
-
(
|
|
945
|
+
* Commit. Do not mess with the rakefile, version, or history.
|
|
946
|
+
(If you want to have your own version, that is fine. But bump the version in a commit by itself, which I can ignore when I pull.)
|
|
860
947
|
* Send a pull request. Bonus points for topic branches.
|
|
861
948
|
|
|
949
|
+
### Code of Conduct
|
|
950
|
+
|
|
951
|
+
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|
|
952
|
+
|
|
862
953
|
## Copyright
|
|
863
954
|
|
|
864
|
-
|
|
955
|
+
[MIT License](LICENSE) © 2019 [Andrew Nesbitt](https://github.com/andrew).
|
data/Rakefile
CHANGED
data/gemfiles/4.2.gemfile
CHANGED
data/gemfiles/5.0.gemfile
CHANGED
data/lib/split/alternative.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Split
|
|
|
15
15
|
@name = name
|
|
16
16
|
@weight = 1
|
|
17
17
|
end
|
|
18
|
-
p_winner = 0.0
|
|
18
|
+
@p_winner = 0.0
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def to_s
|
|
@@ -75,7 +75,7 @@ module Split
|
|
|
75
75
|
return field
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
-
def set_completed_count
|
|
78
|
+
def set_completed_count(count, goal = nil)
|
|
79
79
|
field = set_field(goal)
|
|
80
80
|
Split.redis.hset(key, field, count.to_i)
|
|
81
81
|
end
|
|
@@ -119,7 +119,10 @@ module Split
|
|
|
119
119
|
n_a = alternative.participant_count
|
|
120
120
|
n_c = control.participant_count
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
# can't calculate zscore for P(x) > 1
|
|
123
|
+
return 'N/A' if p_a > 1 || p_c > 1
|
|
124
|
+
|
|
125
|
+
Split::Zscore.calculate(p_a, n_a, p_c, n_c)
|
|
123
126
|
end
|
|
124
127
|
|
|
125
128
|
def extra_info
|