Skip to content

Commit 7aafec6

Browse files
author
André Ekeberg
committed
Version 1.1.0
1 parent e70cf71 commit 7aafec6

File tree

14 files changed

+205
-100
lines changed

14 files changed

+205
-100
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,24 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.1.0] - 2020-05-14
6+
7+
### Added
8+
9+
- Added [`User::hasViewed`](docs/User.md#userhasviewed)
10+
- Added [`User::setViewed`](docs/User.md#usersetviewed)
11+
12+
### Breaking changes
13+
14+
- Updated [`User::addExperiment`](docs/User.md#useraddexperiment) to include a `$viewed` argument before `$converted`
15+
- Renamed `Group::getSize` to [`Group::getViews`](docs/Group.md#groupgetviews)
16+
- Renamed `Group::setSize` to [`Group::setViews`](docs/Group.md#groupsetviews)
17+
- Renamed `Experiment::getCoverage` to [`Experiment::getAllocation`](docs/Experiment.md#experimentgetallocation)
18+
- Renamed `Experiment::setCoverage` to [`Experiment::setAllocation`](docs/Experiment.md#experimentsetallocation)
19+
520
## [1.0.0] - 2020-04-29
621

722
Initial release
823

24+
[1.1.0]: https://github.com/andreekeberg/abby/releases/tag/1.1.0
925
[1.0.0]: https://github.com/andreekeberg/abby/releases/tag/1.0.0

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing to Abby
22

3-
I want to make contributing to this project as easy and transparent as possible, whether it's:
3+
This document contains basic guidelines to make contributing to this project as easy and transparent as possible, whether it's:
44

55
- Reporting a bug
66
- Discussing the current state of the code
@@ -38,7 +38,7 @@ All bugs are tracked using GitHub issues to track public bugs. Report a bug by [
3838

3939
## Use a Consistent Coding Style
4040

41-
I'm using the automatic formatter in the [PHP Intelephense](https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client) Visual Studio Code extension.
41+
All code should follow the [PSR-12: Extended Coding Style](https://www.php-fig.org/psr/psr-12/)
4242

4343
* 4 spaces for indentation rather than tabs
4444
* Newlines after opening curly brackets in classes and methods

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 André Ekeberg
3+
Copyright (c) 2015-2020 André Ekeberg
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ $data = [
4848
[
4949
'id' => 1,
5050
'group' => 1,
51+
'viewed' => true,
5152
'converted' => false
5253
]
5354
];
@@ -64,9 +65,8 @@ foreach ($data as $item) {
6465
'type' => $item['group']
6566
]);
6667

67-
// Add the experiment (including their group and whether they have
68-
// already converted) to our user instance
69-
$user->addExperiment($experiment, $group, $item['converted']);
68+
// Add the experiment (including their group, and whether they have viewed and converted)
69+
$user->addExperiment($experiment, $group, $item['viewed'], $item['converted']);
7070
}
7171
```
7272

@@ -105,7 +105,10 @@ $data = [
105105
'id' => 1
106106
];
107107

108-
// If the user is part of the variation in our experiment
108+
// Record a view for the experiment in question
109+
$user->setViewed($data['id']);
110+
111+
// If the user is part of the variation group
109112
if ($user->inVariation($data['id'])) {
110113
// Apply a custom class to an element, load a script, etc.
111114
}
@@ -119,8 +122,8 @@ $data = [
119122
'id' => 1
120123
];
121124

122-
// On a custom experiment goal, check if user is a participant and define a conversion
123-
if ($user->isParticipant($data['id'])) {
125+
// On a custom goal, check if user has viewed the experiment and define a conversion
126+
if ($user->hasViewed($data['id'])) {
124127
$user->setConverted($data['id']);
125128
}
126129

@@ -138,12 +141,12 @@ $experiment = new Abby\Experiment([
138141
'groups' => [
139142
[
140143
'name' => 'Control',
141-
'size' => 3000,
144+
'views' => 3000,
142145
'conversions' => 300
143146
],
144147
[
145148
'name' => 'Variation',
146-
'size' => 3000,
149+
'views' => 3000,
147150
'conversions' => 364
148151
]
149152
]
@@ -157,18 +160,18 @@ $winner = $result->getWinner();
157160

158161
/**
159162
* Get whether we can be confident of the result (even if we haven't
160-
* reached the minimum group size for each variant)
163+
* reached the minimum number of views for each variant)
161164
*/
162165

163166
$confident = $result->isConfident();
164167

165168
/**
166-
* Get the minimum sample size required for each group to reach statistical
167-
* significance, given the control groups current conversion rate (based on
168-
* the configured minimumDetectableEffect)
169+
* Get the minimum sample size (number of views) required for each group to
170+
* reach statistical significance, given the control groups current conversion
171+
* rate (based on the configured minimumDetectableEffect)
169172
*/
170173

171-
$minimum = $result->getMinimumGroupSize();
174+
$minimum = $result->getMinimumSampleSize();
172175

173176
/**
174177
* Get whether the results are statistically significant

docs/Experiment.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ This class is in charge of managing your experiment, including configuring the n
1515
|[setControl](#experimentsetcontrol)|Define the control|
1616
|[getVariation](#experimentgetvariation)|Get the variation|
1717
|[setVariation](#experimentsetvariation)|Define the variation|
18-
|[getCoverage](#experimentgetcoverage)|Get experiment coverage|
19-
|[setCoverage](#experimentsetcoverage)|Set experiment coverage|
18+
|[getAllocation](#experimentgetallocation)|Get experiment allocation|
19+
|[setAllocation](#experimentsetallocation)|Set experiment allocation|
2020
|[getResult](#experimentgetresult)|Return a Result instance from the current experiment|
2121

2222
## Experiment::getID
@@ -240,15 +240,15 @@ Define the variation
240240

241241
<hr />
242242

243-
## Experiment::getCoverage
243+
## Experiment::getAllocation
244244

245245
**Description**
246246

247247
```php
248-
public getCoverage (void)
248+
public getAllocation (void)
249249
```
250250

251-
Get experiment coverage
251+
Get experiment allocation
252252

253253
This is the percentual chance that a new user will be included in the experiment
254254

@@ -262,15 +262,15 @@ This is the percentual chance that a new user will be included in the experiment
262262

263263
<hr />
264264

265-
## Experiment::setCoverage
265+
## Experiment::setAllocation
266266

267267
**Description**
268268

269269
```php
270-
public setCoverage (int $percent)
270+
public setAllocation (int $percent)
271271
```
272272

273-
Set experiment coverage
273+
Set experiment allocation
274274

275275
This is the percentual chance that a new user will be included in the experiment
276276

@@ -300,6 +300,4 @@ Return a Result instance from the current experiment
300300

301301
**Return Values**
302302

303-
`Result`
304-
305-
<hr />
303+
`Result`

docs/Group.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Group
22

3-
This class is in charge of creating and handling the control and variation groups of an experiment, including getting and setting their values such as group type, size, number of conversions, and whether the group is the winning or losing variant.
3+
This class is in charge of creating and handling the control and variation groups of an experiment, including getting and setting their values such as group type, numbers of views and conversions, and whether the group is the winning or losing variant.
44

55
| Name | Description |
66
|------|-------------|
@@ -9,8 +9,8 @@ This class is in charge of creating and handling the control and variation group
99
|[setValue](#groupsetvalue)|Set property value of group|
1010
|[getName](#groupgetname)|Get group name|
1111
|[setName](#groupsetname)|Set group name|
12-
|[getSize](#groupgetsize)|Get group size|
13-
|[setSize](#groupsetsize)|Set group size|
12+
|[getViews](#groupgetviews)|Get group views|
13+
|[setViews](#groupsetviews)|Set group views|
1414
|[getConversions](#groupgetconversions)|Get number of conversions for the group|
1515
|[setConversions](#groupsetconversions)|Set number of conversions for the group|
1616
|[getConversionRate](#groupgetconversionrate)|Get conversion rate for the group|
@@ -127,15 +127,15 @@ Set group name
127127

128128
<hr />
129129

130-
## Group::getSize
130+
## Group::getViews
131131

132132
**Description**
133133

134134
```php
135-
public getSize (void)
135+
public getViews (void)
136136
```
137137

138-
Get group size
138+
Get group views
139139

140140
**Parameters**
141141

@@ -147,19 +147,19 @@ Get group size
147147

148148
<hr />
149149

150-
## Group::setSize
150+
## Group::setViews
151151

152152
**Description**
153153

154154
```php
155-
public setSize (int $size)
155+
public setViews (int $views)
156156
```
157157

158-
Set group size
158+
Set group views
159159

160160
**Parameters**
161161

162-
* `(int) $size`
162+
* `(int) $views`
163163

164164
**Return Values**
165165

@@ -445,6 +445,4 @@ Define the group as the variation
445445

446446
**Return Values**
447447

448-
`self`
449-
450-
<hr />
448+
`self`

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Documentation
22

3-
Full documentation of all the available classes and methods
3+
Full documentation of all the available classes and methods.
44

55
* [Experiment](Experiment.md)
66
* [Token](Token.md)

docs/Result.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public isSignificant (void)
235235

236236
Return whether the result is statistically significant
237237

238-
This requires both the confidence (alternative hypothesis, i.e the inverse of the p-value) to be high enough (based on the specified minimum confidence) that the null hypothesis can be rejected, and the size of both groups to be greater than or equal to the minimum sample size (which is in turn calculated based on the minimum detectable effect, and the conversion rate of the control group)
238+
This requires both the confidence (alternative hypothesis, i.e the inverse of the p-value) to be high enough (based on the specified minimum confidence) that the null hypothesis can be rejected, and the number of views for both groups to be greater than or equal to the minimum sample size (which is in turn calculated based on the minimum detectable effect, and the conversion rate of the control group)
239239

240240
**Parameters**
241241

@@ -263,6 +263,4 @@ Get complete results
263263

264264
**Return Values**
265265

266-
`object`
267-
268-
<hr />
266+
`object`

docs/Token.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,4 @@ This sends a cookie to the users browser with the configured settings, but with
161161

162162
**Return Values**
163163

164-
`self`
165-
166-
<hr />
164+
`self`

docs/User.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ This class is in charge of managing your users, including associating them with
1414
|[addExperiment](#useraddexperiment)|Add an experiment to the user's list of experiments|
1515
|[shouldParticipate](#usershouldparticipate)|Determine is user should be a participant in an experiment|
1616
|[assignGroup](#userassigngroup)|Get a group that the user should be asssiged to|
17+
|[hasViewed](#userhasviewed)|Get whether a user has viewed a specific experiment|
18+
|[setViewed](#usersetviewed)|Set whether a user has viewed a specific experiment|
1719
|[hasConverted](#userhasconverted)|Get whether a user has converted in a specific experiment|
1820
|[setConverted](#usersetconverted)|Set whether a user has converted in a specific experiment|
1921

@@ -233,6 +235,49 @@ If the experiments coverage is below 100, it's percentage value will be used to
233235

234236
<hr />
235237

238+
## User::hasViewed
239+
240+
**Description**
241+
242+
```php
243+
public hasViewed (int $id)
244+
```
245+
246+
Get whether a user has viewed a specific experiment
247+
248+
**Parameters**
249+
250+
* `(int) $id`
251+
: Experiment ID
252+
253+
**Return Values**
254+
255+
`bool`
256+
257+
<hr />
258+
259+
## User::setViewed
260+
261+
**Description**
262+
263+
```php
264+
public setViewed (int $id, bool $viewed)
265+
```
266+
267+
Set whether a user has viewed a specific experiment
268+
269+
**Parameters**
270+
271+
* `(int) $id`
272+
: Experiment ID
273+
* `(bool) $viewed`
274+
275+
**Return Values**
276+
277+
`self`
278+
279+
<hr />
280+
236281
## User::hasConverted
237282

238283
**Description**
@@ -270,8 +315,4 @@ Set whether a user has converted in a specific experiment
270315
: Experiment ID
271316
* `(bool) $converted`
272317

273-
**Return Values**
274-
275-
`self`
276-
277-
<hr />
318+
**Return Values**

0 commit comments

Comments
 (0)