heyday/silverstripe-abtesting

该包最新版本(0.2.0)没有提供许可证信息。

Google Analytics A/B Testing in SilverStripe

安装: 29

依赖: 0

建议: 0

安全: 0

星标: 6

关注者: 25

分支: 1

公开问题: 1

类型:silverstripe-module

0.2.0 2015-10-08 22:09 UTC

README

安装(使用composer)

$ composer require heyday/silverstripe-abtesting:0.2.0

For 2.4 see the tag 0.1.7

用法

将以下内容添加到您的SilverStripe模板根级别的Page中

<% if ABTestScript %>
	$ABTestScript
<% else %>
	<% if SiteConfig.ABTestGlobalScript %>
		$SiteConfig.ABTestGlobalScript
	<% end_if %>
<% end_if %>

使用ABTestingExtension装饰您想要测试的对象/页面

class Page_Controller extends ContentController
{
    public static $extensions = array(
        "ABTestingExtension('a','b')"
    );
}

设置测试的变体

对于SilverStripe 2.4

<% if getABTesting(st_b) %>
// State for b
<% else %>
// State for default
<% end_if %>

对于SilverStripe 3

<% if getABTesting(st,b) %>
// State for b
<% else %>
// State for default
<% end_if %>

其中 st 是一个GET变量,如 /?st=b

单元测试

$ composer install --dev
$ vendor/bin/phpunit