For when you need to add a 3rd party script only to a customer-facing site/page. This prevents the script from injecting content in the content area and then the CMS saves/publishes it as manually entered content.
Add the following within the else {}s of the if (top != self) section in our scripts.
if ($('div_class_or_id').length){ // only load script if a specific div container needs to be there. change to class or id in jQuery selector
script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = 'script_url'; // change me
document.getElementsByTagName('head')[0].appendChild(script);
}
Tags: cms, javascript, js, jquery, script