How to Run Multiple GTM Containers on a Page

  • Hello dataLayer

How to Run Multiple GTM Containers on a Page

Do you have multiple Google Tag Manager containers running on your website?How to run multiple GTM containers

If so, you should ensure that your implementation follows Google’s recently-updated guidance:

Multiple containers are now officially supported. Multiple data layers are NOT supported.

In general, we recommend using a single container whenever possible. If external agencies or vendors need tags added to your site, it is better to have them send you the required code and to deploy it through your own GTM container, rather than adding a GTM container for each agency.

There are valid use cases for multiple containers, especially if you need the ability to restrict editing or publishing permissions to certain sets of tags. Since user permissions are assigned at the container level, this can currently only be accomplished by splitting your implementation into multiple containers.

Consider the scenario in which a company’s global office manages the websites of all its regional subsidiaries. Each regional office needs the ability to add tracking pixels for its local marketing campaigns, but regional users should not be able to affect the analytics tracking configured by the global office.

With a single container, either every tagging request of the regional office would need to go through global HQ or each regional office would need to have Edit and Publish permissions on the entire container. If both these options are unworkable, multiple containers would allow the global office to maintain its own tracking, while each regional office could implement tagging by themselves as needed.

Until recently, there was no official support for multiple GTM containers on a page. Unofficially, the common guidance previously was to rename the dataLayer for each container. However, Google’s new documentation explicitly states that using multiple data layers is not supported and can cause issues with your tracking:

Note that you can use only a single common data layer for all Google Tag Manager containers on a page because using more than one data layer can cause some triggers to stop working and could have other implications. So don’t rename the data layer for a subset of containers on the page.

Hence, if you have multiple data layers on your site, your tagging implementation may behave unpredictably or certain parts may break. We recommend updating your code in accordance with Google’s documentation for multiple containers.

What should I do if I have multiple data layers?

  1. Update any legacy GTM V1 “Listener” tags to V2 Triggers.
    • Listener tags were preserved when V1 containers were migrated to V2, hence any listener tags must be manually converted into triggers.
    • Running multiple GTM containers with v1 listener tags may cause issues.
  2. Use a single data layer name for all your containers.
    • We recommend using the default dataLayer whenever possible.
    • If necessary, choose a custom name (e.g. myCompanyDataLayer) and use it for all your containers.
    • Ensure that any dataLayer.push() functions reference the name of your common data layer, i.e. dataLayer.push() or myCompanyDataLayer.push()

Have you had any challenges with using multiple GTM containers? Let us know!

By |2018-07-25T11:11:27-04:00December 8th, 2015|1 Comment

One Comment

  1. Kartikeya May 8, 2018 at 9:16 am - Reply

    Thanks so much for this! Very insightful:)

Leave A Comment