Skip to content

Commit

Permalink
fix(cookie-consent): prevent multiple cookieconsent registering
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-mulier-p committed Mar 19, 2024
1 parent 5a805c0 commit be9d120
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions plugins/cookieconsent.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import axios from "axios";

export default defineNuxtPlugin(nuxtApp => {
const isEurope = Intl.DateTimeFormat().resolvedOptions().timeZone.indexOf("Europe") === 0;
const cookieConsent = CookieConsent;
nuxtApp.provide("cookieConsent", cookieConsent);

nuxtApp.hook('page:finish', () => {
const {initialize} = useGtag()
Expand Down Expand Up @@ -35,9 +37,6 @@ export default defineNuxtPlugin(nuxtApp => {
posthog.capture('$pageview');
};


const cookieConsent = CookieConsent;
nuxtApp.provide("cookieConsent", cookieConsent);
const enabledMarketing = () => {
return cookieConsent.loadScript('https://js-eu1.hs-scripts.com/27220195.js',{defer: "defer"});
};
Expand Down

0 comments on commit be9d120

Please sign in to comment.