-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nsng 593 gtm #22
base: main
Are you sure you want to change the base?
Nsng 593 gtm #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now it doesn't work without valid NUXT_APP_GTM_ID
500 - '' is not a valid GTM-ID
nuxt.config.ts
Outdated
@@ -29,11 +28,22 @@ export default defineNuxtConfig({ | |||
apiUrl: process.env.NUXT_API_URL, | |||
}, | |||
}, | |||
gtm: { | |||
id: process.env.NUXT_APP_GTM_ID || '', | |||
enabled: true, // Enable GTM tracking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disable on develop? or settrue
only if ess.env.NUXT_APP_GTM_ID
is not empty? (just an idea)
@@ -29,11 +28,22 @@ export default defineNuxtConfig({ | |||
apiUrl: process.env.NUXT_API_URL, | |||
}, | |||
}, | |||
gtm: { | |||
id: process.env.NUXT_APP_GTM_ID || '', | |||
enabled: process.env.NUXT_APP_GTM_ID === 'true' ? true : false, // Enable GTM tracking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@igor-kamil could not come up with anything better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enabled: process.env.NUXT_APP_GTM_ID === 'true' ? true : false, // Enable GTM tracking | |
enabled: process.env.NUXT_APP_GTM_ENABLED === 'true' ? true : false, // Enable GTM tracking |
would be better 😂
however enabled
doesn't seems to really work anyway. I've found this workaround
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I am not sure, whether @zadigetvoltaire/nuxt-gtm
is a good choice.
apparently not maintained anymore. Also it breaks the app (=returns 500) until you define the GTM ID (what will make it impossible even to run tests).
Also it seems to be not such a big deal to implement it without any package -> https://scripts.nuxt.com/scripts/tracking/google-tag-manager
But to sum it up - I consider it as your project and as an owner you can still merge this (please just accept the suggestion - right now you don't use NUXT_APP_GTM_ENABLED
in the code at all).
Otherwise I suggest to implement it without requiring to set GTM_ID
@@ -29,11 +28,22 @@ export default defineNuxtConfig({ | |||
apiUrl: process.env.NUXT_API_URL, | |||
}, | |||
}, | |||
gtm: { | |||
id: process.env.NUXT_APP_GTM_ID || '', | |||
enabled: process.env.NUXT_APP_GTM_ID === 'true' ? true : false, // Enable GTM tracking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enabled: process.env.NUXT_APP_GTM_ID === 'true' ? true : false, // Enable GTM tracking | |
enabled: process.env.NUXT_APP_GTM_ENABLED === 'true' ? true : false, // Enable GTM tracking |
would be better 😂
however enabled
doesn't seems to really work anyway. I've found this workaround
Needs to be tested and consulted