Skip to content

Commit

Permalink
Version 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
André Ekeberg committed May 13, 2020
1 parent e70cf71 commit 7aafec6
Show file tree
Hide file tree
Showing 14 changed files with 205 additions and 100 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,24 @@

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

## [1.1.0] - 2020-05-14

### Added

- Added [`User::hasViewed`](docs/User.md#userhasviewed)
- Added [`User::setViewed`](docs/User.md#usersetviewed)

### Breaking changes

- Updated [`User::addExperiment`](docs/User.md#useraddexperiment) to include a `$viewed` argument before `$converted`
- Renamed `Group::getSize` to [`Group::getViews`](docs/Group.md#groupgetviews)
- Renamed `Group::setSize` to [`Group::setViews`](docs/Group.md#groupsetviews)
- Renamed `Experiment::getCoverage` to [`Experiment::getAllocation`](docs/Experiment.md#experimentgetallocation)
- Renamed `Experiment::setCoverage` to [`Experiment::setAllocation`](docs/Experiment.md#experimentsetallocation)

## [1.0.0] - 2020-04-29

Initial release

[1.1.0]: https://github.com/andreekeberg/abby/releases/tag/1.1.0
[1.0.0]: https://github.com/andreekeberg/abby/releases/tag/1.0.0
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to Abby

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

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

## Use a Consistent Coding Style

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

* 4 spaces for indentation rather than tabs
* Newlines after opening curly brackets in classes and methods
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 André Ekeberg
Copyright (c) 2015-2020 André Ekeberg

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ $data = [
[
'id' => 1,
'group' => 1,
'viewed' => true,
'converted' => false
]
];
Expand All @@ -64,9 +65,8 @@ foreach ($data as $item) {
'type' => $item['group']
]);

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

Expand Down Expand Up @@ -105,7 +105,10 @@ $data = [
'id' => 1
];

// If the user is part of the variation in our experiment
// Record a view for the experiment in question
$user->setViewed($data['id']);

// If the user is part of the variation group
if ($user->inVariation($data['id'])) {
// Apply a custom class to an element, load a script, etc.
}
Expand All @@ -119,8 +122,8 @@ $data = [
'id' => 1
];

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

Expand All @@ -138,12 +141,12 @@ $experiment = new Abby\Experiment([
'groups' => [
[
'name' => 'Control',
'size' => 3000,
'views' => 3000,
'conversions' => 300
],
[
'name' => 'Variation',
'size' => 3000,
'views' => 3000,
'conversions' => 364
]
]
Expand All @@ -157,18 +160,18 @@ $winner = $result->getWinner();

/**
* Get whether we can be confident of the result (even if we haven't
* reached the minimum group size for each variant)
* reached the minimum number of views for each variant)
*/

$confident = $result->isConfident();

/**
* Get the minimum sample size required for each group to reach statistical
* significance, given the control groups current conversion rate (based on
* the configured minimumDetectableEffect)
* Get the minimum sample size (number of views) required for each group to
* reach statistical significance, given the control groups current conversion
* rate (based on the configured minimumDetectableEffect)
*/

$minimum = $result->getMinimumGroupSize();
$minimum = $result->getMinimumSampleSize();

/**
* Get whether the results are statistically significant
Expand Down
20 changes: 9 additions & 11 deletions docs/Experiment.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ This class is in charge of managing your experiment, including configuring the n
|[setControl](#experimentsetcontrol)|Define the control|
|[getVariation](#experimentgetvariation)|Get the variation|
|[setVariation](#experimentsetvariation)|Define the variation|
|[getCoverage](#experimentgetcoverage)|Get experiment coverage|
|[setCoverage](#experimentsetcoverage)|Set experiment coverage|
|[getAllocation](#experimentgetallocation)|Get experiment allocation|
|[setAllocation](#experimentsetallocation)|Set experiment allocation|
|[getResult](#experimentgetresult)|Return a Result instance from the current experiment|

## Experiment::getID
Expand Down Expand Up @@ -240,15 +240,15 @@ Define the variation

<hr />

## Experiment::getCoverage
## Experiment::getAllocation

**Description**

```php
public getCoverage (void)
public getAllocation (void)
```

Get experiment coverage
Get experiment allocation

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

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

<hr />

## Experiment::setCoverage
## Experiment::setAllocation

**Description**

```php
public setCoverage (int $percent)
public setAllocation (int $percent)
```

Set experiment coverage
Set experiment allocation

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

Expand Down Expand Up @@ -300,6 +300,4 @@ Return a Result instance from the current experiment

**Return Values**

`Result`

<hr />
`Result`
24 changes: 11 additions & 13 deletions docs/Group.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Group

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.
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.

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

<hr />

## Group::getSize
## Group::getViews

**Description**

```php
public getSize (void)
public getViews (void)
```

Get group size
Get group views

**Parameters**

Expand All @@ -147,19 +147,19 @@ Get group size

<hr />

## Group::setSize
## Group::setViews

**Description**

```php
public setSize (int $size)
public setViews (int $views)
```

Set group size
Set group views

**Parameters**

* `(int) $size`
* `(int) $views`

**Return Values**

Expand Down Expand Up @@ -445,6 +445,4 @@ Define the group as the variation

**Return Values**

`self`

<hr />
`self`
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Documentation

Full documentation of all the available classes and methods
Full documentation of all the available classes and methods.

* [Experiment](Experiment.md)
* [Token](Token.md)
Expand Down
6 changes: 2 additions & 4 deletions docs/Result.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public isSignificant (void)

Return whether the result is statistically significant

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)
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)

**Parameters**

Expand Down Expand Up @@ -263,6 +263,4 @@ Get complete results

**Return Values**

`object`

<hr />
`object`
4 changes: 1 addition & 3 deletions docs/Token.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,4 @@ This sends a cookie to the users browser with the configured settings, but with

**Return Values**

`self`

<hr />
`self`
51 changes: 46 additions & 5 deletions docs/User.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ This class is in charge of managing your users, including associating them with
|[addExperiment](#useraddexperiment)|Add an experiment to the user's list of experiments|
|[shouldParticipate](#usershouldparticipate)|Determine is user should be a participant in an experiment|
|[assignGroup](#userassigngroup)|Get a group that the user should be asssiged to|
|[hasViewed](#userhasviewed)|Get whether a user has viewed a specific experiment|
|[setViewed](#usersetviewed)|Set whether a user has viewed a specific experiment|
|[hasConverted](#userhasconverted)|Get whether a user has converted in a specific experiment|
|[setConverted](#usersetconverted)|Set whether a user has converted in a specific experiment|

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

<hr />

## User::hasViewed

**Description**

```php
public hasViewed (int $id)
```

Get whether a user has viewed a specific experiment

**Parameters**

* `(int) $id`
: Experiment ID

**Return Values**

`bool`

<hr />

## User::setViewed

**Description**

```php
public setViewed (int $id, bool $viewed)
```

Set whether a user has viewed a specific experiment

**Parameters**

* `(int) $id`
: Experiment ID
* `(bool) $viewed`

**Return Values**

`self`

<hr />

## User::hasConverted

**Description**
Expand Down Expand Up @@ -270,8 +315,4 @@ Set whether a user has converted in a specific experiment
: Experiment ID
* `(bool) $converted`

**Return Values**

`self`

<hr />
**Return Values**
Loading

0 comments on commit 7aafec6

Please sign in to comment.