document.addEventListener(‘DOMContentLoaded’, function() {
setTimeout(initGTM, 2500);
});
document.addEventListener(‘scroll’, initGTMOnEvent);
document.addEventListener(‘mousemove’, initGTMOnEvent);
document.addEventListener(‘touchstart’, initGTMOnEvent);
function initGTMOnEvent(event) {
initGTM();
event.currentTarget.removeEventListener(event.type, initGTMOnEvent);
}
function initGTM() {
if (window.gtmDidInit) {
return false;
}
window.gtmDidInit = true;
const script = document.createElement(‘script’);
script.type=”text/javascript”;
script.src=”https://www.googletagmanager.com/gtag/js?id=G-4GL2LLPR93″;
script.async = true;
script.onload = function() {
window.dataLayer = window.dataLayer || [];
gtag(‘js’, new Date());
gtag(‘config’, ‘G-4GL2LLPR93’);
};
document.head.appendChild(script);
}