Skip to content

Commit

Permalink
feat: add vue-gtm for ga4
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Nov 16, 2022
1 parent 73de896 commit c8a239f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"devDependencies": {
"@antfu/eslint-config": "^0.30.1",
"@gtm-support/vue-gtm": "^1.6.0",
"@iconify-json/carbon": "^1.1.10",
"@iconify-json/mdi": "^1.1.34",
"@iconify-json/ri": "^1.1.3",
Expand Down
12 changes: 12 additions & 0 deletions plugins/gtm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createGtm } from '@gtm-support/vue-gtm'

const gtmId = 'GTM-MX9N9X2'

export default defineNuxtPlugin((nuxtApp) => {
// add google tag manager, and add GA4 in gtag
const gtm = createGtm({
id: gtmId,
// debug: import.meta.env.DEV,
})
nuxtApp.vueApp.use(gtm)
})
28 changes: 28 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c8a239f

Please sign in to comment.