-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtracker.js
More file actions
26 lines (21 loc) · 1.27 KB
/
tracker.js
File metadata and controls
26 lines (21 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Requires the cookie script to read cookies
// Requires the cookie-consent script to set the cookie-consent cookie
document.addEventListener('DOMContentLoaded', () => {
const currentCookieSelection = $.cookie('cookie-consent');
console.log(`Cookie Consent Level ${currentCookieSelection}`);
// Enable necessary cookie script since they don't require consent, see readme
console.log('Tracker script »necessary cookie« triggered - no consent required');
// Enable internal script only if cookie consent was given due to continued usage
// Watch out: Not a valid consent form anymore within the EU!…
if (currentCookieSelection !== null && currentCookieSelection >= 20) {
console.log('Tracker script »first party, analytical cookie« triggered - consent due to continued usage');
}
// …Solution: Raise to level 60 instead (consent by opt-in)
//if (currentCookieSelection !== null && currentCookieSelection >= 60) {
// console.log('tracker script »first party, analytical cookie« triggered - consent by opt-in');
//}
// Enable external script only if cookie consent was given by opt-in
if (currentCookieSelection !== null && currentCookieSelection >= 80) {
console.log('Tracker script »analytical cookie« triggered - consent by opt-in');
}
});