split 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +12 -1
- data/lib/split/user.rb +8 -2
- data/lib/split/version.rb +1 -1
- data/spec/helper_spec.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75e3f5edc1fef8a1131b615f82d5ec12cac72c29
|
4
|
+
data.tar.gz: bd21bc8f80816d06b3e05532152525e81c54e018
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c3dc4cf24791918469b0c7677b63ea04510ff216c3cb46de2fffe82ebb77110d8ec94269dff6ee32fe20c49ff256c9dee304b07933116166ba91746ca486737
|
7
|
+
data.tar.gz: 51b7bceb61bb92b61abd0b35eae3f5b142f6e1b48341a4a9d1753a4853289fc998e1a60dc462c3b8bac53c71f231b050952ab3f89a69d175ec32e78f0e7f3e97
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -171,7 +171,7 @@ Any old unfinished experiment key will be deleted from the user's data storage i
|
|
171
171
|
|
172
172
|
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.
|
173
173
|
|
174
|
-
To stop this behaviour and allow users to participate in multiple experiments at once
|
174
|
+
To stop this behaviour and allow users to participate in multiple experiments at once set the `allow_multiple_experiments` config option to true like so:
|
175
175
|
|
176
176
|
```ruby
|
177
177
|
Split.configure do |config|
|
@@ -179,6 +179,17 @@ Split.configure do |config|
|
|
179
179
|
end
|
180
180
|
```
|
181
181
|
|
182
|
+
This will allow the user to participate in any number of experiments and belong to any alternative in each experiment. This has the possible downside of a variation in one experiment influencing the outcome of another.
|
183
|
+
|
184
|
+
To address this, setting the `allow_multiple_experiments` config option to 'control' like so:
|
185
|
+
```ruby
|
186
|
+
Split.configure do |config|
|
187
|
+
config.allow_multiple_experiments = 'control'
|
188
|
+
end
|
189
|
+
```
|
190
|
+
|
191
|
+
For this to work, each and every experiment you define must have an alternative named 'control'. This will allow the user to participate in multiple experiments as long as the user belongs to the alternative 'control' in each experiment. As soon as the user belongs to an alternative named something other than 'control' the user may not participate in any more experiments. Calling ab_test(<other experiments>) will always return the first alternative without adding the user to that experiment.
|
192
|
+
|
182
193
|
### Experiment Persistence
|
183
194
|
|
184
195
|
Split comes with three built-in persistence adapters for storing users and the alternatives they've been given for each experiment.
|
data/lib/split/user.rb
CHANGED
@@ -19,8 +19,14 @@ module Split
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def max_experiments_reached?(experiment_key)
|
22
|
-
|
23
|
-
|
22
|
+
if Split.configuration.allow_multiple_experiments == 'control'
|
23
|
+
experiments = active_experiments
|
24
|
+
count_control = experiments.values.count {|v| v == 'control'}
|
25
|
+
experiments.size > count_control
|
26
|
+
else
|
27
|
+
!Split.configuration.allow_multiple_experiments &&
|
28
|
+
keys_without_experiment(user.keys, experiment_key).length > 0
|
29
|
+
end
|
24
30
|
end
|
25
31
|
|
26
32
|
def cleanup_old_versions!(experiment)
|
data/lib/split/version.rb
CHANGED
data/spec/helper_spec.rb
CHANGED
@@ -191,6 +191,26 @@ describe Split::Helper do
|
|
191
191
|
expect(button_size_alt.participant_count).to eq(1)
|
192
192
|
end
|
193
193
|
|
194
|
+
it "should let a user participate in many experiment with one non-'control' alternative with allow_multiple_experiments = 'control'" do
|
195
|
+
Split.configure do |config|
|
196
|
+
config.allow_multiple_experiments = 'control'
|
197
|
+
end
|
198
|
+
groups = []
|
199
|
+
(0..100).each do |n|
|
200
|
+
alt = ab_test("test#{n}".to_sym, {'control' => (100 - n)}, {'test#{n}-alt' => n})
|
201
|
+
groups << alt
|
202
|
+
end
|
203
|
+
|
204
|
+
experiments = ab_user.active_experiments
|
205
|
+
expect(experiments.size).to be > 1
|
206
|
+
|
207
|
+
count_control = experiments.values.count { |g| g == 'control' }
|
208
|
+
expect(count_control).to eq(experiments.size - 1)
|
209
|
+
|
210
|
+
count_alts = groups.count { |g| g != 'control' }
|
211
|
+
expect(count_alts).to eq(1)
|
212
|
+
end
|
213
|
+
|
194
214
|
it "should not over-write a finished key when an experiment is on a later version" do
|
195
215
|
experiment.increment_version
|
196
216
|
ab_user = { experiment.key => 'blue', experiment.finished_key => true }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: split
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|