Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Nsng 593 gtm #22

wants to merge 4 commits into from

Conversation

FrantisekMichalSebestyen
Copy link
Contributor

Needs to be tested and consulted

Copy link
Member

@igor-kamil igor-kamil left a 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
Copy link
Member

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
Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Member

@igor-kamil igor-kamil left a 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants