Adding cookie consent for adobe target implemented through utag.sync.js

Bronze Contributor
Bronze Contributor

I am about to add cookie consent banner to my site, I found some cookies from adobe are getting fired even I apply the load rules for all the tags. I think it is because I implemented adobe target in utag.sync.js and I don't have a target tag to add the load rule. Is it possible to add cookie consent to target implemented through utag.sync.js? or do I need to implement target as a tag to add load rules of cookie consent?

Can someone give me your thoughts. Thanks in advance

Naga Sai
4 REPLIES 4

Adding cookie consent for adobe target implemented through utag.sync.js

Tealium Employee

@NagaSai 

If you are adding the tag through utag.sync the script will be running . too early to rely on utag functions.

However you can wrap the target tag within an if statement which checks for the cookie itsself - something like this.

 

var consent_cat = "c1";
function readCookie(name) {
            return (name = (document.cookie + ';').match(new RegExp(name + '=.*;'))) && name[0].split(/=|;/)[1];
        }
var consent = readCookie("CONSENTMGR");
if (typeof consent !== "undefined" && (consent.indexOf(consent_cat + ":1") > -1 || consent.indexOf("consent:true") > -1)) {
    // ADOBE TARGET SCRIPT
}

updating "conset_cat" to whichever category in the CONSENTMGR you want to check

If you aren't using our built in consent manager, you can adapt the code accordingly to work with whatever cookie gets set.

Adding cookie consent for adobe target implemented through utag.sync.js

Gold Contributor
Gold Contributor

Hi. But this only works for the synchronous version of Adobe Target which is injected through the utag.sync.js directly and not via tag, right? 

Has anyone managed to make it work with the asynchronous tag? I experience the 3s white page because the required Adobe Target Content Modification extension which injects the hiding CSS in the utag.sync.js apparently always fires and if the user has opted out of - in my case - the personalization category, the tag will never fire and the hidden content will only show when the content hide timeout from the utag.sync.js happens.

Does not seem like the Content Modification extension can be extended with conditions like in other extensions.

Cheers
Björn

Adding cookie consent for adobe target implemented through utag.sync.js

Tealium Employee
Hello Björn

This should work for the situation you have described.
The line "// ADOBE TARGET SCRIPT" is referring the the placeholder ##UTSYNC## in your utag.sync template.

This placeholder is replaced with the anti-flicker logic from the content modification extension, so if this is wrapped within that if statement, it wont run when the condition isn't met.

If you are having some issues, I can always have a look at this with you if you raise a ticket :)

Adding cookie consent for adobe target implemented through utag.sync.js

Bronze Contributor
Bronze Contributor

Ignore my previous post, didn't read properly.

Public