Technical Specifications

CMP API

When defined on the page, this function is triggered when Consent Tool renders the user dialog (prior to end-user's decision) and when the user chooses either of the options (second time). For users who have already made their choice, the callback function is called right away with the corresponding parameter value. When a user is out of scope of GDPR, the callback is called with distinguishable param value.

// define callback on page
// place this code before Clickio Consent Tool (CCT) js file
(function(){
 // isolate all generic variables from global namspace
 // define global object callback function (which will be called by CCT js)
 (window.__lxG__consent__=window.__lxG__consent__||{}).consentCallback = function (consentState) {
        // for EEA users, this callback can be triggered twice:
        // before user decision (with -1 first and 0/1 later)
        // after user decision (with 0 or 1)

        if (consentState === null) {
            // consent not applicable, non-EEA user
        } else if (consentState === -1) {
            // EEA user, consent interface shown, cmp loaded, user has not decided yet
        } else if (consentState === 0) {
            // EEA user, consent rejected
        } else if (consentState === 1) {
            // EEA user, consent accepted
        }
    };

    // // add extra timeout call, in case network issues occur with loading clickio consent js
    // setTimeout((function(){return function(){
    //     // you can add your own value for "default" call
    //     // make sure possible double-call won`t break anything (use semaphore variable)
    //     window.__lxG__consent__.consentCallback(0);
    // };})(), 1500);
})();

To integrate Clickio Consent Tool with 3rd tags, use the following method to get consent status.

window.__lxG__consent__.getState();

The method returns the following values:

   
null GDPR not applicable (non-eu user)
-1 user has not decided yet
0 personalized ads are not allowed
1 personalised ads allowed

The other way to determine the consent status is to directly check the user's 1st party cookies. Every user who made consent choice would have a cookie with the name __lxG__consent__. Its value is a string of concatenated consent state (0 - rejected, 1 - accepted) and a consent disclosure version with | (pipe) delimeter.

For example, 0|1 means that the user rejected personalisation and the consent disclosure language version was 1 (disclosure versions are available in Clickio Consent Tool settings).

How to force the consent dialog to be shown

You can use the following code to show the consent UI. Please note that it will only be shown to EEA users.

window.__lxG__consent__.showConsent();

Alternatively, you can add ?showConsent=1 parameter to the page URL.

Back to top