2017 © Pedro Peláez
 

yii2-extension yii2-abtest

A generic A/B test handler for Yii2

image

sammaye/yii2-abtest

A generic A/B test handler for Yii2

  • Friday, November 18, 2016
  • by Sammaye
  • Repository
  • 1 Watchers
  • 1 Stars
  • 51 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

yii2-abtest

A simple extension for writing A/B Tests in Yii2., (*1)

This extension does not include the hooks for various programs, but does allow you to list() so you can quickly add it to your analytics code., (*2)

Installing

Simply include it from composer:, (*3)

php ./composer.phar require sammaye/yii2-abtest:"@stable"

Adding it to your configuration

Easiest thing is to just show an example of my configuration:, (*4)

'test' => [
    'class' => 'sammaye\abtest\Test',
    'filter' => [
        'rules' => [
            [
                'allow' => false,
                'roles' => ['staff']
            ]
        ]
    ],
    'tests' => [
        [
            'name' => 'Beta Search',
            'values' => ['old', 'new'],
            'default' => 'new'
        ]
    ]
],

The configuration breaks down into two parameters:- filter and tests., (*5)

Only tests is required., (*6)

filter allows you to use the AccessControl like you would on any controller and provide a set of rules whereby the tests should not take effect., (*7)

When an 'allow' => false filter is matched the test will return the default parameter from the test you are looking at and will not not record it in $_SESSION., (*8)

This way, when you come to list() at the end of the page to push onwards for analytics, these tests will not appear in that list., (*9)

Using it

Once it is fully configured you can just use it to detect which path a user takes:, (*10)

Yii::$app->test->value('Beta Search')

This function will return either old or new depending on whether I am a staff member or lady random chooses me., (*11)

In order to add it to your analytics code you need to list all active tests and their values:, (*12)

Yii::$app->test->list()

This will then print out a list of (for me):, (*13)

[
    'Old Search' => [
        'name' => 'Old Search',
        'value' => 'old' // active
        // custom data could be housed 
        // here from the configuration like "goal"
    ]
]

So, the key is name of the test and the value is the configuration object but with values replaced with only the active value., (*14)

The Versions

18/11 2016

dev-master

9999999-dev

A generic A/B test handler for Yii2

  Sources   Download

The Requires

  • php >=5.4.0

 

test yii2 ab

18/11 2016

2.0.0

2.0.0.0

A generic A/B test handler for Yii2

  Sources   Download

The Requires

  • php >=5.4.0

 

test yii2 ab

03/11 2016

1.4.0

1.4.0.0

A generic A/B test handler for Yii2

  Sources   Download

The Requires

  • php >=5.4.0

 

test yii2 ab

03/11 2016

1.3.0

1.3.0.0

A generic A/B test handler for Yii2

  Sources   Download

The Requires

  • php >=5.4.0

 

test yii2 ab

03/11 2016

1.2.0

1.2.0.0

A generic A/B test handler for Yii2

  Sources   Download

The Requires

  • php >=5.4.0

 

test yii2 ab

03/11 2016

1.1.0

1.1.0.0

A generic A/B test handler for Yii2

  Sources   Download

The Requires

  • php >=5.4.0

 

test yii2 ab

03/11 2016

1.0.0

1.0.0.0

A generic A/B test handler for Yii2

  Sources   Download

The Requires

  • php >=5.4.0

 

test yii2 ab