window.consentApi.consent: Check if a given technical information (e.g. HTTP Cookie, LocalStorage, ...) has a consent:
window.consentApi.consent
Example (ES5):
(window.consentApi && window.consentApi.consent("http", "_twitter_sess", ".twitter.com") || Promise.resolve()).then(function() { console.log("Consent for Twitter embed given, do something...!"); });
Example (ES6, Babel, TS):
(window.consentApi?.consent("http", "_twitter_sess", ".twitter.com") || Promise.resolve()).then(() => { console.log("Consent for Twitter embed given, do something...!"); });
Since 2.3.0: You can also check for consent by cookie ID (ID in wp_posts, post id):
wp_posts
window.consentApi.consent(15)
Generated using TypeDoc
window.consentApi.consent
: Check if a given technical information (e.g. HTTP Cookie, LocalStorage, ...) has a consent:Example (ES5):
(window.consentApi && window.consentApi.consent("http", "_twitter_sess", ".twitter.com") || Promise.resolve()).then(function() { console.log("Consent for Twitter embed given, do something...!"); });
Example (ES6, Babel, TS):
(window.consentApi?.consent("http", "_twitter_sess", ".twitter.com") || Promise.resolve()).then(() => { console.log("Consent for Twitter embed given, do something...!"); });
Since 2.3.0: You can also check for consent by cookie ID (ID in
wp_posts
, post id):window.consentApi.consent(15)