Skip to content

Commit

Permalink
Merge pull request #86 from readingdancer/Event-Tracking
Browse files Browse the repository at this point in the history
Event tracking
  • Loading branch information
readingdancer authored Apr 3, 2020
2 parents c4789fa + 3c9a5db commit ca102bf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
10 changes: 6 additions & 4 deletions covid-19-support/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-162758783-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-162758783-1');
window.dataLayer = window.dataLayer || []
function gtag() {
dataLayer.push(arguments)
}
gtag('js', new Date())
gtag('config', 'UA-162758783-1')
</script>
</head>
<body>
Expand Down
22 changes: 19 additions & 3 deletions covid-19-support/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
:show-list="showList"
@location-selected="passLocation"
@toggle="isFilterOpen = !isFilterOpen"
@need-selected="(val) => (need = val)"
@day-selected="(val) => (day = val)"
@need-selected="needSelected"
@day-selected="daySelected"
/>

<div id="page-content-wrapper">
Expand All @@ -37,7 +37,7 @@ import Highlights from './components/Highlights.vue'
import ResourceMap from './components/ResourceMap.vue'
import AboutUsModal from './components/AboutUs.vue'
import { spreadsheetUrl } from './constants'
import { spreadsheetUrl, weekdays } from './constants'
export default {
name: 'app',
Expand Down Expand Up @@ -69,6 +69,14 @@ export default {
}
},
methods: {
needSelected: function (val) {
this.need = val
gtag('event', 'What do you need?', { event_category: 'Search - (' + this.language.name + ')', event_label: val })
},
daySelected: function (val) {
this.day = val
gtag('event', 'When do you need it?', { event_category: 'Search - (' + this.language.name + ')', event_label: weekdays[val].day })
},
changeLanguage: function (item) {
this.language = item
this.$root.updateLang(item.iso)
Expand All @@ -82,6 +90,14 @@ export default {
this.locationData = val
this.showList = false
this.isFilterOpen = true
var proName = this.filteredMarkers[val.locValue].gsx$provideraddloc.$t
? ', ' + this.filteredMarkers[val.locValue].gsx$provideraddloc.$t
: ''
gtag('event', val.isSetByMap ? 'Marker clicked' : 'List item clicked', {
event_category: 'View details - (' + this.language.name + ')',
event_label: this.filteredMarkers[val.locValue].gsx$providername.$t + proName
})
}
},
computed: {
Expand Down

0 comments on commit ca102bf

Please sign in to comment.