Skip to content

Commit

Permalink
Add "cookie blocked" message
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarti committed Mar 8, 2019
1 parent 8b5991f commit 1915f0b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 9 additions & 2 deletions track.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
iframeId: 'ALOODO_FAKE_TRACKER_BLOCK_ME'
};
this._var = {
version: '1.0.1',
version: '1.1.0',
event: { load: [],
detected: [] }
detected: [],
blocked: []
}
};
if(options !== undefined) {
this.setOption(options);
Expand All @@ -34,6 +36,8 @@
which = 'load';
} else if (ev.data === 'tracking detected') {
which = 'detected';
} else if (ev.data === 'cookie blocked') {
which = 'blocked';
} else {
return;
}
Expand Down Expand Up @@ -122,6 +126,9 @@
Aloodo.prototype.onDetected = function(fn) {
return this.on('detected', fn);
};
Aloodo.prototype.onBlocked = function(fn) {
return this.on('blocked', fn);
};

window.Aloodo = Aloodo;

Expand Down
4 changes: 4 additions & 0 deletions track/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
var newcookie = out.join(' ');
setCookie('site', newcookie);
localStorage.setItem('site', newcookie);
var maybeCookie = getCookie('site');
if (maybeCookie != newcookie) {
parent.postMessage('cookie blocked', '*');
}
}

function doTrack() {
Expand Down

0 comments on commit 1915f0b

Please sign in to comment.