1

I am trying to understand how GTM works. Having inserted the container code to my page, I created two tags, "Custom HTML Tag" and "Custom Image Tag" and published them. In the "Custom HTML Tag", I wrote:

<div>wsk</div>
<script>console.log('wwwssskkk')</script>

In the "Custom Image Tag", I set the image URL.

You can see this HTML page I use to conduct this test: http://www.xrsand.com/word2html.html. Now there are several problems I think are critical in order to further understand how GTM works:

  1. Turns out the codes in "Custom HTML tag" are inserted into the page before the closing body tag, but the "Custom Image Tag" is not. So what is this "custom Image Tag" supposed to do?

  2. In Chrome only, a tag manager iframe appears.

    This won't appear in other browsers. Why? And I don't think regular users are supposed to see this iframe. How to turn it off?

1

The custom image tag requests an image from the given url, but does not insert it into the DOM. Making the image request is enough to transmit information to a server, and GTM is not supposed to change the Layout of the page in any case.

As for the second question, that's the preview mode that is used to debug tags. This is enabled via a cookie after you click the preview link, so it's visible only in the browser instance in which you clicked the link - other users will not see this at all. You can leave the preview mode by clicking the "Leave preview mode" at the top of your admin interface (if you are in preview mode there is an orange bar at the top of the admin interface that says "previewing version" and the version of the container, there you will find the leave preview link).

  • GTM is not supposed to change the Layout of the page in any case.. Actually, if you see this link I mentioned above:xrsand.com/word2html.html, at the bottom of the page, there is a div with wsk, this is from the custom html tag – Wen Shenk Sep 5 '15 at 21:53
  • @WenShenk, yes, I see that. GTM is "not supposed to" because Google recommends against it, not because it's not possible (since GTM is asynchronously loaded you cannot tell when a layout change implemented via GTM would happen, that's why it's not necessarily a good idea). – Eike Pierstorff Sep 6 '15 at 8:54
  • You said "image tag requests an image from the given url", but how? ajax request? – Igor G. Dec 16 '15 at 14:38
  • Ajax is not necessary, e.g. simply creating an image via new Image() and attaching a source property will result in an request. – Eike Pierstorff Dec 16 '15 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.