consent.update

Method to update Commanders Act consent status OnSite via JavaScript.

The Commanders Act OnSite API stub has to be installed before using any of the OnSite API functions.

cact('consent.update', consentObject)

The consent.update method allows to update the consent with JavaScript. It has to be called with a Consent Object that includes the updated settings. Commanders Act will deep merge the status fields of the current Consent Object with the provided object and automatically update all meta properties and the consent.status property automatically. In case a consent.status field is provided with value all-on, all-off or unset all other updates are ignored and all categories and vendor settings will be set to on, off or unset accordingly.

All not configured categories and vendors are ignored when deep-merging the consent objects.

Examples

Update categories and vendors

cact('consent.update', {
    categories: {
        '2': { status: 'on' }
    },
    vendors: {
        '1': { status: 'on' }
    }
});

Below you can see how the Consent Object is affected by this update.

/* Consent Object Before Update
{
    meta: { ... },
    consent: {
        status: "mixed",
        categories: {
            "1": { status: "on" },
            "2": { status: "off" }
        },
        vendors: {
            "1": { status: "off" },
            "2": { status: "on"}
        }     
    }
}
*/

// Update
cact('consent.update', {
    categories: {
        '2': { status: 'on' }
    },
    vendors: {
        '1': { status: 'on' }
    }
});

/* Consent Object After Update
{
    meta: { ... }, // automatically updated
    consent: {
        status: "all-on", // automatically updated
        categories: {
            "1": { status: "on" },
            "2": { status: "on" } // updated
        },
        vendors: {
            "1": { status: "on" }, // updated
            "2": { status: "on"}
        }     
    }
}
*/

Update IAB TCF/ACM categories and vendors

Accept all categories and vendors

Specifying a category or vendor will not have any effect.

Below you can see how the Consent Object is affected by this update.

Refuse all categories and vendors

Specifying a category or vendor will not have any effect.

Below you can see how the Consent Object is affected by this update. Note: required categories are not affected.

Specify update action

You can specify an action inside the update parameters:

This action value will be used to compute your dashboard metrics. If it is omitted, the default value is banner_button.

The allowed values are:

  • banner_button

  • pc_save

  • page_click

  • scroll

  • browse

Additionally, the following values are allowed for optout only (status: 'all-off' ):

  • banner_cross

Last updated

Was this helpful?