I have this code for many years, implementing TCFv2 cookie consent with Google Funding Choices.
window.googlefc.callbackQueue.push({
'CONSENT_DATA_READY': function () {
/* __tcfapi is undefined!! */
return __tcfapi('addEventListener', 2, function (tcData, success) {
if (success
&& tcData.gdprApplies
&& (tcData.eventStatus === 'tcloaded' || tcData.eventStatus === 'useractioncomplete')
&& tcData.purpose.consents[1]) {
...
}
});
}
});
It works 99.99% of the time, it has appeared so.
However, today, one of my Chrome profiles seem to have got "broken", in that whenever this CONSENT_DATA_READY
event is triggered, __tcfapi is not defined
.
I tried a number of things, like making sure all extensions are disabled, close Chrome and re-open it, clear just my domain's cookies, etc, but nothing worked. All other Chrome profiles were working well all the time.
I compared the "Sources" tab in DevTools between two Chrome profiles (on the same webpage), and the one working well had a few more scripts loaded and iframes loaded (TCF-specific iframes).
Only when I cleared all the cookies (including the "google.com" scoped cookies), this issue got fixed.
--
I've just released a temporary piece of code, that checks if __tcfapi
is undefined in that spot and reports that to the server (this user data will be fully erased as soon as this test is complete), and I see that a small subset of my users is having this issue right now.
EDIT 18 Dec - 181 distinct European users reported so far.
--
I'm not able to find any solution by doing some research. I found someone on Reddit (in the comments) having the same issue as me, and they "resolved" by just removing the event. Other places that report issues with __tcfapi
seem to be a slightly different error, like __tcfapi is not a function
, which is not the issue I'm having.
--
This looks like it's a bug from Google Funding Choices, but does anyone have any idea how to "auto-fix" this or what can I do so that these users will stop getting this error and proceed as expected?