Skip to content

Commit

Permalink
change google tag manager plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobcatalin committed Dec 14, 2023
1 parent cdf2be6 commit 5f09ddc
Show file tree
Hide file tree
Showing 6 changed files with 7,551 additions and 7,337 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
API_URL=http://adapt.test
RECAPTCHA_SITE_KEY=
NUXT_PUBLIC_GTAG_ID=
STAGE=
7 changes: 4 additions & 3 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export default {
recaptcha: {
/* reCAPTCHA options */
siteKey: process.env.RECAPTCHA_SITE_KEY // for example
}
},
STAGE: process.env.STAGE || 'development',
NUXT_PUBLIC_GTAG_ID: process.env.NUXT_PUBLIC_GTAG_ID,
},

privateRuntimeConfig: {
Expand All @@ -44,6 +46,7 @@ export default {
{ src: '~/plugins/helpers/form.js' },
{ src: '~/plugins/axios.js'},
{ src: '~/plugins/component-loader.js' },
{ src: '~/plugins/analytics.js' },
],

// Auto import components: https://go.nuxtjs.dev/config-components
Expand All @@ -67,7 +70,6 @@ export default {
version: 3
}
],
'nuxt-gtag'
],

ssr: false,
Expand Down Expand Up @@ -145,7 +147,6 @@ export default {
'Source Sans Pro': [600],
}
},

// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
plugins: [
Expand Down
40 changes: 16 additions & 24 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"vee-validate": "^3.4.14",
"vue": "^2.6.14",
"vue-confirm-dialog": "1.0.2",
"vue-gtag": "^1.16.1",
"vue-server-renderer": "^2.6.14",
"vue-signature": "^2.6.0",
"vue-template-compiler": "^2.6.14",
Expand All @@ -27,7 +28,6 @@
},
"devDependencies": {
"@nuxtjs/google-fonts": "^3.0.1",
"@nuxtjs/vuetify": "^1.12.3",
"nuxt-gtag": "^1.1.1"
"@nuxtjs/vuetify": "^1.12.3"
}
}
12 changes: 12 additions & 0 deletions plugins/analytics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import Vue from 'vue'
import VueGtag from 'vue-gtag'

export default ({ app }) => {
if (app.$config.STAGE === 'production') {
Vue.use(VueGtag, {
config: { id: app.$config.NUXT_PUBLIC_GTAG_ID },
appName: 'CerAjutor',
pageTrackerScreenviewEnabled: true,
}, app.router)
}
}
Loading

0 comments on commit 5f09ddc

Please sign in to comment.