diff options
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 }) + }) } |