diff options
author | Noah Loomans <noahloomans@gmail.com> | 2016-11-10 16:30:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-10 16:30:43 +0100 |
commit | a20a69e01d459e60eb5e0178ca394cd90d6992ac (patch) | |
tree | f6ff3dedc101b264da240bdc949fb276f8c1bb21 /public/javascripts/main.js | |
parent | ce8649602dadc350ba913991ac7975a1e01d58ed (diff) | |
parent | 462b2c88e85d07b212eece2a30ec69da1d6dce00 (diff) |
Merge pull request #3 from nloomans/beta
added favorite analytics
Diffstat (limited to 'public/javascripts/main.js')
-rw-r--r-- | public/javascripts/main.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/public/javascripts/main.js b/public/javascripts/main.js index 55bf054..98346dd 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -17,7 +17,8 @@ const nextButton = document.querySelectorAll('input[type="button"]')[1] const currentWeekNode = document.querySelector('.current') const favNode = document.querySelector('.fav') -if (window.location.href.split('?')[1] !== 'nfd') { // nfd = no feature detection +if (!(window.location.href.split('?')[1] && + window.location.href.split('?')[1].indexOf('nfd') >= 0)) { // nfd = no feature detection if (document.querySelector('#schedule').getClientRects()[0].bottom !== document.body.offsetHeight) { window.location = 'http://www.meetingpointmco.nl/Roosters-AL/doc/' } else { @@ -25,6 +26,8 @@ if (window.location.href.split('?')[1] !== 'nfd') { // nfd = no feature detectio window.location = 'http://www.meetingpointmco.nl/Roosters-AL/doc/' } } +} else { + console.log('feature detection is OFF') } let selectedResult = -1 @@ -208,4 +211,25 @@ if (currentFav) { inputNode.value = selectedUser.value scheduleIframe.src = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1) updateFavNode() + + 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: 'event', eventCategory: 'search fav', eventAction, eventLabel }) + }) } |