heyday / silverstripe-abtesting
There is no license information available for the latest version (0.2.0) of this package.
Google Analytics A/B Testing in SilverStripe
Package info
github.com/heyday/silverstripe-abtesting
Type:silverstripe-module
pkg:composer/heyday/silverstripe-abtesting
0.2.0
2015-10-08 22:09 UTC
Requires (Dev)
- phpunit/phpunit: ~3.7
- silverstripe/framework: ~2.4
- symfony/class-loader: ~2.2
This package is auto-updated.
Last update: 2026-03-01 00:20:41 UTC
README
Installation (with composer)
$ composer require heyday/silverstripe-abtesting:0.2.0
For 2.4 see the tag 0.1.7
Usage
Add the following to your root level Page SilverStripe template
<% if ABTestScript %> $ABTestScript <% else %> <% if SiteConfig.ABTestGlobalScript %> $SiteConfig.ABTestGlobalScript <% end_if %> <% end_if %>
Decorate the object/page you wish to test with the ABTestingExtension
class Page_Controller extends ContentController { public static $extensions = array( "ABTestingExtension('a','b')" ); }
Set up the variations for the test
For SilverStripe 2.4
<% if getABTesting(st_b) %> // State for b <% else %> // State for default <% end_if %>
For SilverStripe 3
<% if getABTesting(st,b) %> // State for b <% else %> // State for default <% end_if %>
Where st is a GET variable like /?st=b
Unit testing
$ composer install --dev
$ vendor/bin/phpunit