-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
45 lines (38 loc) · 1.09 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
39
40
41
42
43
44
45
<html>
<head>
<style>
body {
background: none transparent;
}
</style>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('set', {cookie_flags: 'SameSite=None;Secure'});
var initialized = false;
function setup(id) {
var el = document.createElement('script')
el.src = 'https://www.googletagmanager.com/gtag/js?id=' + id
document.head.prepend(el);
initialized = true;
}
function onMessage(e) {
try {
var data = JSON.parse(e.data);
if (data.type === 'gtag') {
if (!initialized && data.payload && data.payload[0] === 'config') {
setup(data.payload[1])
}
gtag.apply(null, data.payload);
}
} catch {
}
}
window.addEventListener("message", onMessage)
</script>
</head>
<body></body>
</html>