Created
March 13, 2018 16:04
-
-
Save mbjedk/2c3f088e1c7c82ad2213591fa3b4cc63 to your computer and use it in GitHub Desktop.
EB Interaktiv - Tracking for Hype Productions in "EB Interactive Element"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Instruktioner */ | |
// - Opret de to tracking funktioner i Hype: | |
// - Resource Library -> + -> Add Javascript Function | |
// - Copy paste første funktion ind og omdøbe javascript funktionen til "startTrackingFunction" | |
// - Gentag processen med næste funktion (completeTrackingFunction) | |
// - Tilføj event (start), ved første interaktion med produktionen (Inspector -> Actions -> On xxx -> + -> Action: Run Javascript -> startTrackingFunction | |
// - Tilføj event (complete), ved sidste del af Hypeproduktionen (i den action der går til sidste step). | |
// NB: Scriptet sørger for, der kun bliver tracket én gang for henholdsvis start og complete. | |
// element - DOMHTMLElement that triggered this function being called | |
// event - event that triggered this function being called | |
// function startTrackingFunction (hypeDocument, element, event) { | |
if (window.productionName === undefined) { | |
window.productionName = 'eb-' + document.title.toLowerCase() + '-hype' | |
var trackingData = { | |
'eventCategory': 'EB interaktiv', | |
'eventAction': window.productionName, | |
'eventLabel': 'First interaction', | |
'eventValue': 0, | |
'eventNint': 0 | |
} | |
parent.postMessage(trackingData, '*') | |
} | |
// } | |
// element - DOMHTMLElement that triggered this function being called | |
// event - event that triggered this function being called | |
// function completeTrackingFunction (hypeDocument, element, event) { | |
if (window.productionName && window.completedTrackingData === undefined) { | |
window.completedTrackingData = { | |
'eventCategory': 'EB interaktiv', | |
'eventAction': window.productionName, | |
'eventLabel': 'Completed interaction', | |
'eventValue': 0, | |
'eventNint': 0 | |
} | |
parent.postMessage(window.completedTrackingData, '*') | |
} | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment