Jane Docs
Search…
GA Referrer Script
1
<!-- Global site tag (gtag.js) - Google Analytics -->
2
<script async src="https://www.googletagmanager.com/gtag/js?id={UA-Code}"></script>
3
<script>
4
window.dataLayer = window.dataLayer || [];
5
function gtag(){dataLayer.push(arguments);}
6
gtag('js', new Date());
7
8
gtag('config', '{UA-Code}');
9
var frameWindow;
10
var foundIframe = setInterval(function () {
11
frameWindow = document.getElementById('jane-menu');
12
if (frameWindow) {
13
frameWindow = frameWindow.contentWindow;
14
gtag('get', '{UA-Code}', 'client_id', function (clientId) {
15
frameWindow.postMessage(
16
{
17
messageType: 'initializeGa',
18
payload: {
19
clientId: clientId,
20
referrer: document.referrer
21
}
22
},
23
'https://www.iheartjane.com'
24
);
25
clearInterval(foundIframe);
26
});
27
}
28
}, 1000);
29
</script>
Copied!
Last modified 1mo ago
Copy link