Last active
August 31, 2021 12:37
-
-
Save stijnjanmaat/5cba11693387cc5896835ed3c4e0164b to your computer and use it in GitHub Desktop.
Frits Tracking at Affiliate
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
// Created by affiliate, e.g. Consumentenbond | |
const initFritsTracking = () => { | |
const fritsTrackingEl = document.createElement('div'); | |
fritsTrackingEl.addEventListener('event', function(e) { | |
// implement tracking lib here | |
}, false); | |
return fritsTrackingEl; | |
} | |
// Managed by Frits | |
const init = () => { | |
let el; | |
try { | |
el = initFritsTracking(); | |
} catch (err) { | |
// not implemented | |
return; | |
} | |
const someEvent = new CustomEvent('event', { | |
prop: 12 | |
}); | |
el.dispatchEvent(someEvent); | |
} | |
init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment