Highlighted

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

Rookie 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

1 REPLY 1
Highlighted

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.