ambitiondev / cookiebot

Composable to use Cookiebot functionality in your Vue or Nuxt application,
https://vue-nuxt-cookiebot.netlify.app/
MIT License
5 stars 0 forks source link

How to control when the script is loaded? (Combine cookiebot with gtag) #17

Closed StijnCoolen closed 4 months ago

StijnCoolen commented 4 months ago

I'm trying to get cookiebot to work with Google Analytics (through https://nuxt.com/modules/gtag) and the consent mode (https://support.cookiebot.com/hc/en-us/articles/360016047000-Implementing-Google-consent-mode#h_01HBWS079DZRM28JBSFD5W3S12). I can see that Cookiebot actually updates the dataLayer when consent changes, but the gtag scripts are not included in list of scripts that cookiebot has found.

GTM by default supports 7 different consent types that are automatically mapped by Cookiebot to the 4 categories used in Cookiebot CMP. I dont see anything Gtag related listed under the categories.

For cookiebot to pick up all the used scripts it needs to be loaded before the scripts it needs to pick up. Is there any way to control this?

bnachtweh commented 4 months ago

Thank you for your issue @StijnCoolen. I've created a test release in which I've increased the priority of the Cookiebot scripts to be loaded. Can you please install the next tag (3.2.1-alpha.0): npm install @ambitiondev/nuxt-cookiebot@next or yarn install @ambitiondev/nuxt-cookiebot@next

If the test release provides the expected result, I will promote it to a new latest release

StijnCoolen commented 4 months ago

@bnachtweh thanks for looking into this! Ufortunately I still do not see the gtag cookies listed in Cookiebot. Perhaps this is a https://nuxt.com/modules/gtag issue.

bnachtweh commented 4 months ago

@StijnCoolen can't say for certain. Can you provide a CodeSandbox or other reproduction project so I can do some further investigation?

bnachtweh commented 4 months ago

@StijnCoolen I'm closing the issue for now and updated the script priority to begin with. It seems like a good practice to do so anyway. Please let me know if I need to do some further digging regarding gtag relation.