Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update command to allow "undefined" values #3

Open
btripple opened this issue Dec 1, 2022 · 0 comments
Open

Update command to allow "undefined" values #3

btripple opened this issue Dec 1, 2022 · 0 comments

Comments

@btripple
Copy link

btripple commented Dec 1, 2022

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);
}
}`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant