I am trying to add a custom html tag via my Google Tag Manager. I followed this guide: how to add Custom html, but the tag is not added.
This is what I did.
I created a new tag and added my code via the custom html. The code below is what i added to the HTML section.
<script>
console.log('Hello test two!');
</script>
<div>
<span>Hello testing three this works!</span>
</div>
I then created a trigger for the tag. The trigger is the "All Pages" default trigger.
I then did a preview test to see if the tag is triggered. It is indeed triggered. However when I then viewed the header of my webpage I cannot find the tag.
I also tried this trigger "Page view- DOM Ready" but it's still not working.
First of all, the best practice is to never deploy divs and other visible elements via a tag management system (TMS).
Secondly, you don't put divs in the head. Head isn't rendered. You put them in body. And in super rare cases when you need to do that via a TMS, you do that with JS. If you put something in head and it renders, it implies that whatever you put there implicitly closed the head tag since it doesn't require closure.
It's also puzzling how you debug it. Checking if the tag fires in preview is fine, but then you deploy two tags. Div is irrelevant, but script is. In the script, you console.log. Why don't you check your console? Seems easier than checking the DOM. Also add screenshots. You may be checking wrong things.