mcurry / ab_test Goto Github PK
View Code? Open in Web Editor NEWA/B Test Plugin for CakePHP
Home Page: http://www.pseudocoder.com
A/B Test Plugin for CakePHP
Home Page: http://www.pseudocoder.com
/* * CakePHP A/B Test Plugin * Copyright (c) 2011 Matt Curry * www.PseudoCoder.com * http://github.com/mcurry/ab_test * * @author Matt Curry <[email protected]> * @license MIT * */ /* Description */ A plugin to for doing A/B and Multivariate testing in CakePHP apps. Tested on CakePHP 1.3.7 /* Instructions */ 1. Download the plugin to app/plugins/ab_test. 2. Run /ab_test/config/sql ab_test.sql to create the database tables. 3. Include the component in your controller (this will also include the helper automatically): var $components = array('AbTest.AbTest'); 4. Define your tests in bootstrap.php Configure::write('AbTest', array('test-name' => array('options' => array('new' => true, 'returning' => true), 'variates' => array('option-name-1', 'option-name-2')))); 5. Create elements for each of the variates in /app/views/elements/ab_tests/test-name For example using the test defined in step 4 your should have 2 files: /app/views/elements/ab_tests/test-name/option-name-1.ctp /app/views/elements/ab_tests/test-name/option-name-2.ctp 6. In your view, where the test option will appear: <?php echo $abTest->render('test-name'); ?> This will render either option-name-1.ctp or option-name-2.ctp in that spot. The options are shown evenly and a cookie is set, so that returning users will see the same one. 7. When a "conversion" happens track it with: $this->AbTest->conversion('test-name'); For example you could put this in your controller after a successful signup. /* Test Results */ There is no "admin" for this plugin. The DB schema is pretty simple and you could easily open up your favorite DB client and see the results. OR Install the CakePHP Status Plugin (http://github.com/mcurry/status) and include the panel: Configure::write('Status.panels', array('AbTest.stats')); /* Advanced */ 1. Which option the user is shown may affect how the user is handled. For example if you split test two different prices you want to make sure to charge them the right price. In your controller call $this->AbTest->variate('test-name'); and it will return the option-name for that user. For example: switch($this->AbTest->variate('price-test')) { default: case 'year-15': $price = 15; case 'year-20': $price = 20; } 2. There is no limit to the number of tests/options. Create as many elements as you'd like and add the names to the array in bootstrap.php. Configure::write('AbTest', array('test-name-1' => array('variates' => array('option-name-1-1', 'option-name-1-2'))), array('test-name-2' => array('variates' => array('option-name-2-1', 'option-name-2-2', 'option-name-2-3', 'option-name-2-4'))));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.