diff --git a/components/BusinessPage.vue b/components/BusinessPage.vue index d8e33cc..3f11e28 100644 --- a/components/BusinessPage.vue +++ b/components/BusinessPage.vue @@ -401,27 +401,31 @@ export default { this.busy = false // Track the search. - this.$ga.event( - 'search', - 'submit_' + this.region, - this.category || 'All Categories' - ) - - this.$ga.event( - 'search', - 'location_' + this.region, - this.location || 'No location' - ) + window._paq.push([ + 'trackEvent', + 'search_category' + this.region, + 'category', + this.category || 'All Categories', + ]) + window._paq.push([ + 'trackEvent', + 'search_location_' + this.region, + 'location', + this.location || 'No location', + ]) }, select(uid) { this.selected = uid // Track the select. const business = this.$store.getters['businesses/get'](uid) - const value = [business.name, business.address, business.postcode].join( - ', ' - ) - this.$ga.event('map', 'select_' + this.region, value) + const value = [business.address, business.postcode].join(', ') + window._paq.push([ + 'trackEvent', + 'select_' + this.region, + business.name, + value, + ]) }, showMoreInfo() { this.waitForRef('moreinfomodal', () => { diff --git a/layouts/default.vue b/layouts/default.vue index f05d045..d213801 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -135,6 +135,23 @@ export default { return ret }, }, + mounted() { + const _paq = (window._paq = window._paq || []) + /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ + _paq.push(['trackPageView']) + _paq.push(['enableLinkTracking']) + ;(function () { + const u = 'https://restarters.matomo.cloud/' + _paq.push(['setTrackerUrl', u + 'matomo.php']) + _paq.push(['setSiteId', '1']) + const d = document + const g = d.createElement('script') + const s = d.getElementsByTagName('script')[0] + g.async = true + g.src = '//cdn.matomo.cloud/restarters.matomo.cloud/matomo.js' + s.parentNode.insertBefore(g, s) + })() + }, }