diff --git a/.github/workflows/deploy_prod.yml b/.github/workflows/deploy_prod.yml index e313f30e..d4c9d942 100644 --- a/.github/workflows/deploy_prod.yml +++ b/.github/workflows/deploy_prod.yml @@ -20,6 +20,7 @@ jobs: AVRO_API_BASE_URL: ${{ secrets.AVRO_API_BASE_URL }} CATSHTM_API_BASE_URL: ${{ secrets.CATSHTM_API_BASE_URL }} GOOGLE_REDIRECT_URI: ${{ secrets.GOOGLE_REDIRECT_URI }} + GOOGLE_TAG_ID: ${{ secrets.GOOGLE_TAG_ID }} TNS_API_BASE_URL: ${{ secrets.TNS_API_BASE_URL }} USERS_API_BASE_URL: ${{ secrets.USERS_API_BASE_URL }} ZTF_API_BASE_URL: ${{ secrets.ZTF_API_BASE_URL }} diff --git a/nuxt.config.js b/nuxt.config.js index c91c540f..21f5709e 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -54,6 +54,7 @@ export default { '@/plugins/validation.js', '@/plugins/dataReleaseApi.js', '@/plugins/users.js', + '@/plugins/gtag.js', ], router: { middleware: 'auth', @@ -76,11 +77,7 @@ export default { buildModules: process.env.NODE_ENV !== 'production' ? ['@nuxtjs/vuetify', '@alerce/components/nuxt', '@nuxtjs/eslint-module'] - : [ - '@nuxtjs/vuetify', - '@alerce/components/nuxt', - '@nuxtjs/google-analytics', - ], + : ['@nuxtjs/vuetify', '@alerce/components/nuxt'], /* ** Nuxt.js modules */ @@ -90,12 +87,7 @@ export default { '@nuxtjs/toast', '@nuxtjs/pwa', ], - googleAnalytics: { - id: - process.env.NODE_ENV === 'production' - ? process.env.GOOGLE_ANALYTICS_ID - : '', - }, + /* ** Process runtime config */ @@ -110,18 +102,12 @@ export default { ztfApiBaseUrl: process.env.ZTF_API_BASE_URL || 'https://dev-api.alerce.online/alerts/v1/', - ztfApiv2Url: - process.env.ZTF_V2_API_URL || 'https://api.alerce.online/v2', + ztfApiv2Url: process.env.ZTF_V2_API_URL || 'https://api.alerce.online/v2', usersApiBaseUrl: process.env.USERS_API_BASE_URL || 'https://dev.users.alerce.online/users', googleRedirectUri: process.env.GOOGLE_REDIRECT_URI || 'http://localhost:3000/oauth/', - googleAnalytics: { - id: - process.env.NODE_ENV === 'production' - ? process.env.GOOGLE_ANALYTICS_ID - : '', - }, + googleTagId: process.env.GOOGLE_TAG_ID, }, privateRuntimeConfig: {}, /* diff --git a/package-lock.json b/package-lock.json index dafa855c..1bafbc93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,8 @@ "nuxt-property-decorator": "^2.7.2", "qs": "^6.9.4", "vee-validate": "^3.4.5", - "vue-echarts": "^5.0.0-beta.0" + "vue-echarts": "^5.0.0-beta.0", + "vue-gtag": "^1.16.1" }, "devDependencies": { "@nuxtjs/eslint-config": "^3.0.0", @@ -21865,6 +21866,14 @@ "node": ">=6.0.0" } }, + "node_modules/vue-gtag": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/vue-gtag/-/vue-gtag-1.16.1.tgz", + "integrity": "sha512-5vs0pSGxdqrfXqN1Qwt0ZFXG0iTYjRMu/saddc7QIC5yp+DKgjWQRpGYVa7Pq+KbThxwzzMfo0sGi7ISa6NowA==", + "peerDependencies": { + "vue": "^2.0.0" + } + }, "node_modules/vue-hot-reload-api": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", @@ -40493,6 +40502,12 @@ } } }, + "vue-gtag": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/vue-gtag/-/vue-gtag-1.16.1.tgz", + "integrity": "sha512-5vs0pSGxdqrfXqN1Qwt0ZFXG0iTYjRMu/saddc7QIC5yp+DKgjWQRpGYVa7Pq+KbThxwzzMfo0sGi7ISa6NowA==", + "requires": {} + }, "vue-hot-reload-api": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", diff --git a/package.json b/package.json index 79df6d4d..249e8d70 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,8 @@ "nuxt-property-decorator": "^2.7.2", "qs": "^6.9.4", "vee-validate": "^3.4.5", - "vue-echarts": "^5.0.0-beta.0" + "vue-echarts": "^5.0.0-beta.0", + "vue-gtag": "^1.16.1" }, "devDependencies": { "@nuxtjs/eslint-config": "^3.0.0", diff --git a/plugins/gtag.js b/plugins/gtag.js new file mode 100644 index 00000000..a33d3ee3 --- /dev/null +++ b/plugins/gtag.js @@ -0,0 +1,14 @@ +import { Vue } from 'nuxt-property-decorator' +import VueGtag from 'vue-gtag' + +export default function ({ $config, app }) { + Vue.use( + VueGtag, + { + config: { id: $config.googleTagId }, + pageTrackerEnabled: true, + deferScriptload: true, + }, + app.router + ) +}