• window.consentApi.consent: Check if a given technical information (e.g. HTTP Cookie, LocalStorage, ...) has a consent:

    • When a technical information exists in defined cookies, the Promise is only resolved after given consent
    • When no technical information exists, the Promise is immediate resolved

    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)
    

    Since 3.4.14: You can also check for consent by service unique name:

    window.consentApi.consent("google-analytics-ua")
    

    Parameters

    • Rest ...args: [manager: CookieConsentManager<any>, typeOrIdOrUniqueName: string | number, name?: string, host?: string]

    Returns Promise<void>

Generated using TypeDoc