Skip to content

Instantly share code, notes, and snippets.

View josephrussell-cn's full-sized avatar

Joseph Russell josephrussell-cn

View GitHub Profile
@josephrussell-cn
josephrussell-cn / ampIframeTcfapiProxy.js
Last active February 28, 2022 19:49
Provides tcfapi interface to iframe window using amp-consent data
// amp-iframe tcfapi proxy
// The cne video player inside the iframe on amp does not have access to consent data.
// This script is creating a __tcfapi proxy that scripts needing it can call to obtain TCData.
// TCData is sourced from a postMessage with type=send-consent-data to sentinel=amp
// Should only execute on AMP pages where gdpr is enabled
var consentMetadata;
var consentString;
var gdprApplies;
var queue = [];