Closed kaboume closed 8 months ago
It seems like you haven't provided any Gtag ID in your configuration.
Can you please share a reproducible example?
The gtag ID is in the .env file :
PORT=3000
NITRO_PORT=3000
NUXT_PUBLIC_GTAG_ID=G-XXXXXXX
For information, if I remove the "initialConsent: false," in the nuxt.config, everything works (I can see the tracing in Google Analytics)
The usage seems fine and should work as intended. But without a reproduction, I can't help you. Can please create one?
Please use a template below to create a minimal reproduction: 👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz 👉 https://codesandbox.io/p/github/nuxt/starter/v3-codesandbox
Edit: Can you ensure that the ID is present inside your open dialog function:
const { gtag } = useRuntimeConfig().public
console.log(gtag)
It happens to me also... pretty much the same setup
It happens to me also.
gtag: {
initialConsent: false,
},
I provide GTAG id from env vars
I have added a console error if no Gtag ID is provided: https://github.com/johannschopplich/nuxt-gtag/commit/59a63b3 (released with v1.1.2).
@kaboume @rcerljenko @jakudlaty Please create a reproducible example. Without it, I'm unable to help, since different deployment configurations means different ways to read your environment configuration. As far as my testing goes, the useHead
call correctly adds the gtag.js
to the DOM.
Environment
Reproduction
See Describe the bug
Describe the bug
Hi, I'm using a consent dialog to activate the analytics tracing.
My nuxt.config :
My layout file :
When a user accept consent, the grandConsentf() function is called but nothing is sent to Google Analytics.
For information, if I remove the "initialConsent: false," in the nuxt.config, everything works.
did I do something wrong?
Additional context
No response
Logs
No response