Reputation: 83
I need to put this code at the top of the body section of my HTML using Google Tag Manager. I am not able to understand how to put this at the top of 'body' section.
<script>
window.__crmp = {
config: {
storeData: false,
appliesGlobally: false,
testingMode: 'never show' //change to 'normal' when testing is complete
}
}
</script>
<script src = 'URL' async> </script>
Any help is greatly appreciated. Thanks!
Upvotes: 1
Views: 6114
Reputation: 4360
You can write javascript to place your code directly at the top of the body
tag via Google Tag Manager (GTM), but it would help with the order of when it's triggered. If you need to execute it before the page loads, here is what you can do:
That will execute your code before the page loads which is equivalent to your cod being inside the body
tag, but not necessarily at the top of it. You can't control that unless you actually place that javascript snippet directly in the html of your site.
Edit: I just checked and it looks like the "Page View" trigger is fired before the "DOM Ready" one, so I would probably use that instead, in your case.
Upvotes: 1