Why can't Google Tag Manager be installed within another HTML element under the body?

Viewed 4096

The instructions for Google Tag Manager insists installing Google Tag Manager code immediately after the opening body tag. However, this is not always possible for some websites (without a ton of modification).

Trouble is, you can install Google Tag Manager elsewhere within a page and the tags appear to fire. However, if you check the installation with Google Tag Assistant, it fires a critical issue:

"Error: tag must not be included in a <div>"

When you click on the error message, you're directed to Google's lean documentation :

Google Tag Manager Tag should be placed immediately after the opening tag and not inside any other HTML element. The Google Tag Manager snippet must be placed directly in the page that you intend on tracking. Placing it in a hidden iframe or deploying it within another tag management system will prevent certain tags from accurately tracking the parent page. Tags added via Google Tag Manager may not fire. Please make sure to place the GTM snippet immediately after the opening tag.

  • Which sorts of tags won't fire?
  • Is it only for certain browsers?
  • Will it cause other issues?
2 Answers
Related