johannschopplich / nuxt-gtag

🔸 Google Tag integration for Nuxt: Google Analytics, Google Ads and more

Home Page:https://developers.google.com/tag-platform/gtagjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable tracking while in development

hslee2008 opened this issue · comments

Describe the feature

Maybe in nuxt.config.ts, define disableDuringDevelopment module option to disable gtag tracking during development.

I'm not sure if there is any other ways of doing this, so if you know how to disable tracking with another way, please tell me.

Additional information

  • Would you be willing to help implement this feature?
  • Can you think of other implementations of this feature?

Final checks

What about you keep the id property if the module configuration empty and add the Gtag ID via a runtime config variable only in production? Does this solve your issue?

// Only add this in production
NUXT_PUBLIC_GTAG_ID=G-XXXXXXXXXX

Oh! I guess that is the best way. Thank you.