Skip to content

Update command to allow "undefined" values #3

@btripple

Description

@btripple

Consent Update Command only allows "granted" or "denied". I am proposing you allow for undefined values.

Use case:

  • Default command may allow analytics tracking (North America)
  • Update command (initialization trigger) has to pass "granted" or "denied" based on the consent manager cookie being available.
  • This unknowing will over ride the default command on first pageview where consent manager cookie has not been set. Or requires additional GTM configuration to bypass the issue.

Above situation you would want to honor the default command and avoid updating.

Proposed code to fix issue:
`// Process updated consent state
if (data.command === 'update') {
var config_object={};
var categories=["ad_storage","analytics_storage","personalization_storage","functionality_storage","security_storage"];
var i;
for(i = 0; i < categories.length; i++){
if(data["update_"+categories[i]]!=undefined){
config_object[categories[i]]=data["update_"+categories[i]];
}
}

if (data.sendGtag) {
gtag('consent', 'update', config_object);
}
updateConsentState(config_object);
if (data.sendDataLayer) {
dlPush(false, data.update_ad_storage, data.update_analytics_storage, data.update_personalization_storage, data.update_functionality_storage, data.update_security_storage);
}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions