aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/main.js
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2016-12-21 12:47:43 +0100
committerNoah Loomans <noahloomans@gmail.com>2016-12-21 12:47:43 +0100
commitf299cd610652535dede504a2ce17191de19ae281 (patch)
treeec8799afb709a8632e37e433c063395ece4659d5 /public/javascripts/main.js
parent3387256ff71d411d14b863f4a55c28f0356cd6d5 (diff)
add analytics
Diffstat (limited to 'public/javascripts/main.js')
-rw-r--r--public/javascripts/main.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/public/javascripts/main.js b/public/javascripts/main.js
index 7d2c8bb..5ebeb7b 100644
--- a/public/javascripts/main.js
+++ b/public/javascripts/main.js
@@ -4,6 +4,7 @@ const schedule = require('./schedule')
const weekSelector = require('./weekSelector')
const favorite = require('./favorite')
const scrollSnap = require('./scrollSnap')
+const analytics = require('./analytics')
const state = {}
@@ -17,6 +18,7 @@ scrollSnap.startListening()
if (favorite.get() != null) {
state.selectedItem = favorite.get()
favorite.update(state.selectedItem)
+ analytics.send.search(state.selectedItem, true)
schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
} else {
search.focus()
@@ -25,10 +27,12 @@ if (favorite.get() != null) {
search.on('search', function (selectedItem) {
state.selectedItem = selectedItem
favorite.update(state.selectedItem)
+ analytics.send.search(state.selectedItem)
schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
})
weekSelector.on('weekChanged', function (newWeek) {
+ analytics.send.search(state.selectedItem)
schedule.viewItem(newWeek, state.selectedItem)
})