Skip to content

Commit 14243f5

Browse files
committed
add view counting to homepage to do a/b testing
1 parent 1078e99 commit 14243f5

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

home.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
fetch('https://services.minbrowser.org/web-events/v1/collect', {
2+
method: 'post',
3+
headers: {
4+
'Content-Type': 'application/json'
5+
},
6+
body: JSON.stringify({
7+
os: getUserPlatform(),
8+
event: 'pageview',
9+
version: 'a'
10+
})
11+
})
12+
13+
Array.from(document.querySelectorAll('.download-button')).forEach(function(button) {
14+
button.addEventListener('click', function() {
15+
fetch('https://services.minbrowser.org/web-events/v1/collect', {
16+
method: 'post',
17+
headers: {
18+
'Content-Type': 'application/json'
19+
},
20+
body: JSON.stringify({
21+
os: getUserPlatform(),
22+
event: 'downloadbutton',
23+
version: 'a'
24+
})
25+
})
26+
})
27+
})

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ <h1 class="center-heading" style="color: black">Try Min Now</h1>
106106
</div>
107107

108108
<script src="downloadButton.js"></script>
109+
<script src="home.js"></script>
109110
</body>
110111

111112
</html>

0 commit comments

Comments
 (0)