Skip to content

Commit 1915f0b

Browse files
committed
Add "cookie blocked" message
1 parent 8b5991f commit 1915f0b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

track.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
iframeId: 'ALOODO_FAKE_TRACKER_BLOCK_ME'
1515
};
1616
this._var = {
17-
version: '1.0.1',
17+
version: '1.1.0',
1818
event: { load: [],
19-
detected: [] }
19+
detected: [],
20+
blocked: []
21+
}
2022
};
2123
if(options !== undefined) {
2224
this.setOption(options);
@@ -34,6 +36,8 @@
3436
which = 'load';
3537
} else if (ev.data === 'tracking detected') {
3638
which = 'detected';
39+
} else if (ev.data === 'cookie blocked') {
40+
which = 'blocked';
3741
} else {
3842
return;
3943
}
@@ -122,6 +126,9 @@
122126
Aloodo.prototype.onDetected = function(fn) {
123127
return this.on('detected', fn);
124128
};
129+
Aloodo.prototype.onBlocked = function(fn) {
130+
return this.on('blocked', fn);
131+
};
125132

126133
window.Aloodo = Aloodo;
127134

track/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@
6868
var newcookie = out.join(' ');
6969
setCookie('site', newcookie);
7070
localStorage.setItem('site', newcookie);
71+
var maybeCookie = getCookie('site');
72+
if (maybeCookie != newcookie) {
73+
parent.postMessage('cookie blocked', '*');
74+
}
7175
}
7276

7377
function doTrack() {

0 commit comments

Comments
 (0)