-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcheeztest-examples.php
49 lines (46 loc) · 1.13 KB
/
cheeztest-examples.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
// Here is an example test that you can use to get started.
// This test creates a test and a control group.
// The test group will get 30% of qualified users.
// The control group will get the remaining 70%.
$chrome_test = new CheezTest(
array(
'name' => 'chrome-ab',
'groups' => array(
'active' => array(
'threshold' => 30,
),
'control' => array(
'threshold' => 70,
)
),
'is_qualified' => 'return stripos( $_SERVER[ "HTTP_USER_AGENT" ], "Chrome" ) !== false;'
)
);
// This will display a fixed position bar at the bottom of the screen to users in the test condition (i.e. 30% of Chrome users)
if ( CheezTest::is_in_group( 'chrome-ab', 'active' ) ) {
add_action( 'wp_footer', function() {
?>
<div id="ab-chrome-bar">
<span>Howdy, Chrome user!</span>
</div>
<style>
#ab-chrome-bar {
z-index: 1001;
background: rgba( 33, 117, 155, 0.8 );
color: #ddd;
font-family: 'Helvetica Neue',Arial,Helvetica,sans-serif;
font-size:14px;
bottom: 0;
left: 0;
position:fixed;
margin:0;
padding: 0 20px;
width: 100%;
height: 28px;
line-height: 28px;
}
</style>
<?php
} );
}