Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rep 240 matomo analytics #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions components/BusinessPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
17 changes: 17 additions & 0 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})()
},
}
</script>
<style>
Expand Down
2 changes: 1 addition & 1 deletion mixins/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Vue.mixin({
}
},
trackOutboundLink(url) {
this.$ga.event('outbound', 'click_' + this.region, url)
window._paq.push(['trackLink', url, 'click_' + this.region])
},
buildHead(title, description, image) {
const meta = [
Expand Down
11 changes: 0 additions & 11 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default {

buildModules: [
'@nuxtjs/eslint-module',
'@nuxtjs/google-analytics',
'@nuxtjs/google-fonts',
],

Expand Down Expand Up @@ -148,16 +147,6 @@ export default {
},
},

googleAnalytics: {
id: 'UA-46050944-3',

// Enable debug in development mode so that we can see what events are tracked.
debug: {
enabled: process.env.NODE_ENV !== 'production',
sendHitTask: true,
},
},

googleFonts: {
families: {
'Patua One': [300, 400, 600],
Expand Down
13 changes: 0 additions & 13 deletions package-lock.json

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

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
},
"dependencies": {
"@nuxtjs/axios": "^5.12.2",
"@nuxtjs/google-analytics": "^2.4.0",
"@nuxtjs/google-fonts": "^1.2.0",
"@nuxtjs/pwa": "^3.0.2",
"axios": "^0.21.1",
Expand Down