Skip to content

Commit 4307363

Browse files
committed
Integrate nuxt-gtag for Google Tag Manager setup; remove inline GTM scripts from BlogEntry.vue and default.vue
1 parent 60fa349 commit 4307363

File tree

5 files changed

+25
-17
lines changed

5 files changed

+25
-17
lines changed

layouts/BlogEntry.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ const title = computed(() =>route.meta?.title ?? 'TDB');
1616
<template v-for="meta in head.meta" :key="meta.hid">
1717
<Meta :id="meta.hid" :property="meta.property" :content="meta.content" />
1818
</template>
19-
<component is="script" async src="https://www.googletagmanager.com/gtag/js?id=AW-16761048144"></component>
20-
<component is="script">
21-
window.dataLayer = window.dataLayer || [];
22-
function gtag(){dataLayer.push(arguments);}
23-
gtag('js', new Date());
24-
25-
gtag('config', 'AW-16761048144');
26-
</component>
2719
</Head>
2820
<Body class="h-full dark:bg-gray-900">
2921
<NavigationBar />

layouts/default.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ const title = computed(() => t(route.meta?.title ?? 'TDB'));
1717
<template v-for="meta in head.meta" :key="meta.hid">
1818
<Meta :id="meta.hid" :property="meta.property" :content="meta.content" />
1919
</template>
20-
<component is="script" async src="https://www.googletagmanager.com/gtag/js?id=AW-16761048144"></component>
21-
<component is="script">
22-
window.dataLayer = window.dataLayer || [];
23-
function gtag(){dataLayer.push(arguments);}
24-
gtag('js', new Date());
25-
26-
gtag('config', 'AW-16761048144');
27-
</component>
2820
</Head>
2921
<Body class="h-full dark:bg-gray-900">
3022
<NavigationBar />

nuxt.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export default defineNuxtConfig({
4646
'nuxt-schema-org',
4747
'nuxt-og-image',
4848
'@nuxt/content',
49-
'nuxt-posthog'
49+
'nuxt-posthog',
50+
'nuxt-gtag'
5051
],
5152
i18n: {
5253
strategy: 'prefix',
@@ -163,6 +164,13 @@ export default defineNuxtConfig({
163164
site: {
164165
url: 'https://blog.onelitefeather.net',
165166
},
167+
gtag: {
168+
id: 'AW-16761048144',
169+
config: {
170+
anonymize_ip: true,
171+
send_page_view: true
172+
}
173+
},
166174
image: {
167175
cloudflare: {
168176
baseUrl: 'https://blog.onelitefeather.net',

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@vueuse/nuxt": "13.3.0",
2525
"eslint": "^9.27.0",
2626
"nuxt": "^3.17.4",
27+
"nuxt-gtag": "3.0.2",
2728
"nuxt-og-image": "5.1.4",
2829
"nuxt-posthog": "1.6.3",
2930
"nuxt-schema-org": "5.0.5",

pnpm-lock.yaml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)