Closed nandi95 closed 1 year ago
latest
set up module but don't set an id (happens in development)
The module only sets up with dataLayer on the window when the id has been set. https://github.com/johannschopplich/nuxt-gtag/blob/d307c78bae140393b15034cd06d4958ef4f0e87c/src/runtime/plugin.client.ts#L9-L12
The trackEvent etc expects the window.dataLayer to be set. https://github.com/johannschopplich/nuxt-gtag/blob/d307c78bae140393b15034cd06d4958ef4f0e87c/src/runtime/gtag.ts#L1-L4
This should not have that assertion and should have a check for the existence of the id or the dataLayer.
Am I missing something?
No response
Thanks for pointing that out!
Environment
latest
Reproduction
set up module but don't set an id (happens in development)
Describe the bug
The module only sets up with dataLayer on the window when the id has been set. https://github.com/johannschopplich/nuxt-gtag/blob/d307c78bae140393b15034cd06d4958ef4f0e87c/src/runtime/plugin.client.ts#L9-L12
The trackEvent etc expects the window.dataLayer to be set. https://github.com/johannschopplich/nuxt-gtag/blob/d307c78bae140393b15034cd06d4958ef4f0e87c/src/runtime/gtag.ts#L1-L4
This should not have that assertion and should have a check for the existence of the id or the dataLayer.
Am I missing something?
Additional context
No response
Logs
No response