- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
10-05-2023 04:08 PM
We are using utag loader version 4.49. We use an external privacy/consent vendor and use a snippet of JS to inform Tealium iQ when consent status has changed. Our call to utag.gdpr.setPreferencesValues is failing internally when the setPreferencesValues function calls utag.gdpr.getTraceId. The getTraceId method is undefined, even though this is internal Tealium code calling it!
Has anyone encountered this before? I am reluctant to make the move to 4.50 or 4.51 unless we know this is resolved.
The utag.gdpr.setPreferencesValues implementation is below. The code is blowing up four lines from the bottom in the call to getTraceId.
Thank you,
Christopher
setPreferencesValues: function(categories, noCollect) {
var cookie_data = utag.gdpr.getCookieValues(), lookup = {}, i, rgx = /\D/, names = utag.gdpr.getCategories(), chosen_list = [], consent_seen = false, decline_seen = false, crgx = /c\d/, fld;
try {
for (i = 0; i < names.length; i++) {
lookup[names[i]] = 'c' + (i + 1);
}
for (var cat in categories) {
if (!categories.hasOwnProperty(cat)) {
continue;
}
if (cat.match(rgx)) {
cookie_data[lookup[cat]] = categories[cat];
if (categories[cat] != 0) {
chosen_list.push(cat);
}
} else {
cookie_data["c" + cat] = categories[cat];
if (categories[cat] != 0) {
chosen_list.push(names[cat - 1]);
}
}
}
for (fld in utag.loader.GV(cookie_data)) {
if (fld.match(crgx)) {
if (cookie_data[fld] != 0) {
consent_seen = true;
} else {
decline_seen = true;
}
}
}
cookie_data["ts"] = new Date().getTime();
cookie_data["consent"] = consent_seen;
utag.gdpr.setCookie(cookie_data);
} catch (e) {
utag.DB(e)
}
if (noCollect) {
return;
}
var xhr = new XMLHttpRequest();
xhr.open("POST", "https://collect.tealiumiq.com/event");
var tealiumEvent = '"tealium_event":';
var consentCategories = '"consent_categories":';
if (decline_seen) {
if (consent_seen) {
tealiumEvent += '"grant_partial_consent",';
consentCategories += JSON.stringify(chosen_list) + ",";
} else {
tealiumEvent += '"decline_consent",';
consentCategories += "[],";
}
} else if (!decline_seen && consent_seen) {
tealiumEvent += '"grant_full_consent",';
consentCategories += JSON.stringify(utag.gdpr.getCategories(true)) + ',';
}
var traceId = utag.gdpr.getTraceId();
var traceIdInfo = traceId ? '"cp.trace_id":"' + traceId + '",' : "";
var visitorId = utag.gdpr.setVisitorId();
xhr.send('{"tealium_account":"logitech",' + '"tealium_profile":"' + (utag.gdpr.eventProfile || "main") + '",' + tealiumEvent + consentCategories + '"policy":"gdpr",' + traceIdInfo + '"tealium_visitor_id":"' + visitorId + '"}');
}
Solved! Go to Solution.
10-06-2023 09:00 AM
@cfuselierlogi It looks like you might need to update the template for consent logging.
There's a release note related to trace_id
that highlights the issue:
https://docs.tealium.com/iq-tag-management/consent-management/release-notes/#march-2023
I recommend running a template status check to see which of your consent templates are out of date.
Hope that helps.
10-06-2023 09:59 AM
@cfuselierlogi @TealiumJustin - could you open a Support ticket for this please? It sounds like you're using a very old version of the Consent Manager, before we used templates - a recent update we made to improve consent logging seems to have broken those very old versions, but Support can walk you through updating to a more recent, template-based version!
10-11-2023 01:11 PM
Thank you both for your responses. We did open a support ticket, and Tealium confirmed that there was a bug in the consent module that our site was using. Some functions called within utag.gdpr were undefined, and those internal calls were failing. They suggested we stub in three functions to work around this problem, as follows:
utag.gdpr.getTraceId = function(){};
utag.gdpr.setVisitorId = function(){};
tealiumSetCookiesConsent = function(){};
We did so, and our tag firing has normalized.
The support contact also suggested we upgrade to Consent Manager v3. We can do that when we are ready now that the suggested workaround is in place.
Copyright All Rights Reserved © 2008-2023