Open markbok opened 3 years ago
@markbok I was able to add the data-cookieconsent
data attribute to the GTM script tag by creating a Nuxt plugin.
// plugins/gtm.js
export default function({ app, beforeNuxtRender }) {
if (process.server) {
beforeNuxtRender(() => {
const gtmScript = app.head.script.find(s => s.hid == 'gtm-script');
gtmScript['data-cookieconsent'] = 'ignore';
});
}
}
// Add to plugins array
{ src: '~/plugins/gtm' }
Hi there,
I'm trying to use Cookiebot on my site along with your plugin.
In order to successfully use Cookiebot with Google Tag Manager, the data-cookieconsent value needs to be set to
ignore
on the GTM script. Is there a way to set this on your plugin? And if not, can you think of an alternative way to set it within Nuxt?Many thanks,
Mark