Jane Docs 1.0
Search…
⌃K

GA Referrer Script

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={UA-Code}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{UA-Code}');
var frameWindow;
var foundIframe = setInterval(function () {
frameWindow = document.getElementById('jane-menu');
if (frameWindow) {
frameWindow = frameWindow.contentWindow;
gtag('get', '{UA-Code}', 'client_id', function (clientId) {
frameWindow.postMessage(
{
messageType: 'initializeGa',
payload: {
clientId: clientId,
referrer: document.referrer
}
},
'https://www.iheartjane.com'
);
clearInterval(foundIframe);
});
}
}, 1000);
</script>
Last modified 1yr ago