-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
38 lines (31 loc) · 1.04 KB
/
index.html
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
<html lang="zh_CN">
<head>
<title>Adhoc AbTestDemo</title>
<!-- Include Adhoc javascript library -->
<script src='http://www.appadhoc.com/downloads/web/adhoc.min.js'></script>
</head>
<!-- Please substitude ADHOC_50000000000000ad80c23462 with your AdhocAppKey -->
<body onload="adhoc.init('ADHOC_50000000000000ad80c23462')">
<!-- Use experiment flags to implement A/B versions -->
<div id="flags"></div>
<script>
function applyFlags(flags) {
var text = JSON.stringify(flags);
if (flags.hasOwnProperty('testFlag') && flags.testFlag) {
text = text + " 用户看到测试中的B版本";
} else {
text = text + " 用户看到标准A版本";
}
document.getElementById('flags').innerHTML = text;
}
</script>
<!-- Get experiment flags -->
<p>
<button href="" onclick="adhoc.getExperimentFlags(applyFlags)">测试获得模块开关</button>
</p>
<!-- Report stats -->
<p>
<button href="" onclick="adhoc.incrementStat('clicks', 1)">统计点击次数</button>
</p>
</body>
</html>