PHPackages                             pop/winston - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. pop/winston

ActiveLibrary[Testing &amp; Quality](/categories/testing)

pop/winston
===========

Winston is a AB/split/multivariate testing library utilizing redis and a basic machine learning algorithm for automatically displaying the most successful test variations.

36413PHP

Since Aug 14Pushed 11y ago7 watchersCompare

[ Source](https://github.com/popdotco/winston)[ Packagist](https://packagist.org/packages/pop/winston)[ RSS](/packages/pop-winston/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

About Winston
=============

[](#about-winston)

Winston is a AB/split testing library which utilizes Redis and basic machine learning. At it's core, Winston is a configurable roll-your-own A/B testing tool. Winston comes with several flavors of AB testing out of the box based on user-defined configuration options.

Features
--------

[](#features)

- Supports machine learning so you can set and forget variations and let Winston determine the best one.
- Supports split testing (multiple tests per page at once)
- Supports client side javascript events as well as code-triggered events
- Minimal bloat to your codebase
- Highly configurable
- Composer based

#### Winston and Machine Learning

[](#winston-and-machine-learning)

You can optionally tell Winston whether you'd like to enable machine learning algorithm or not. If it's enabled, Winston performs the following:

1. It first checks if a test is reliably a favorite via confidence intervals.
2. If a test has no clear favorite, Winston decides on one of the following execution paths:
    1. It falls back to picking a random test variation a certain percentage of the time *(defaults to 10%)*
    2. It picks the current top performing variant the remaining percentage of the time *(defaults to 90%)*.
    3. If no test variations have any data collected, Winston will always pick at random.

The goal of Winston is to take the guess work out of displaying a top performing test variation. It's a set and forget operation on your part and Winston takes care of the rest. The default random percentages are entirely configurable.

Usage
-----

[](#usage)

Winston installation and setup is comprised of three core parts. Below is an overview of the three parts followed by details on configuring each of the parts.

1. *Configuration:*
    You need to setup your Winston configuration file settings to your liking and create tests and variations. You can store your configuration settings however you want (array, JSON, Yaml, database, key/val store) so long as you can convert the settings to a properly formatted array when initializing Winston.
2. *Client Side Code:*
    You need to add code to your client facing frontend website to display variations and track performance.
3. *Server Side Code:*
    You need to create a new server side file (a controller route and action if you use MVC) which you grant Winston access to POST data to. There are two specific API endpoints you'll need for Winston which ultimately load an instance of Winston and call the following:
    1. `$winston->recordEvent($_POST);`
    2. `$winston->recordPageview($_POST);`

#### Configuration

[](#configuration)

Winston requires a fairly lengthy configuration array of settings, tests, and test variations. For a full picture of what a configuration array looks like, check out the basic example config file:

#### Client Side Code

[](#client-side-code)

This example uses short tags, but you don't have to if they aren't enabled. In this example, we're checking to see if varying the page's headline/tagline has any affect on the frequency of clicking a button directly below it.

```
