Avatar

Employee

There are 2 things which might be causing this:

1) Important thing here is the time at which this dynamic addition of the script is happening. Please ensure this script gets loaded  on the page well before, or, at the time when DOM gets created. Something like document.ready() in Jquery, or, something like below  if using plain Javascript:

document.addEventListener('DOMContentLoaded', function(){
  
// your code goes here
}, false);

2) Try appending http:// as the prefix to the DTM Embed URL you are using.

analytics.src ='http://assets.adobedtm.com/someID-staging.js';