(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-T23JWDC'); // gtag basic snippet code do not change window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); // the gtag config function to configure the measurement/property ID on the gtag tracker with other avilable settings i.e cookieDomain auto that sets the _ga cookie on the Top Level Domain of the page. // the configuration function sends a default pageview hit to Google Analytics Meaurement/Property ID i.e UA-XXXXXXXXX-X. gtag('config', 'G-MWGFCYD345', { 'cookie_domain': 'auto', }); window.addEventListener('pushstate', function (e) { // the gtag config function to re-configure the measurement/property ID on the gtag tracker with other available settings i.e cookieDomain auto that sets the _ga cookie on the Top Level Domain of the page. // the configuration constructor sends a default pageview hit with the SPA journey change pageview to Google Analytics Meaurement/Property ID i.e UA-XXXXXXXXX-X. gtag('config', '{id}', { 'cookie_domain': 'auto', 'page_location': e.target.document.URL// to send the pageview with the new SPA changed URL }); }, false);