diff --git a/astro.config.mjs b/astro.config.mjs index 2f694a6..739558d 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,14 +1,20 @@ import { defineConfig } from 'astro/config'; - import tailwind from "@astrojs/tailwind"; +import partytown from "@astrojs/partytown"; + // https://astro.build/config export default defineConfig({ - devToolbar: { enabled: false }, - integrations: [ - tailwind({ - applyBaseStyles: false, - }), - ], - base: process.env.BASE_URL ? process.env.BASE_URL : "/", + devToolbar: { + enabled: false + }, + integrations: [tailwind({ + applyBaseStyles: false + }), partytown({ + config: { + forward: ['dataLayer.push'], + }, + }), +], + base: process.env.BASE_URL ? process.env.BASE_URL : "/" }); diff --git a/package-lock.json b/package-lock.json index ac57cd6..78f35b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.1", "dependencies": { "@astrojs/check": "^0.7.0", + "@astrojs/partytown": "^2.1.1", "@astrojs/tailwind": "^5.1.0", "@orestbida/iframemanager": "^1.2.5", "astro": "^4.10.1", @@ -138,6 +139,15 @@ "vfile": "^6.0.1" } }, + "node_modules/@astrojs/partytown": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@astrojs/partytown/-/partytown-2.1.1.tgz", + "integrity": "sha512-KvecQuGGgrDrdTjC5awmtoQXqJFinChfeizKBJyr7F5EGQPx62xq8SIWkcXamLr5xZyNw0lryKeLtIzbxRH/zw==", + "dependencies": { + "@builder.io/partytown": "^0.10.2", + "mrmime": "^2.0.0" + } + }, "node_modules/@astrojs/prism": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.1.0.tgz", @@ -519,6 +529,17 @@ "node": ">=6.9.0" } }, + "node_modules/@builder.io/partytown": { + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/@builder.io/partytown/-/partytown-0.10.2.tgz", + "integrity": "sha512-A9U+4PREWcS+CCYzKGIPovtGB/PBgnH/8oQyCE6Nr9drDJk6cMPpLQIEajpGPmG9tYF7N3FkRvhXm/AS9+0iKg==", + "bin": { + "partytown": "bin/partytown.cjs" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@emmetio/abbreviation": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/@emmetio/abbreviation/-/abbreviation-2.3.3.tgz", diff --git a/package.json b/package.json index 63c593e..d10b74d 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "dependencies": { "@astrojs/check": "^0.7.0", + "@astrojs/partytown": "^2.1.1", "@astrojs/tailwind": "^5.1.0", "@orestbida/iframemanager": "^1.2.5", "astro": "^4.10.1", diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 91c1ca7..2342311 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -12,6 +12,15 @@ const { title } = Astro.props;
+ + diff --git a/src/scripts/cookie-consent-config.js b/src/scripts/cookie-consent-config.js index 47e9ee1..6f64a0a 100644 --- a/src/scripts/cookie-consent-config.js +++ b/src/scripts/cookie-consent-config.js @@ -53,6 +53,13 @@ run({ flipButtons: false, }, }, + onConsent: () => { + window.dispatchEvent(new CustomEvent("ptupdate")); + }, + + onChange: () => { + window.dispatchEvent(new CustomEvent("ptupdate")); + }, categories: { necessary: { readOnly: true, diff --git a/src/scripts/google-analytics.js b/src/scripts/google-analytics.js new file mode 100644 index 0000000..bfb4333 --- /dev/null +++ b/src/scripts/google-analytics.js @@ -0,0 +1,7 @@ +window.dataLayer = window.dataLayer || []; +function gtag() { + dataLayer.push(arguments); +} +gtag("js", new Date()); + +gtag("config", "G-E95B4HTX6G");