Git Product home page Git Product logo

ab's People

Contributors

hpatoio avatar hzarka avatar muitsfriday avatar odino avatar pborreli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ab's Issues

A way to set predefined variation

I need a way to set the variation manually. Here is my original code:

class SplitTestService
{
    const COOKIE_NAME = 'ab_seed';

    protected $container;


    public function __construct()
    {
        $this->container = new Container();

        $this->setSeed();
    }

    public function getHomepageVariation(): string
    {
        return tap(new Test('homepage'), function (Test $test) {
            $this->container->add($test);

            $test->setVariations([
                SplitTests::HOMEPAGE_DEFAULT => 7,
                SplitTests::HOMEPAGE_NEW => 3
            ]);
        })->getVariation();
    }

    private function setSeed(): void
    {
        $seed = request()->cookie(self::COOKIE_NAME);

        if (!$seed) {
            $seed = mt_rand();

            Cookie::queue(self::COOKIE_NAME, (string)$seed);
        }

        $this->container->setSeed($seed);
    }
}

But now in order to ease the development and testing I need to preset the variation from GET variable, something like this:

        return tap(new Test('homepage'), function (Test $test) {
            $this->container->add($test);

            $test->setVariations([
                SplitTests::HOMEPAGE_DEFAULT => 7,
                SplitTests::HOMEPAGE_NEW => 3
            ]);

            // a code to pre-set variation if the specific request variable is passed
            if (!App::environment('production') && ($homepageVariation = request()->query('homepage-variation'))) {
                $test->setVariation('b' === $homepageVariation ? SplitTests::HOMEPAGE_NEW : SplitTests::HOMEPAGE_DEFAULT);
            }
        })->getVariation();

What do you think of it @odino ?

Same variation in seed

Hi,
test work well, but when i add seed to container it use only 2 type of variation, all first on last test choices, hereby the code:

    if (!$session->get('seed')) {
        $session->set('seed', mt_rand());
    }

    $abt = new Container(array(
        new Test('promo_code.layout', array(
            'TestAB:step1a.html.twig' => 1,
            'TestAB:step1b.html.twig'   => 1,
        )),
        new Test('promo_code.text', array(
            'Discount code'    => 1,
            'Promo code'     => 1,
        )),
        new Test('promo_code.button', array(
            'button'    => 1,
            'arrow'     => 1,
        )),
    ), $session->get('seed'));

    echo "seed: ".$session->get('seed');

What can be the issue? Thanks

So does it evenly cycle?

I need to try to have as close as possible the same amount of viewers to each content so that I can properly chart the data. If I have 100 visitors, it would be ideal if 50 saw Content A and 50 saw Content B. Does your solution do this out of the box?

retrieve test variation id

Hi all,
is there a way to retrieve variation id for a test?

$test = new Test('homepage_color', array(
'white' => 1,
'black' => 1,
'yellow' => 1,
));

$test->getVariation(); // black

$test->getVariationId(); // 2

It should be useful in case of multivariation test to obtain a cross test unique id (tracking + analytics purpose).

Thanks,
Fabio

No lisence statement

Hi,
I would like to use this nice code in our company, but I confuse because there is no license statement.
Can I use this code for commercial purpose?
We are not going to re-distribute, just only use and customize the code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.