Angular2 and Adobe Analytics Script

I'm trying to implement Adobe Analytics. I need to place a script tag in the index.html. The script tag is different based on the environment (dev, prod, etc). I don't have access to environments.ts from index.html as far as I know.

I tried using this code but because we do not know how long it will take to load the page, sometimes we are capturing our prod analytics to the dev environment. I can increase the timeout, but this would not be the right approach I think.

setTimeout(function(){ if(window.sessionStorage && window.sessionStorage['ng2-webstorage|production'] === 'true'){ $.getScript( "//, function( data, textStatus, jqxhr ) { _satellite.pageBottom(); }); }else { $.getScript( "//", function( data, textStatus, jqxhr ) { _satellite.pageBottom(); }); } }, 1000);

Does anyone know how can I set this up?

Login to post a comment