From 7475e19357142b0924373582528ee9372af75506 Mon Sep 17 00:00:00 2001 From: acatchpole Date: Thu, 18 Apr 2024 15:10:32 -0700 Subject: [PATCH] commented out most google analytics code --- .../gwells/templates/gwells/base_spa.html | 4 ++-- app/frontend/src/aquifers/components/View.vue | 4 ++-- app/frontend/src/aquifers/store/search.js | 16 +++++++------- app/frontend/src/main.js | 17 +++----------- .../wells/components/SearchResultExports.vue | 22 +++++++++---------- 5 files changed, 26 insertions(+), 37 deletions(-) diff --git a/app/backend/gwells/templates/gwells/base_spa.html b/app/backend/gwells/templates/gwells/base_spa.html index 6a2567b075..d89641f7d8 100644 --- a/app/backend/gwells/templates/gwells/base_spa.html +++ b/app/backend/gwells/templates/gwells/base_spa.html @@ -50,7 +50,7 @@ - {% if settings.ENABLE_GOOGLE_ANALYTICS %} + diff --git a/app/frontend/src/aquifers/components/View.vue b/app/frontend/src/aquifers/components/View.vue index 760c2e6983..42d0b1d4bf 100644 --- a/app/frontend/src/aquifers/components/View.vue +++ b/app/frontend/src/aquifers/components/View.vue @@ -983,7 +983,7 @@ export default { this.waterWithdrawlVolume = sumBy(details.usage, 'total_qty') } }, - // log a google analytics event when clicking on links to other sites + /* // log a google analytics event when clicking on links to other sites handleOutboundLinkClicks (link) { if (window.ga) { window.ga('send', 'event', { @@ -1003,7 +1003,7 @@ export default { eventLabel: 'Aquifer Factsheet' }) } - }, + }, */ sanitizeResourceUrl (url) { const sanitized = sanitizeUrl(url) return encodeURI(sanitized) diff --git a/app/frontend/src/aquifers/store/search.js b/app/frontend/src/aquifers/store/search.js index 3539d931d4..13ec1d0b33 100644 --- a/app/frontend/src/aquifers/store/search.js +++ b/app/frontend/src/aquifers/store/search.js @@ -131,14 +131,14 @@ const aquiferSearchStore = { // trigger the Google Analytics search event // trigger the search event, sending along the search params as a string - if (window.ga) { - window.ga('send', { - hitType: 'event', - eventCategory: 'Button', - eventAction: 'AquiferSearch', - eventLabel: querystring.stringify(state.searchQuery) - }) - } + // if (window.ga) { + // window.ga('send', { + // hitType: 'event', + // eventCategory: 'Button', + // eventAction: 'AquiferSearch', + // eventLabel: querystring.stringify(state.searchQuery) + // }) + // } if (state.pendingSearch) { state.pendingSearch.cancel() diff --git a/app/frontend/src/main.js b/app/frontend/src/main.js index 38ae569ed1..2b7a512291 100644 --- a/app/frontend/src/main.js +++ b/app/frontend/src/main.js @@ -18,7 +18,6 @@ import * as Integrations from '@sentry/integrations' import Vuex, { mapActions } from 'vuex' import VueNoty from 'vuejs-noty' import BootstrapVue from 'bootstrap-vue' -import VueAnalytics from 'vue-analytics' import VueMatomo from 'vue-matomo' import App from './App' import router from './router.js' @@ -37,9 +36,10 @@ import ApiService from '@/common/services/ApiService.js' const PRODUCTION_GWELLS_URL = 'https://apps.nrs.gov.bc.ca/gwells' const STAGING_GWELLS_URLS = ['testapps.nrs.gov.bc.ca', 'gwells-staging.apps.silver.devops.gov.bc.ca'] -const isProduction = () => (window.location.href.substr(0, PRODUCTION_GWELLS_URL.length) === PRODUCTION_GWELLS_URL) +const BASE_PATH = '/gwells/' +const isProduction = () => (window.location.href.substring(0, PRODUCTION_GWELLS_URL.length) === PRODUCTION_GWELLS_URL) const isStaging = () => ( - window.location.pathname === '/gwells/' && STAGING_GWELLS_URLS.includes(window.location.hostname) + window.location.pathname.substring(0, BASE_PATH.length) === BASE_PATH && STAGING_GWELLS_URLS.includes(window.location.hostname) ) if (isProduction()) { Sentry.init({ @@ -69,16 +69,6 @@ Vue.component('form-input', FormInput) // set baseURL and default headers ApiService.init() -Vue.use(VueAnalytics, { - id: 'UA-106174915-1', - set: [ - { field: 'anonymizeIp', value: true } - ], - disabled: ApiService.query('analytics', {}).then((response) => { - return response.data.enable_google_analytics !== true - }) -}) - if (isProduction()) { Vue.use(VueMatomo, { host: 'https://water-matomo.apps.silver.devops.gov.bc.ca/', @@ -115,6 +105,5 @@ new Vue({ }, created () { this.FETCH_CONFIG() - this.$ga.page() } }) diff --git a/app/frontend/src/wells/components/SearchResultExports.vue b/app/frontend/src/wells/components/SearchResultExports.vue index 1f2e2b1c63..5ef7a91213 100644 --- a/app/frontend/src/wells/components/SearchResultExports.vue +++ b/app/frontend/src/wells/components/SearchResultExports.vue @@ -107,18 +107,18 @@ export default { exportHandler(format) { const exportUrl = this.getExportUrl(format); ApiService.download(exportUrl); - this.sendAnalytics(format); + // this.sendAnalytics(format); }, - sendAnalytics (format) { - if (window.ga) { - window.ga('send', { - hitType: 'event', - eventCategory: 'Button', - eventAction: 'WellSearchResultsExtract', - eventLabel: format - }) - } - } + // sendAnalytics (format) { + // if (window.ga) { + // window.ga('send', { + // hitType: 'event', + // eventCategory: 'Button', + // eventAction: 'WellSearchResultsExtract', + // eventLabel: format + // }) + // } + // } } }