Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexruzenhack/a993a8e34f2ae52b8093903433f5fa24 to your computer and use it in GitHub Desktop.
Save alexruzenhack/a993a8e34f2ae52b8093903433f5fa24 to your computer and use it in GitHub Desktop.
How to insert a hardcode javascript in head tag of the HTML DOM
<script type="text/javascipt">
try{
(function(window,document){
head=document.getElementsByTagName('head')[0];
script=document.createElement('script');
// treat the hardcode script tag
head.appendChild(script);
})(window,document);
} catch(e) {
console.log('[GTM][Error in tag "nomeDaTag"]: '+e);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment