aboutsummaryrefslogtreecommitdiff
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
parent3387256ff71d411d14b863f4a55c28f0356cd6d5 (diff)
add analytics
-rw-r--r--public/javascripts/analytics.js35
-rw-r--r--public/javascripts/bundle.js61
-rw-r--r--public/javascripts/main.js4
3 files changed, 90 insertions, 10 deletions
diff --git a/public/javascripts/analytics.js b/public/javascripts/analytics.js
new file mode 100644
index 0000000..a93c8a4
--- /dev/null
+++ b/public/javascripts/analytics.js
@@ -0,0 +1,35 @@
+/* global ga */
+
+const self = {}
+
+self.send = {}
+
+self.send.search = function (selectedUser, favorite) {
+ const hitType = 'event'
+
+ const eventCategory = favorite ? 'search fav' : 'search'
+
+ let eventAction
+ switch (selectedUser.type) {
+ case 'c':
+ eventAction = 'Class'
+ break
+ case 't':
+ eventAction = 'Teacher'
+ break
+ case 'r':
+ eventAction = 'Room'
+ break
+ case 's':
+ eventAction = 'Student'
+ break
+ }
+
+ const eventLabel = selectedUser.value
+
+ ga(function () {
+ ga('send', { hitType, eventCategory, eventAction, eventLabel })
+ })
+}
+
+module.exports = self
diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js
index 3c842a8..7c7060a 100644
--- a/public/javascripts/bundle.js
+++ b/public/javascripts/bundle.js
@@ -783,6 +783,43 @@ function leftPad (str, len, ch) {
})(window, document);
},{}],5:[function(require,module,exports){
+/* global ga */
+
+const self = {};
+
+self.send = {};
+
+self.send.search = function (selectedUser, favorite) {
+ const hitType = 'event';
+
+ const eventCategory = favorite ? 'search fav' : 'search';
+
+ let eventAction;
+ switch (selectedUser.type) {
+ case 'c':
+ eventAction = 'Class';
+ break;
+ case 't':
+ eventAction = 'Teacher';
+ break;
+ case 'r':
+ eventAction = 'Room';
+ break;
+ case 's':
+ eventAction = 'Student';
+ break;
+ }
+
+ const eventLabel = selectedUser.value;
+
+ ga(function () {
+ ga('send', { hitType, eventCategory, eventAction, eventLabel });
+ });
+};
+
+module.exports = self;
+
+},{}],6:[function(require,module,exports){
const EventEmitter = require('events');
const self = new EventEmitter();
@@ -869,7 +906,7 @@ self._nodes.input.addEventListener('keydown', self._handleKeydown);
module.exports = self;
-},{"events":1}],6:[function(require,module,exports){
+},{"events":1}],7:[function(require,module,exports){
const self = {};
self.isIE = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0;
@@ -882,7 +919,7 @@ if (self.isIE) {
module.exports = self;
-},{}],7:[function(require,module,exports){
+},{}],8:[function(require,module,exports){
/* global USERS */
const EventEmitter = require('events');
@@ -959,7 +996,7 @@ self._nodes.toggle.addEventListener('click', self._handleClick);
module.exports = self;
-},{"events":1}],8:[function(require,module,exports){
+},{"events":1}],9:[function(require,module,exports){
const browserFixToolkit = require('./browserFixToolkit');
const self = {};
@@ -984,13 +1021,14 @@ self._nodes.input.addEventListener(browserFixToolkit.inputEvent, self.hide);
module.exports = self;
-},{"./browserFixToolkit":6}],9:[function(require,module,exports){
+},{"./browserFixToolkit":7}],10:[function(require,module,exports){
const frontpage = require('./frontpage');
const search = require('./search');
const schedule = require('./schedule');
const weekSelector = require('./weekSelector');
const favorite = require('./favorite');
const scrollSnap = require('./scrollSnap');
+const analytics = require('./analytics');
const state = {};
@@ -1004,6 +1042,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();
@@ -1012,10 +1051,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);
});
@@ -1025,7 +1066,7 @@ favorite.on('click', function () {
document.body.style.opacity = 1;
-},{"./favorite":7,"./frontpage":8,"./schedule":10,"./scrollSnap":11,"./search":12,"./weekSelector":13}],10:[function(require,module,exports){
+},{"./analytics":5,"./favorite":8,"./frontpage":9,"./schedule":11,"./scrollSnap":12,"./search":13,"./weekSelector":14}],11:[function(require,module,exports){
const EventEmitter = require('events');
const leftPad = require('left-pad');
const search = require('./search');
@@ -1097,7 +1138,7 @@ self.viewItem = function (week, selectedUser) {
module.exports = self;
-},{"./search":12,"events":1,"left-pad":3}],11:[function(require,module,exports){
+},{"./search":13,"events":1,"left-pad":3}],12:[function(require,module,exports){
require('smoothscroll-polyfill').polyfill();
const self = {};
@@ -1153,7 +1194,7 @@ schedule.on('load', self._handleWindowResize);
window.addEventListener('resize', self._handleWindowResize);
module.exports = self;
-},{"./schedule":10,"smoothscroll-polyfill":4}],12:[function(require,module,exports){
+},{"./schedule":11,"smoothscroll-polyfill":4}],13:[function(require,module,exports){
/* global USERS */
const EventEmitter = require('events');
@@ -1243,7 +1284,7 @@ self._nodes.input.addEventListener(browserFixToolkit.inputEvent, self._handleTex
module.exports = self;
-},{"./autocomplete":5,"./browserFixToolkit":6,"events":1,"fuzzy":2}],13:[function(require,module,exports){
+},{"./autocomplete":6,"./browserFixToolkit":7,"events":1,"fuzzy":2}],14:[function(require,module,exports){
const EventEmitter = require('events');
const self = new EventEmitter();
@@ -1339,5 +1380,5 @@ self._nodes.nextButton.addEventListener('click', self._handleNextButtonClick);
module.exports = self;
-},{"events":1}]},{},[9])
-//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW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zdGFydFggKyAoY29udGV4dC54IC0gY29udGV4dC5zdGFydFgpICogdmFsdWU7XG4gICAgICBjdXJyZW50WSA9IGNvbnRleHQuc3RhcnRZICsgKGNvbnRleHQueSAtIGNvbnRleHQuc3RhcnRZKSAqIHZhbHVlO1xuXG4gICAgICBjb250ZXh0Lm1ldGhvZC5jYWxsKGNvbnRleHQuc2Nyb2xsYWJsZSwgY3VycmVudFgsIGN1cnJlbnRZKTtcblxuICAgICAgLy8gcmV0dXJuIHdoZW4gZW5kIHBvaW50cyBoYXZlIGJlZW4gcmVhY2hlZFxuICAgICAgaWYgKGN1cnJlbnRYID09PSBjb250ZXh0LnggJiYgY3VycmVudFkgPT09IGNvbnRleHQueSkge1xuICAgICAgICB3LmNhbmNlbEFuaW1hdGlvbkZyYW1lKGNvbnRleHQuZnJhbWUpO1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogc2Nyb2xscyB3aW5kb3cgd2l0aCBhIHNtb290aCBiZWhhdmlvclxuICAgICAqIEBtZXRob2Qgc21vb3RoU2Nyb2xsXG4gICAgICogQHBhcmFtIHtPYmplY3R8Tm9kZX0gZWxcbiAgICAgKiBAcGFyYW0ge051bWJlcn0geFxuICAgICAqIEBwYXJhbSB7TnVtYmVyfSB5XG4gICAgICovXG4gICAgZnVuY3Rpb24gc21vb3RoU2Nyb2xsKGVsLCB4LCB5KSB7XG4gICAgICB2YXIgc2Nyb2xsYWJsZTtcbiAgICAgIHZhciBzdGFydFg7XG4gICAgICB2YXIgc3RhcnRZO1xuICAgICAgdmFyIG1ldGhvZDtcbiAgICAgIHZhciBzdGFydFRpbWUgPSBub3coKTtcbiAgICAgIHZhciBmcmFtZTtcblxuICAgICAgLy8gZGVmaW5lIHNjcm9sbCBjb250ZXh0XG4gICAgICBpZiAoZWwgPT09IGQuYm9keSkge1xuICAgICAgICBzY3JvbGxhYmxlID0gdztcbiAgICAgICAgc3RhcnRYID0gdy5zY3JvbGx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WVrJ1xuICAgICAgICBicmVha1xuICAgICAgY2FzZSAtMTpcbiAgICAgICAgaHVtYW5SZWFkYWJsZVdlZWsgPSAnVm9yaWdlIHdlZWsnXG4gICAgICAgIGJyZWFrXG4gICAgfVxuICB9XG4gIGlmIChodW1hblJlYWRhYmxlV2VlayAhPSBudWxsKSB7XG4gICAgc2VsZi5fbm9kZXMuY3VycmVudFdlZWtUZXh0LnRleHRDb250ZW50ID0gaHVtYW5SZWFkYWJsZVdlZWsgKyAnIOKAoiAnICsgc2VsZWN0ZWRXZWVrTnVtYmVyXG4gIH0gZWxzZSB7XG4gICAgc2VsZi5fbm9kZXMuY3VycmVudFdlZWtUZXh0LnRleHRDb250ZW50ID0gJ1dlZWsgJyArIHNlbGVjdGVkV2Vla051bWJlclxuICB9XG59XG5cbnNlbGYuX2hhbmRsZVByZXZCdXR0b25DbGljayA9IGZ1bmN0aW9uICgpIHtcbiAgc2VsZi5fd2Vla09mZnNldCAtPSAxXG4gIHNlbGYudXBkYXRlQ3VycmVudFdlZWsoKVxufVxuXG5zZWxmLl9oYW5kbGVOZXh0QnV0dG9uQ2xpY2sgPSBmdW5jdGlvbiAoKSB7XG4gIHNlbGYuX3dlZWtPZmZzZXQgKz0gMVxuICBzZWxmLnVwZGF0ZUN1cnJlbnRXZWVrKClcbn1cblxuc2VsZi5fbm9kZXMucHJldkJ1dHRvbi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIHNlbGYuX2hhbmRsZVByZXZCdXR0b25DbGljaylcbnNlbGYuX25vZGVzLm5leHRCdXR0b24uYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCBzZWxmLl9oYW5kbGVOZXh0QnV0dG9uQ2xpY2spXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19
+},{"events":1}]},{},[10])
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3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ICAgIHRoaXMuc2Nyb2xsVG9wID0geTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiByZXR1cm5zIHJlc3VsdCBvZiBhcHBseWluZyBlYXNlIG1hdGggZnVuY3Rpb24gdG8gYSBudW1iZXJcbiAgICAgKiBAbWV0aG9kIGVhc2VcbiAgICAgKiBAcGFyYW0ge051bWJlcn0ga1xuICAgICAqIEByZXR1cm5zIHtOdW1iZXJ9XG4gICAgICovXG4gICAgZnVuY3Rpb24gZWFzZShrKSB7XG4gICAgICByZXR1cm4gMC41ICogKDEgLSBNYXRoLmNvcyhNYXRoLlBJICogaykpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIGluZGljYXRlcyBpZiBhIHNtb290aCBiZWhhdmlvciBzaG91bGQgYmUgYXBwbGllZFxuICAgICAqIEBtZXRob2Qgc2hvdWxkQmFpbE91dFxuICAgICAqIEBwYXJhbSB7TnVtYmVyfE9iamVjdH0geFxuICAgICAqIEByZXR1cm5zIHtCb29sZWFufVxuICAgICAqL1xuICAgIGZ1bmN0aW9uIHNob3VsZEJhaWxPdXQoeCkge1xuICAgICAgaWYgKHR5cGVvZiB4ICE9PSAnb2JqZWN0J1xuICAgICAgICAgICAgfHwgeCA9PT0gbnVsbFxuICAgICAgICAgICAgfHwgeC5iZWhhdmlvciA9PT0gdW5kZWZpbmVkXG4gICAgICAgICAgICB8fCB4LmJlaGF2aW9yID09PSAnYXV0bydcbiAgICAgICAgICAgIHx8IHguYmVoYXZpb3IgPT09ICdpbnN0YW50Jykge1xuICAgICAgICAvLyBmaXJzdCBhcmcgbm90IGFuIG9iamVjdC9udWxsXG4gICAgICAgIC8vIG9yIGJlaGF2aW9yIGlzIGF1dG8sIGluc3RhbnQgb3IgdW5kZWZpbmVkXG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgfVxuXG4gICAgICBpZiAodHlwZW9mIHggPT09ICdvYmplY3QnXG4gICAgICAgICAgICAmJiB4LmJlaGF2aW9yID09PSAnc21vb3R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PdXQoYXJndW1lbnRzWzBdKSkge1xuICAgICAgICBvcmlnaW5hbC5zY3JvbGwuY2FsbChcbiAgICAgICAgICB3LFxuICAgICAgICAgIGFyZ3VtZW50c1swXS5sZWZ0IHx8IGFyZ3VtZW50c1swXSxcbiAgICAgICAgICBhcmd1bWVudHNbMF0udG9wIHx8IGFyZ3VtZW50c1sxXVxuICAgICAgICApO1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIC8vIExFVCBUSEUgU01PT1RITkVTUyBCRUdJTiFcbiAgICAgIHNtb290aFNjcm9sbC5jYWxsKFxuICAgICAgICB3LFxuICAgICAgICBkLmJvZHksXG4gICAgICAgIH5+YXJndW1lbnRzWzBdLmxlZnQsXG4gICAgICAgIH5+YXJndW1lbnRzWzBdLnRvcFxuICAgICAgKTtcbiAgICB9O1xuXG4gICAgLy8gdy5zY3JvbGxCeVxuICAgIHcuc2Nyb2xsQnkgPSBmdW5jdGlvbigpIHtcbiAgICAgIC8vIGF2b2lkIHNtb290aCBiZWhhdmlvciBpZiBub3QgcmVxdWlyZWRcbiAgICAgIGlmIChzaG91bGRCYWlsT3V0KGFyZ3VtZW50c1swXSkpIHtcbiAgICAgICAgb3JpZ2luYWwuc2Nyb2xsQnkuY2FsbChcbiAgICAgICAgICB3LFxuICAgICAgICAgIGFyZ3VtZW50c1swXS5sZWZ0IHx8IGFyZ3VtZW50c1swXSxcbiAgICAgICAgICBhcmd1bWVudHNbMF0udG9wIHx8IGFyZ3VtZW50c1sxXVxuICAgICAgICApO1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIC8vIExFVCBUSEUgU01PT1RITkVTUyBCRUdJTiFcbiAgICAgIHNtb290aFNjcm9sbC5jYWxsKFxuICAgICAgICB3LFxuICAgICAgICBkLmJvZHksXG4gICAgICAgIH5+YXJndW1lbnRzWzBdLmxlZnQgKyAody5zY3JvbGxYIHx8IHcucGFnZVhPZmZzZXQpLFxuICAgICAgICB+fmFyZ3VtZ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FzZSAtMTpcbiAgICAgICAgaHVtYW5SZWFkYWJsZVdlZWsgPSAnVm9yaWdlIHdlZWsnXG4gICAgICAgIGJyZWFrXG4gICAgfVxuICB9XG4gIGlmIChodW1hblJlYWRhYmxlV2VlayAhPSBudWxsKSB7XG4gICAgc2VsZi5fbm9kZXMuY3VycmVudFdlZWtUZXh0LnRleHRDb250ZW50ID0gaHVtYW5SZWFkYWJsZVdlZWsgKyAnIOKAoiAnICsgc2VsZWN0ZWRXZWVrTnVtYmVyXG4gIH0gZWxzZSB7XG4gICAgc2VsZi5fbm9kZXMuY3VycmVudFdlZWtUZXh0LnRleHRDb250ZW50ID0gJ1dlZWsgJyArIHNlbGVjdGVkV2Vla051bWJlclxuICB9XG59XG5cbnNlbGYuX2hhbmRsZVByZXZCdXR0b25DbGljayA9IGZ1bmN0aW9uICgpIHtcbiAgc2VsZi5fd2Vla09mZnNldCAtPSAxXG4gIHNlbGYudXBkYXRlQ3VycmVudFdlZWsoKVxufVxuXG5zZWxmLl9oYW5kbGVOZXh0QnV0dG9uQ2xpY2sgPSBmdW5jdGlvbiAoKSB7XG4gIHNlbGYuX3dlZWtPZmZzZXQgKz0gMVxuICBzZWxmLnVwZGF0ZUN1cnJlbnRXZWVrKClcbn1cblxuc2VsZi5fbm9kZXMucHJldkJ1dHRvbi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIHNlbGYuX2hhbmRsZVByZXZCdXR0b25DbGljaylcbnNlbGYuX25vZGVzLm5leHRCdXR0b24uYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCBzZWxmLl9oYW5kbGVOZXh0QnV0dG9uQ2xpY2spXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19
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)
})