I'm using Angular and need to call a third party script from a function inside another script tag.
For example:
In the index.html
let showOnHomePage = () => {
if (window.location.href === 'http://localhost:4100/') {
** I'm trying to run the scripts below conditionally. If taken out of the function the below scripts work. **
<script> var _ctct_m = "my_numberic_key would go here"; </script>
<script id="newScript" src="https://thewebsite.min.js" async defer></script>
}
}
showOnHomePage();
</script>```