By default, instead of splitting the Google Tag Manager (GTM) container code, Qualifio places it in the body section. In this article, we will show you how to follow Google's recommendations and place one tag in the head and the other in the body.
The GTM container code is made up of two parts:
Here's what the perfect and recommended scenario looks like:
- In the first part, we see a script tag. It goes in the head.
- In the second part, we see a no script tag. It goes in the body.
But real-life situations are far from perfect and sometimes we have to deal with very limited circumstances.
While working with Qualifio, you can't access the campaign's source directly and you're only allowed to paste tracking codes into a dedicated field. Then, Qualifio automatically places your GTM code in the body tag rather than following Google's recommendations. Which means that, when adding your GTM code to your Qualifio campaigns, you can only add it in the body tag.
Why? Google once recommended placing the entire container code after the opening of the body tag, but the recommendations of Google Tag Manager are now a little different.
Can I move my GTM code to follow the new instructions?
The previous approach is still working to this day, so there is no immediate need to move your GTM code. But this could potentially mean you're not tracking users who leave your page before the body tag is loaded.
While it is not the default option, it is possible to split the GTM code and put the <script> and <noscript> tags at the recommended places.
Follow the steps below:
- Find your container ID in Google Tag Manager (in the top navigation, under the Admin option).
- Copy the code below and replace "GTM-ABC123" with your container ID:
Where does this go?
There are two places where you can put it:
- In your campaign > Channels > Tags > Additional HTML code (to track a specific campaign). Like this:
- Or by going to Settings > Websites > Tags > Additional HTML code (to track campaigns published on a specific website). Like this:
Click Save to apply your changes.
That's it, it's pretty simple. This will ensure that your marketing tags in GTM will be fired as soon as possible without much data loss.