-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
37 lines (34 loc) · 911 Bytes
/
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
<html>
<body>
<script src="./index.js"></script>
<div id="my-test">
<span>Side: <span id="label"></span></span>
<button id="myButton">Clicable</button>
</div>
<script>
window.ga = function(_, options){console.log('sent', options);};
var myTest = googleAnalyticsAB.create({
name: 'MY_TEST',
percentage: 100,
options: [
{
name: 'green-button',
weight: 1,
},
{
name: 'red-button',
weight: 1,
}
],
run: function(option) {
document.getElementById('label').innerHTML = `SIDE ${option.name}`;
var myButton = document.getElementById('myButton');
myButton.style.background = option.name === 'green-button' ? '#0F0' : '#F00';
myButton.addEventListener('click', function(ev) {
option.convert();
});
}
});
</script>
</body>
</html>