Skip to content

Commit

Permalink
feat(support pop up): create custom analytics event
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Oct 8, 2020
1 parent de4328b commit e8085ba
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
12 changes: 12 additions & 0 deletions assets/js/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ function notificationsTracking() {
trackEvent({
category: 'Notifications',
action: 'opened',

function supportPopUpTracking() {
SendTimed(
0,
trackEvent({
category: 'PopUp',
action: 'Shown',
name: 'Support',
})
)
}
Expand All @@ -78,6 +86,10 @@ export default function fireAnalytics(mode, { state, domain } = {}) {
result = notificationsTracking()
break

case 'supportPopUp':
result = supportPopUpTracking()
break

default:
throw new Error('No mode specified')
}
Expand Down
5 changes: 4 additions & 1 deletion components/utils/SupportPopUpManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<script>
import { mapGetters, mapMutations } from 'vuex'
import fireAnalytics from '~/assets/js/analytics'
const SupportPopUp = () => import('./SupportPopUp.vue')
export default {
Expand All @@ -38,7 +40,8 @@ export default {
if (this.getTimesTheAppHasBeenOpened % 10 === 0) {
this.isSupportPopUpActive = true
//
fireAnalytics('supportPopUp')
} else {
this.isSupportPopUpActive = false
}
Expand Down

0 comments on commit e8085ba

Please sign in to comment.