External JS file reference in DTM
Hi,
We have a Event based rule that calls a function in an external JS file. We want to add a reference to that JS file from with in DTM. Is this possible and if so how/where should we add it?
Thanks in advance.
Hi,
We have a Event based rule that calls a function in an external JS file. We want to add a reference to that JS file from with in DTM. Is this possible and if so how/where should we add it?
Thanks in advance.
One solution would be to create a global page load rule that loads your external script at, for example, "Page Bottom". In the "JavaScript/Third Party Tags" section, add a new "Non-Sequential" script. Then use something like the following to append the library to the page:
var script = document.createElement('script'); script.src = 'http://example.com/js.js'; // your script URL script.onload = function () { //this is only necessary if you need to call something directly after the script loads }; document.head.appendChild(script); // adds external script to pageAs long as your Event based rule will fire after this is loaded, you should be good to go.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.