split 3.0.0 → 3.3.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/.rubocop.yml +2 -2
- data/.travis.yml +39 -2
- data/Appraisals +8 -1
- data/CHANGELOG.md +41 -0
- data/CONTRIBUTING.md +54 -5
- data/LICENSE +1 -1
- data/README.md +184 -110
- 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/lib/split/alternative.rb +3 -0
- data/lib/split/combined_experiments_helper.rb +37 -0
- data/lib/split/configuration.rb +8 -0
- data/lib/split/dashboard/pagination_helpers.rb +87 -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.rb +2 -0
- data/lib/split/engine.rb +2 -0
- data/lib/split/experiment.rb +5 -4
- data/lib/split/helper.rb +14 -1
- data/lib/split/persistence/cookie_adapter.rb +53 -15
- data/lib/split/redis_interface.rb +1 -3
- data/lib/split/version.rb +1 -1
- data/lib/split.rb +1 -0
- data/spec/alternative_spec.rb +12 -0
- data/spec/combined_experiments_helper_spec.rb +57 -0
- data/spec/dashboard/pagination_helpers_spec.rb +198 -0
- data/spec/dashboard/paginator_spec.rb +37 -0
- data/spec/experiment_spec.rb +1 -1
- data/spec/helper_spec.rb +20 -0
- data/spec/persistence/cookie_adapter_spec.rb +90 -23
- data/spec/persistence/dual_adapter_spec.rb +2 -2
- data/spec/split_spec.rb +7 -7
- data/split.gemspec +16 -6
- metadata +33 -16
data/README.md
CHANGED
|
@@ -1,97 +1,29 @@
|
|
|
1
1
|
# [Split](http://libraries.io/rubygems/split)
|
|
2
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.
|
|
8
|
-
|
|
9
3
|
[](http://badge.fury.io/rb/split)
|
|
10
4
|
[](http://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 http://libraries.io/rubygems/split
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/split#backer)]
|
|
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
|
|
12
|
+
Split is a rack based A/B testing framework designed to work with Rails, Sinatra or any other rack based app.
|
|
52
13
|
|
|
53
|
-
|
|
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
|
|
|
@@ -184,6 +116,13 @@ As per this [blog post](http://www.evanmiller.org/how-not-to-run-an-ab-test.html
|
|
|
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,39 @@ 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
|
+
To aid testing with RSpec, write `split_helper.rb` and call `use_ab_test(alternatives_by_experiment)` in your specs as instructed below:
|
|
163
|
+
|
|
164
|
+
```ruby
|
|
165
|
+
# Recommended path for this file is 'spec/support/split_helper.rb', and you will need to ensure it
|
|
166
|
+
# is `require`-d by rails_helper.rb or spec_helper.rb
|
|
167
|
+
module SplitHelper
|
|
168
|
+
|
|
169
|
+
# Usage:
|
|
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
|
+
alternative =
|
|
180
|
+
alternatives_by_experiment.fetch(experiment) { |key| raise "Unknown experiment '#{key}'" }
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
RSpec.configure do |config|
|
|
186
|
+
# Make the `use_ab_test` method available to all specs:
|
|
187
|
+
config.include SplitHelper
|
|
188
|
+
end
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
|
|
223
192
|
### Starting experiments manually
|
|
224
193
|
|
|
225
|
-
By default new
|
|
194
|
+
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
195
|
the deploy, you can do it by setting the `start_manually` configuration option to `true`.
|
|
227
196
|
|
|
228
197
|
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.
|
|
@@ -420,7 +389,7 @@ run Rack::URLMap.new \
|
|
|
420
389
|
"/split" => Split::Dashboard.new
|
|
421
390
|
```
|
|
422
391
|
|
|
423
|
-
However, if you are using Rails 3: You can mount this inside your app routes by first adding this to the Gemfile:
|
|
392
|
+
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
393
|
|
|
425
394
|
```ruby
|
|
426
395
|
gem 'split', require: 'split/dashboard'
|
|
@@ -475,7 +444,7 @@ You can override the default configuration options of Split like so:
|
|
|
475
444
|
|
|
476
445
|
```ruby
|
|
477
446
|
Split.configure do |config|
|
|
478
|
-
config.db_failover = true # handle
|
|
447
|
+
config.db_failover = true # handle Redis errors gracefully
|
|
479
448
|
config.db_failover_on_db_error = -> (error) { Rails.logger.error(error.message) }
|
|
480
449
|
config.allow_multiple_experiments = true
|
|
481
450
|
config.enabled = true
|
|
@@ -507,7 +476,7 @@ Split.configure do |config|
|
|
|
507
476
|
# IP config
|
|
508
477
|
config.ignore_ip_addresses << '81.19.48.130' # or regex: /81\.19\.48\.[0-9]+/
|
|
509
478
|
|
|
510
|
-
# or provide your own filter functionality, the default is proc{ |request| is_robot? || is_ignored_ip_address? }
|
|
479
|
+
# or provide your own filter functionality, the default is proc{ |request| is_robot? || is_ignored_ip_address? || is_preview? }
|
|
511
480
|
config.ignore_filter = -> (request) { CustomExcludeLogic.excludes?(request) }
|
|
512
481
|
end
|
|
513
482
|
```
|
|
@@ -693,6 +662,35 @@ Once you finish one of the goals, the test is considered to be completed, and fi
|
|
|
693
662
|
|
|
694
663
|
**Bad Example**: Test both how button color affects signup *and* how it affects login, at the same time. THIS WILL NOT WORK.
|
|
695
664
|
|
|
665
|
+
#### Combined Experiments
|
|
666
|
+
If you want to test how button color affects signup *and* how it affects login at the same time, use combined experiments.
|
|
667
|
+
Configure like so:
|
|
668
|
+
```ruby
|
|
669
|
+
Split.configuration.experiments = {
|
|
670
|
+
:button_color_experiment => {
|
|
671
|
+
:alternatives => ["blue", "green"],
|
|
672
|
+
:combined_experiments => ["button_color_on_signup", "button_color_on_login"]
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
Starting the combined test starts all combined experiments
|
|
678
|
+
```ruby
|
|
679
|
+
ab_combined_test(:button_color_experiment)
|
|
680
|
+
```
|
|
681
|
+
Finish each combined test as normal
|
|
682
|
+
|
|
683
|
+
```ruby
|
|
684
|
+
ab_finished(:button_color_on_login)
|
|
685
|
+
ab_finished(:button_color_on_signup)
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
**Additional Configuration**:
|
|
689
|
+
* Be sure to enable `allow_multiple_experiments`
|
|
690
|
+
* In Sinatra include the CombinedExperimentsHelper
|
|
691
|
+
```
|
|
692
|
+
helpers Split::CombinedExperimentsHelper
|
|
693
|
+
```
|
|
696
694
|
### DB failover solution
|
|
697
695
|
|
|
698
696
|
Due to the fact that Redis has no automatic failover mechanism, it's
|
|
@@ -811,12 +809,12 @@ end
|
|
|
811
809
|
|
|
812
810
|
## Extensions
|
|
813
811
|
|
|
814
|
-
- [Split::Export](http://github.com/splitrb/split-export) -
|
|
815
|
-
- [Split::Analytics](http://github.com/splitrb/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) -
|
|
812
|
+
- [Split::Export](http://github.com/splitrb/split-export) - Easily export A/B test data out of Split.
|
|
813
|
+
- [Split::Analytics](http://github.com/splitrb/split-analytics) - Push test data to Google Analytics.
|
|
814
|
+
- [Split::Mongoid](https://github.com/MongoHQ/split-mongoid) - Store experiment data in mongoid (still uses redis).
|
|
815
|
+
- [Split::Cacheable](https://github.com/harrystech/split_cacheable) - Automatically create cache buckets per test.
|
|
816
|
+
- [Split::Counters](https://github.com/bernardkroes/split-counters) - Add counters per experiment and alternative.
|
|
817
|
+
- [Split::Cli](https://github.com/craigmcnamara/split-cli) - A CLI to trigger Split A/B tests.
|
|
820
818
|
|
|
821
819
|
## Screencast
|
|
822
820
|
|
|
@@ -824,15 +822,93 @@ Ryan bates has produced an excellent 10 minute screencast about split on the Rai
|
|
|
824
822
|
|
|
825
823
|
## Blogposts
|
|
826
824
|
|
|
827
|
-
* [A/B Testing with Split in Ruby on Rails](http://grinnick.com/posts/a-b-testing-with-split-in-ruby-on-rails)
|
|
828
825
|
* [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)
|
|
829
826
|
* [Rails A/B testing with Split on Heroku](http://blog.nathanhumbert.com/2012/02/rails-ab-testing-with-split-on-heroku.html)
|
|
830
827
|
|
|
831
|
-
##
|
|
828
|
+
## Backers
|
|
829
|
+
|
|
830
|
+
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/split#backer)]
|
|
831
|
+
|
|
832
|
+
<a href="https://opencollective.com/split/backer/0/website" target="_blank"><img src="https://opencollective.com/split/backer/0/avatar.svg"></a>
|
|
833
|
+
<a href="https://opencollective.com/split/backer/1/website" target="_blank"><img src="https://opencollective.com/split/backer/1/avatar.svg"></a>
|
|
834
|
+
<a href="https://opencollective.com/split/backer/2/website" target="_blank"><img src="https://opencollective.com/split/backer/2/avatar.svg"></a>
|
|
835
|
+
<a href="https://opencollective.com/split/backer/3/website" target="_blank"><img src="https://opencollective.com/split/backer/3/avatar.svg"></a>
|
|
836
|
+
<a href="https://opencollective.com/split/backer/4/website" target="_blank"><img src="https://opencollective.com/split/backer/4/avatar.svg"></a>
|
|
837
|
+
<a href="https://opencollective.com/split/backer/5/website" target="_blank"><img src="https://opencollective.com/split/backer/5/avatar.svg"></a>
|
|
838
|
+
<a href="https://opencollective.com/split/backer/6/website" target="_blank"><img src="https://opencollective.com/split/backer/6/avatar.svg"></a>
|
|
839
|
+
<a href="https://opencollective.com/split/backer/7/website" target="_blank"><img src="https://opencollective.com/split/backer/7/avatar.svg"></a>
|
|
840
|
+
<a href="https://opencollective.com/split/backer/8/website" target="_blank"><img src="https://opencollective.com/split/backer/8/avatar.svg"></a>
|
|
841
|
+
<a href="https://opencollective.com/split/backer/9/website" target="_blank"><img src="https://opencollective.com/split/backer/9/avatar.svg"></a>
|
|
842
|
+
<a href="https://opencollective.com/split/backer/10/website" target="_blank"><img src="https://opencollective.com/split/backer/10/avatar.svg"></a>
|
|
843
|
+
<a href="https://opencollective.com/split/backer/11/website" target="_blank"><img src="https://opencollective.com/split/backer/11/avatar.svg"></a>
|
|
844
|
+
<a href="https://opencollective.com/split/backer/12/website" target="_blank"><img src="https://opencollective.com/split/backer/12/avatar.svg"></a>
|
|
845
|
+
<a href="https://opencollective.com/split/backer/13/website" target="_blank"><img src="https://opencollective.com/split/backer/13/avatar.svg"></a>
|
|
846
|
+
<a href="https://opencollective.com/split/backer/14/website" target="_blank"><img src="https://opencollective.com/split/backer/14/avatar.svg"></a>
|
|
847
|
+
<a href="https://opencollective.com/split/backer/15/website" target="_blank"><img src="https://opencollective.com/split/backer/15/avatar.svg"></a>
|
|
848
|
+
<a href="https://opencollective.com/split/backer/16/website" target="_blank"><img src="https://opencollective.com/split/backer/16/avatar.svg"></a>
|
|
849
|
+
<a href="https://opencollective.com/split/backer/17/website" target="_blank"><img src="https://opencollective.com/split/backer/17/avatar.svg"></a>
|
|
850
|
+
<a href="https://opencollective.com/split/backer/18/website" target="_blank"><img src="https://opencollective.com/split/backer/18/avatar.svg"></a>
|
|
851
|
+
<a href="https://opencollective.com/split/backer/19/website" target="_blank"><img src="https://opencollective.com/split/backer/19/avatar.svg"></a>
|
|
852
|
+
<a href="https://opencollective.com/split/backer/20/website" target="_blank"><img src="https://opencollective.com/split/backer/20/avatar.svg"></a>
|
|
853
|
+
<a href="https://opencollective.com/split/backer/21/website" target="_blank"><img src="https://opencollective.com/split/backer/21/avatar.svg"></a>
|
|
854
|
+
<a href="https://opencollective.com/split/backer/22/website" target="_blank"><img src="https://opencollective.com/split/backer/22/avatar.svg"></a>
|
|
855
|
+
<a href="https://opencollective.com/split/backer/23/website" target="_blank"><img src="https://opencollective.com/split/backer/23/avatar.svg"></a>
|
|
856
|
+
<a href="https://opencollective.com/split/backer/24/website" target="_blank"><img src="https://opencollective.com/split/backer/24/avatar.svg"></a>
|
|
857
|
+
<a href="https://opencollective.com/split/backer/25/website" target="_blank"><img src="https://opencollective.com/split/backer/25/avatar.svg"></a>
|
|
858
|
+
<a href="https://opencollective.com/split/backer/26/website" target="_blank"><img src="https://opencollective.com/split/backer/26/avatar.svg"></a>
|
|
859
|
+
<a href="https://opencollective.com/split/backer/27/website" target="_blank"><img src="https://opencollective.com/split/backer/27/avatar.svg"></a>
|
|
860
|
+
<a href="https://opencollective.com/split/backer/28/website" target="_blank"><img src="https://opencollective.com/split/backer/28/avatar.svg"></a>
|
|
861
|
+
<a href="https://opencollective.com/split/backer/29/website" target="_blank"><img src="https://opencollective.com/split/backer/29/avatar.svg"></a>
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
## Sponsors
|
|
832
865
|
|
|
833
|
-
|
|
866
|
+
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)]
|
|
834
867
|
|
|
835
|
-
|
|
868
|
+
<a href="https://opencollective.com/split/sponsor/0/website" target="_blank"><img src="https://opencollective.com/split/sponsor/0/avatar.svg"></a>
|
|
869
|
+
<a href="https://opencollective.com/split/sponsor/1/website" target="_blank"><img src="https://opencollective.com/split/sponsor/1/avatar.svg"></a>
|
|
870
|
+
<a href="https://opencollective.com/split/sponsor/2/website" target="_blank"><img src="https://opencollective.com/split/sponsor/2/avatar.svg"></a>
|
|
871
|
+
<a href="https://opencollective.com/split/sponsor/3/website" target="_blank"><img src="https://opencollective.com/split/sponsor/3/avatar.svg"></a>
|
|
872
|
+
<a href="https://opencollective.com/split/sponsor/4/website" target="_blank"><img src="https://opencollective.com/split/sponsor/4/avatar.svg"></a>
|
|
873
|
+
<a href="https://opencollective.com/split/sponsor/5/website" target="_blank"><img src="https://opencollective.com/split/sponsor/5/avatar.svg"></a>
|
|
874
|
+
<a href="https://opencollective.com/split/sponsor/6/website" target="_blank"><img src="https://opencollective.com/split/sponsor/6/avatar.svg"></a>
|
|
875
|
+
<a href="https://opencollective.com/split/sponsor/7/website" target="_blank"><img src="https://opencollective.com/split/sponsor/7/avatar.svg"></a>
|
|
876
|
+
<a href="https://opencollective.com/split/sponsor/8/website" target="_blank"><img src="https://opencollective.com/split/sponsor/8/avatar.svg"></a>
|
|
877
|
+
<a href="https://opencollective.com/split/sponsor/9/website" target="_blank"><img src="https://opencollective.com/split/sponsor/9/avatar.svg"></a>
|
|
878
|
+
<a href="https://opencollective.com/split/sponsor/10/website" target="_blank"><img src="https://opencollective.com/split/sponsor/10/avatar.svg"></a>
|
|
879
|
+
<a href="https://opencollective.com/split/sponsor/11/website" target="_blank"><img src="https://opencollective.com/split/sponsor/11/avatar.svg"></a>
|
|
880
|
+
<a href="https://opencollective.com/split/sponsor/12/website" target="_blank"><img src="https://opencollective.com/split/sponsor/12/avatar.svg"></a>
|
|
881
|
+
<a href="https://opencollective.com/split/sponsor/13/website" target="_blank"><img src="https://opencollective.com/split/sponsor/13/avatar.svg"></a>
|
|
882
|
+
<a href="https://opencollective.com/split/sponsor/14/website" target="_blank"><img src="https://opencollective.com/split/sponsor/14/avatar.svg"></a>
|
|
883
|
+
<a href="https://opencollective.com/split/sponsor/15/website" target="_blank"><img src="https://opencollective.com/split/sponsor/15/avatar.svg"></a>
|
|
884
|
+
<a href="https://opencollective.com/split/sponsor/16/website" target="_blank"><img src="https://opencollective.com/split/sponsor/16/avatar.svg"></a>
|
|
885
|
+
<a href="https://opencollective.com/split/sponsor/17/website" target="_blank"><img src="https://opencollective.com/split/sponsor/17/avatar.svg"></a>
|
|
886
|
+
<a href="https://opencollective.com/split/sponsor/18/website" target="_blank"><img src="https://opencollective.com/split/sponsor/18/avatar.svg"></a>
|
|
887
|
+
<a href="https://opencollective.com/split/sponsor/19/website" target="_blank"><img src="https://opencollective.com/split/sponsor/19/avatar.svg"></a>
|
|
888
|
+
<a href="https://opencollective.com/split/sponsor/20/website" target="_blank"><img src="https://opencollective.com/split/sponsor/20/avatar.svg"></a>
|
|
889
|
+
<a href="https://opencollective.com/split/sponsor/21/website" target="_blank"><img src="https://opencollective.com/split/sponsor/21/avatar.svg"></a>
|
|
890
|
+
<a href="https://opencollective.com/split/sponsor/22/website" target="_blank"><img src="https://opencollective.com/split/sponsor/22/avatar.svg"></a>
|
|
891
|
+
<a href="https://opencollective.com/split/sponsor/23/website" target="_blank"><img src="https://opencollective.com/split/sponsor/23/avatar.svg"></a>
|
|
892
|
+
<a href="https://opencollective.com/split/sponsor/24/website" target="_blank"><img src="https://opencollective.com/split/sponsor/24/avatar.svg"></a>
|
|
893
|
+
<a href="https://opencollective.com/split/sponsor/25/website" target="_blank"><img src="https://opencollective.com/split/sponsor/25/avatar.svg"></a>
|
|
894
|
+
<a href="https://opencollective.com/split/sponsor/26/website" target="_blank"><img src="https://opencollective.com/split/sponsor/26/avatar.svg"></a>
|
|
895
|
+
<a href="https://opencollective.com/split/sponsor/27/website" target="_blank"><img src="https://opencollective.com/split/sponsor/27/avatar.svg"></a>
|
|
896
|
+
<a href="https://opencollective.com/split/sponsor/28/website" target="_blank"><img src="https://opencollective.com/split/sponsor/28/avatar.svg"></a>
|
|
897
|
+
<a href="https://opencollective.com/split/sponsor/29/website" target="_blank"><img src="https://opencollective.com/split/sponsor/29/avatar.svg"></a>
|
|
898
|
+
|
|
899
|
+
## Contribute
|
|
900
|
+
|
|
901
|
+
Please do! Over 70 different people have contributed to the project, you can see them all here: https://github.com/splitrb/split/graphs/contributors.
|
|
902
|
+
|
|
903
|
+
### Development
|
|
904
|
+
|
|
905
|
+
The source code is hosted at [GitHub](http://github.com/splitrb/split).
|
|
906
|
+
|
|
907
|
+
Report issues and feature requests on [GitHub Issues](http://github.com/splitrb/split/issues).
|
|
908
|
+
|
|
909
|
+
You can find a discussion form on [Google Groups](https://groups.google.com/d/forum/split-ruby).
|
|
910
|
+
|
|
911
|
+
### Tests
|
|
836
912
|
|
|
837
913
|
Run the tests like this:
|
|
838
914
|
|
|
@@ -842,23 +918,21 @@ Run the tests like this:
|
|
|
842
918
|
bundle
|
|
843
919
|
rake spec
|
|
844
920
|
|
|
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
|
|
921
|
+
### A Note on Patches and Pull Requests
|
|
852
922
|
|
|
853
923
|
* Fork the project.
|
|
854
924
|
* Make your feature addition or bug fix.
|
|
855
925
|
* Add tests for it. This is important so I don't break it in a
|
|
856
926
|
future version unintentionally.
|
|
857
927
|
* Add documentation if necessary.
|
|
858
|
-
* Commit
|
|
859
|
-
(
|
|
928
|
+
* Commit. Do not mess with the rakefile, version, or history.
|
|
929
|
+
(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
930
|
* Send a pull request. Bonus points for topic branches.
|
|
861
931
|
|
|
932
|
+
### Code of Conduct
|
|
933
|
+
|
|
934
|
+
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.
|
|
935
|
+
|
|
862
936
|
## Copyright
|
|
863
937
|
|
|
864
|
-
|
|
938
|
+
[MIT License](LICENSE) © 2018 [Andrew Nesbitt](https://github.com/andrew).
|
data/gemfiles/4.2.gemfile
CHANGED
data/gemfiles/5.0.gemfile
CHANGED
data/lib/split/alternative.rb
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
module Split
|
|
3
|
+
module CombinedExperimentsHelper
|
|
4
|
+
def ab_combined_test(metric_descriptor, control = nil, *alternatives)
|
|
5
|
+
return nil unless experiment = find_combined_experiment(metric_descriptor)
|
|
6
|
+
raise(Split::InvalidExperimentsFormatError, 'Unable to find experiment #{metric_descriptor} in configuration') if experiment[:combined_experiments].nil?
|
|
7
|
+
|
|
8
|
+
alternative = nil
|
|
9
|
+
weighted_alternatives = nil
|
|
10
|
+
experiment[:combined_experiments].each do |combined_experiment|
|
|
11
|
+
if alternative.nil?
|
|
12
|
+
if control
|
|
13
|
+
alternative = ab_test(combined_experiment, control, alternatives)
|
|
14
|
+
else
|
|
15
|
+
normalized_alternatives = Split::Configuration.new.normalize_alternatives(experiment[:alternatives])
|
|
16
|
+
alternative = ab_test(combined_experiment, normalized_alternatives[0], *normalized_alternatives[1])
|
|
17
|
+
end
|
|
18
|
+
else
|
|
19
|
+
weighted_alternatives ||= experiment[:alternatives].each_with_object({}) do |alt, memo|
|
|
20
|
+
alt = Alternative.new(alt, experiment[:name]).name
|
|
21
|
+
memo[alt] = (alt == alternative ? 1 : 0)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
ab_test(combined_experiment, [weighted_alternatives])
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
alternative
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def find_combined_experiment(metric_descriptor)
|
|
31
|
+
raise(Split::InvalidExperimentsFormatError, 'Invalid descriptor class (String or Symbol required)') unless metric_descriptor.class == String || metric_descriptor.class == Symbol
|
|
32
|
+
raise(Split::InvalidExperimentsFormatError, 'Enable configuration') unless Split.configuration.enabled
|
|
33
|
+
raise(Split::InvalidExperimentsFormatError, 'Enable `allow_multiple_experiments`') unless Split.configuration.allow_multiple_experiments
|
|
34
|
+
experiment = Split::configuration.experiments[metric_descriptor.to_sym]
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
data/lib/split/configuration.rb
CHANGED
|
@@ -25,6 +25,7 @@ module Split
|
|
|
25
25
|
attr_accessor :on_before_experiment_delete
|
|
26
26
|
attr_accessor :include_rails_helper
|
|
27
27
|
attr_accessor :beta_probability_simulations
|
|
28
|
+
attr_accessor :winning_alternative_recalculation_interval
|
|
28
29
|
attr_accessor :redis
|
|
29
30
|
|
|
30
31
|
attr_reader :experiments
|
|
@@ -48,7 +49,9 @@ module Split
|
|
|
48
49
|
'spider' => 'generic web spider',
|
|
49
50
|
'UnwindFetchor' => 'Gnip crawler',
|
|
50
51
|
'WordPress' => 'WordPress spider',
|
|
52
|
+
'YandexAccessibilityBot' => 'Yandex accessibility spider',
|
|
51
53
|
'YandexBot' => 'Yandex spider',
|
|
54
|
+
'YandexMobileBot' => 'Yandex mobile spider',
|
|
52
55
|
'ZIBB' => 'ZIBB spider',
|
|
53
56
|
|
|
54
57
|
# HTTP libraries
|
|
@@ -71,12 +74,16 @@ module Split
|
|
|
71
74
|
'bitlybot' => 'bit.ly bot',
|
|
72
75
|
'bot@linkfluence.net' => 'Linkfluence bot',
|
|
73
76
|
'facebookexternalhit' => 'facebook bot',
|
|
77
|
+
'Facebot' => 'Facebook crawler',
|
|
74
78
|
'Feedfetcher-Google' => 'Google Feedfetcher',
|
|
75
79
|
'https://developers.google.com/+/web/snippet' => 'Google+ Snippet Fetcher',
|
|
80
|
+
'LinkedInBot' => 'LinkedIn bot',
|
|
76
81
|
'LongURL' => 'URL expander service',
|
|
77
82
|
'NING' => 'NING - Yet Another Twitter Swarmer',
|
|
83
|
+
'Pinterest' => 'Pinterest Bot',
|
|
78
84
|
'redditbot' => 'Reddit Bot',
|
|
79
85
|
'ShortLinkTranslate' => 'Link shortener',
|
|
86
|
+
'Slackbot' => 'Slackbot link expander',
|
|
80
87
|
'TweetmemeBot' => 'TweetMeMe Crawler',
|
|
81
88
|
'Twitterbot' => 'Twitter URL expander',
|
|
82
89
|
'UnwindFetch' => 'Gnip URL expander',
|
|
@@ -212,6 +219,7 @@ module Split
|
|
|
212
219
|
@algorithm = Split::Algorithms::WeightedSample
|
|
213
220
|
@include_rails_helper = true
|
|
214
221
|
@beta_probability_simulations = 10000
|
|
222
|
+
@winning_alternative_recalculation_interval = 60 * 60 * 24 # 1 day
|
|
215
223
|
@redis = ENV.fetch(ENV.fetch('REDIS_PROVIDER', 'REDIS_URL'), 'redis://localhost:6379')
|
|
216
224
|
end
|
|
217
225
|
|