13 November 2026 · 9 min read

Community templates in GTM: what you are actually installing

A gallery template is code written by someone you have never met, approved by you in a dialog, and then carried in every container where you install it. The dialog is the whole decision. Most people click Add and read it afterwards, or never.

That is not a small thing when you manage containers for clients. A template stays in a container long after the person who installed it has moved on. It can outlive the campaign it was built for, the vendor that published it and, in some cases, the vendor's website. So the useful question is not whether a template works today. It is what the thing is allowed to do once it is inside.

What a custom template is, in product terms

Google Tag Manager lets you write your own tag and variable definitions in the Templates section of a container. A template has four parts: basic information like the name and icon, the fields a user fills in, the code that runs, and a permission list that limits what that code can reach.

Tag templates show up as new options under Tags, then New, in a Custom section. Variable templates show up under Variables, then New, and differ in one structural way: a variable template has to return a value, while a tag template signals completion by calling the success handler instead.

Custom and community templates work on web and server-side properties only. Google has said mobile support would come later, and as of this writing it has not arrived.

Why it is not the same as a Custom HTML tag

Google's own description of the feature makes the comparison directly: the permission model and the sandbox make templates a safer way to run custom logic than Custom HTML tags or custom JavaScript variables. The sandbox is the part worth understanding, because it explains both what a template can do and what it cannot.

Template code runs as sandboxed JavaScript, a restricted subset based on ECMAScript 5.1, with some later features such as arrow functions and block-scoped declarations available. It does not run in the normal global environment. There is no window object, so there is no document, no location, and none of the global helpers a normal script takes for granted, including encodeURI and setTimeout. A template that needs one of those imports it through a require call. Values that live on the window can be read with copyFromWindow, which makes a deep copy and is accordingly expensive.

The type system is simplified too. There is no new keyword, no this inside functions, and no global constructors such as String() or Number(). Whatever the template does, it does with a narrow set of tools.

That narrowness is real protection. A gallery template cannot quietly walk your DOM, read every cookie or call an arbitrary global function, because the language it runs in does not reach those things. What it can reach is set by the permission list.

The disclaimer Google puts on the gallery

The Community Template Gallery is a catalogue of tag and variable templates built by third-party developers. Google states the position plainly: the content is provided by third party developers, not by Google, and Google makes no promises or commitments about the performance, quality or content of those templates.

That sentence is not legal decoration. It tells you where the responsibility sits. A template that breaks a container, sends data to a domain that later changes hands, or stops being maintained is your problem in your client's property. The gallery listing is a shop window, not a review.

How one gets into your container

Inside Tag Manager, open Templates, find the Tag Templates or Variable Templates section, and click Search Gallery. Filter the list, open the entry you want, and click Add to workspace. Before the template loads, Tag Manager shows you the permissions it is asking for. Add confirms, Don't add cancels.

Each template detail page carries the author, the required permissions, and usually a link to the template's GitHub repository, sometimes with links to documentation and support. The repository is the most informative part of the listing and the part people skip. A last commit from three years ago, a wall of open issues about breakage, or no repository at all are all answers to the question you are about to answer with a click.

Reading the permission list properly

Web templates draw on eighteen permissions. In the interface they read as plain sentences: reads URL, reads referrer URL, reads cookie value(s), sets a cookie, reads data layer, writes data layer, accesses global variables, accesses local storage, accesses template storage, reads analytics storage, reads container data, reads event metadata, reads document title, reads document character set, sends pixels, injects scripts, injects hidden iframes, logs to console.

Most of them are harmless in context. Reading the document title or the character set tells you nothing about a visitor. Logging to console matters only for noise. The set that deserves a second look is smaller than the list:

Google's documentation explains where the list comes from. Permissions are checked by the APIs that need them and detected automatically from the sandboxed code as it is edited and compiled, so the list reflects what the code actually calls. A template cannot ship with fewer permissions than its code requires. It can, however, ship with wider scope than the job needs, which is why scope is what you review. A pixel helper that asks to inject a script from a domain you cannot identify is not a pixel helper.

URL match patterns are the real limit

For the three outbound permissions, the control is an allowed URL match pattern. The rules are strict and worth knowing before you judge one:

A pattern has to use HTTPS. It has to specify both a host and a path, and the path has at least a single slash. The host can be a specific subdomain or a domain. Wildcards are written as an asterisk preceded by a backslash, and they match any length of subdomain or path, so a pattern covering a wildcard subdomain covers every subdomain at once. Add one pattern per line. A URL with nothing after the slash is treated as ending in a wildcard.

If the URL that the code tries to call does not match an allowed pattern, the call fails. That gives you a useful test: compare the pattern against the endpoints you would expect the vendor to use. A wide pattern on a narrow purpose is the mismatch that matters, and it is visible in the install dialog if you look.

Consent is not inherited

This is the part that most often goes wrong in a client container, and it goes wrong quietly.

Tags built by Google can carry built-in consent checks, meaning the tag itself changes behaviour based on the visitor's consent state. A third-party template has no built-in check unless its author wrote one. It arrives as a tag that fires when its trigger fires.

The lever you have is in the tag, under Advanced Settings, then Consent Settings. The Additional Consent Checks option has three states. Not set is the default and performs no extra checks. No additional consent required records that you reviewed the tag and decided it needs nothing beyond its built-in behaviour. Require additional consent for tag to fire means the tag only fires when every listed consent type reads granted. The types available are advertising storage, advertising user data, advertising personalisation and analytics storage, alongside the storage types for functionality, personalisation and security, and you can add custom types that your consent platform emits.

The Consent Overview page gives you the container-wide view of those settings, which is the practical way to find the tags nobody classified.

There is one more piece of plumbing worth knowing. The Consent Initialization trigger exists to run consent-related tags before anything else fires, including Initialization triggers. Google's note for anyone writing their own templates or Custom HTML is specific: commands run in callbacks, or any command that goes through gtag(), are not guaranteed to be available before the next trigger fires, so consent state should be read through the Tag Manager Consent APIs instead. A gallery template that ignores that advice may report consent a beat later than it should.

Updates, and the trap after the first edit

When a publisher updates an imported template, Tag Manager shows a notification bar on the container's main screen. View opens a list of templates with updates. Choosing one shows a comparison between the installed version and the new one. Accept update installs it and keeps your field values across both versions. Skip update leaves the current one in place. In either case, testing and republishing the container is what makes the change take effect.

The trap is the template editor. Once you edit an imported template, it stops receiving publisher updates. If you later decide you want them again, re-importing means discarding your edits. So a small local fix, made casually, converts a maintained dependency into a frozen copy. If the fix matters, the durable move is a pull request to the author's repository, not an edit in a client container.

A review routine that takes ten minutes

  1. Read the listing's permission dialog, not only the description. List what the template is allowed to reach.
  2. Open the repository. Check the last commit date and whether the issue list describes breakage.
  3. Check each outbound URL pattern against the vendor's documented endpoints.
  4. Decide the consent setting for the resulting tag on purpose. Not set is a decision only when you made it.
  5. Install into a workspace, not straight into a publish. A template change is a container change like any other.
  6. Test in preview mode on a real page, then in one non-production environment if the site has one.
  7. Record the template, its version, the container and the reason in the handover notes. The next person will not infer it from the container.
  8. If you standardise a template across client containers, export the reviewed copy as a template file and import that, so every container runs the version you vetted rather than whatever the gallery holds today.

None of this argues against using templates. A well-built one replaces a page of Custom HTML that nobody can maintain, and the permission model is a genuine improvement on pasting a script into a container. It argues for treating the install dialog as the review it was designed to be. Eighteen permissions, one decision, and a container that stays in a client's property long after the campaign is over.

Not sure what is already installed in your containers? Book a free tracking audit and we will inventory the custom templates, check their consent settings and tell you which ones are running unmaintained.