heyday / silverstripe-abtesting
该包最新版本(0.2.0)没有提供许可证信息。
Google Analytics A/B Testing in SilverStripe
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: 2024-08-29 04:14:24 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