James Grace
James Grace

Reputation: 83

Install a GTM container from another GTM container

I work in an industry where it's very common to have multiple GTM containers and multiple Google Analytics IDs installed on a single site. Each install supports a different 3rd party vendor, interested party, etc.

I'm trying to develop a solution where a "master" Google Tag Manager container can install "child" GTM containers, so that clients can use a single GTM container to manage all of these installs rather than maintaining them via source code. (Another artifact of the industry is that these vendors change a lot, so it's common to need to add and remove tracking code regularly.) .

I haven't been able to find any guidance on this...does anyone have any?

Upvotes: 0

Views: 2330

Answers (1)

Eike Pierstorff
Eike Pierstorff

Reputation: 32780

In the commercial version of GTM this is an actual feature called "zones" (where each linked container is a "zone"). This does basically want you want to do, since alternative zones can be loaded conditionally (i.e. based on hostname). Even apart from the price tag the feature is not perfect, though - for example each zone loads all of the GTM boilerplate code, so will load way more JS that you actually need.

For the free version you are basically out of luck. In theory you can implement an alternative GTM container via a custom HTML tag - that worked for me during some casual testing a while back, but is completely with any support and explicitly goes against Google's recommendations, so you probably do not want to use this in production.

A workaround might be the "environments" feature, if you load a different configuration in each environment, but while this might save your clients the trouble of changing a five or six digit id in their source code it would make maintaining the containers a nightmare.

Upvotes: 2

Related Questions