For the complete documentation index, see llms.txt. This page is also available as Markdown.

Activate Code Elements with Consent

Code elements are currently not assigned to any vendor in the JENTIS consent engine, so no consent information is checked or applied to them within the JENTIS Tag Manager framework by default. If consent is an important factor in your custom code, we'd propose that you add a custom JS function that will evaluate a vendors consent state, await consent updates and then activate the actual code snippet.

Find below an example. Replace the following sections so your code activates with consent:

  • VENDOR_ID: fill in the "" value with the ID of the respective vendor. You'll find the vendor ID in JENTIS account section: "Legal Hub": "Vendors", select a vendor and the ID will be presented in the top right corner (next to the name)

  • executeMyCode() function - this will be executed based on the consent default and update events, if consent is granted for the respective vendor this function is called; which is the place where your actual code snippet goes.

"adobeanalytics" is an example for a vendor ID; please replace this with the relevant vendor ID for your use case. If you are not sure which vendor ID it is, you can just run the jentis.consent.engine.getVendorFullData() function in your website (developer tools: console) to get all currently installed vendors in your container on the website.

const VENDOR_ID = "adobeanalytics"; 

function executeMyCode() {
    /*
     *Your custom code here.
    */
}

// DO NOT CHANGE:
var eventTarget;

if (
    typeof window.jentis !== "undefined" &&
    window.jentis.consent &&
    window.jentis.consent.engine
) {
    // SDK already loaded, so listen on the consent engine directly.
    eventTarget = window.jentis.consent.engine;
} else {
    // SDK not loaded yet, so listen on document for the init event.
    eventTarget = document;
}


function onVendorChange(event) {
    var consentStatus = event.detail && event.detail[VENDOR_ID];

    if (consentStatus === true) {
        executeMyCode();
    }
}

function onConsentInit() {
    var engine = window.jentis && window.jentis.consent && window.jentis.consent.engine;
    var vendorConsent;

    if (!engine) {
        return;
    }

    vendorConsent = engine.getVendorConsent(VENDOR_ID);

    if (vendorConsent === true) {
        executeMyCode();
    } else {
        engine.addEventListener("jentis.consent.engine.vendor-change", onVendorChange);
    }
}

eventTarget.addEventListener("jentis.consent.engine.init", onConsentInit);

Here is what the code element might look like in an active configuration in the JENTIS Tag Manager User Interface:

More details on working with the consent engine can be found here: Consent SDK Basics

Last updated

Was this helpful?