Overriding Environment on Self Hosted Profiles.

Gold Contributor
Gold Contributor

Ocassionally we'll use the Web Companion to load our dev utag.js file and test it in production. Historically it's worked, although we had to update the hostname in the utag_env_<account>_<profile> cookie from our prod hostname to our dev hostname.

 

In a new profile we recently published, that's not working anymore. It looks like utag.js expected the cookie path to contain Tealiums CDN. If it doesn't, the value of the cookie is ignored.  Can we get this functionality back?

1 REPLY 1

Overriding Environment on Self Hosted Profiles.

Tealium Employee

Hi @steve_crawford

 

What you are seeing is an update that occurred, based on the results of a security audit. The "openness" of the cookie could potentially allow for Cross Site Scripting attacks to be done, against the site. It would effectively kill the utag.js file from loading and load a script from another location on the web.

 

I am currently in the process of upgrading the Environment Switch Tealium tool to cope with self-hosted utag.js files. In the meantime, I would suggest using tool like Charles Proxy or Fiddler to redirect the request.

 

If you really want to use the old logic, add this to a pre-loader, this must be the first JS extension.

 

 
var utag_condload = false;
try {
var account = "", profile = "", env = "prod";
(function () {
function ul(src, a, b) {
a = document;
b = a.createElement('script');
b.language = 'javascript';
b.type = 'text/javascript';
b.src = src;
a.getElementsByTagName('head')[0].appendChild(b)
}
if (("" + document.cookie).match("utag_env_"+account+"_"+profile+"=([^\S;]*)")) {
if (RegExp.$1.indexOf("/"+env+"/") === -1) {
ul(RegExp.$1);
utag_condload = true;
__tealium_default_path = '//tags.tiqcdn.com/utag/'+account+'/'+profile+'/'+env+'/';
}
}
})();
} catch (e) {
utag_condload = true;
console && console.error && console.error("Error changing utag.js path");
}

 

 

Adrian

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.
Public