File tree Expand file tree Collapse file tree 2 files changed +28
-7
lines changed
Expand file tree Collapse file tree 2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,6 @@ useHead({
88 return titleChunk ? ` ${titleChunk } - Nuxt Commerce ` : ' Nuxt Commerce'
99 },
1010})
11-
12- // Uncomment and adjust when you need Google Analytics
13- // const { load } = useScriptGoogleAnalytics(
14- // { id: 'G-1234567', scriptOptions: { trigger: 'manual' } },
15- // )
16-
17- // load()
1811 </script >
1912
2013<template >
@@ -35,6 +28,7 @@ useHead({
3528
3629 <NuxtPage />
3730
31+ <LayoutCookieConsent />
3832 <LazyLayoutTheFooter class =" mt-5" />
3933 </main >
4034 </UApp >
Original file line number Diff line number Diff line change 1+ <script setup lang="ts">
2+ const toast = useToast ()
3+ const consent = useCookie (' consent' , { maxAge: 31536000 , path: ' /' })
4+
5+ // Load Google Analytics Script after consent
6+ // https://scripts.nuxt.com/docs/guides/consent
7+
8+ onMounted (() => {
9+ if (document .cookie .includes (' cookie-consent' )) return
10+
11+ toast .add ({
12+ ' id' : ' welcome' ,
13+ ' title' : ' Welcome to Nuxt Commerce' ,
14+ ' description' : ' A high-performance, server-rendered E-commerce app built with Nuxt & Shopify' ,
15+ ' duration' : Infinity ,
16+ ' onClick' : () => {},
17+ ' onUpdate:open' : () => {
18+ consent .value = ' cookie-consent'
19+ toast .remove (' welcome' )
20+ },
21+ })
22+ })
23+ </script >
24+
25+ <template >
26+ <span />
27+ </template >
You can’t perform that action at this time.
0 commit comments