I've made a page in Svelte and added Google Analytics. I have some mess in my code, because in index.html file I have link
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX">
And in main.js file I have code like this
window.dataLayer = window.dataLayer || []
function gtag () {
window.dataLayer.push(arguments)
}
gtag('js', new Date())
gtag('config', 'G-XXXXXXXXXX')
I want to disable Google Analytics in development mode. I've tried to use
window['ga-disable-GA_MEASUREMENT_ID'] = true;, package called gtag-opt-in, but none of this solution helped me.
I'll be grateful for some simple and working solution.
maybe this is not technical solution on programming side, but you can try to add this extension on your Google Chrome :
https://chrome.google.com/webstore/detail/developer-cookie/lknhpplgahpbindnnocglcjonpahfikn
it will "pause" Google or other analytic tools to counting any data when you activate this extension.
let me know if this can help :)