02 Research / poster

ACM IMC 2026 ·

GTM-Config: Reverse Engineering Google Tag Manager in the Wild

Muhammad Jazlan, Eman Nabeel, and Zubair Shafiq

A static analysis framework that decodes a website's complete tracking configuration (pixels, events, triggers and consent gating) from its Google Tag Manager container.

54%
of the top 1M websites use Google Tag Manager
7,277
of the 32K websites we crawled load GTM (22.7%)
~200K
tags decoded from their containers
87.1%
of these websites fire at least one tracking event by default on page load
6.2%
consent-gate any event

Abstract

Google Tag Manager (GTM) is the most widely deployed tag management system, observed on 54% of the top 1M websites. GTM compiles a publisher's entire tracking configuration (the pixels to load, the events each pixel tracks, and the rules that determine when those events fire) into a single JavaScript file, gtm.js, served to every visitor. Prior work on GTM has primarily focused on which tags publishers deploy and what traffic those tags generate, with limited attention to the configuration itself. Dynamic analysis recovers it only partially.

We present GTM-Config, a static analysis framework that decodes a website's complete tracking configuration (pixels, events, triggers, and consent gating) from its gtm.js container. We build GTM-Config by iteratively configuring seven major tracking pixels in our own GTM deployment and diffing the compiled containers. We then crawl 32K general, health, and children's websites; 7,277 (22.7%) of them load GTM, and we decode their configurations, comprising roughly 200K tags. Our preliminary analysis shows that 87.1% of websites fire at least one tracking event by default on page load, that only 6.2% consent-gate any event, and that consent-gating mechanisms appear on only 2.9% of health websites, compared to 30.3% of general websites.

Why the container matters

As publishers install more tracking pixels, managing them one by one becomes complex. Tag management systems let a website add, configure and remove third-party scripts from one web interface, without editing its source code. Google Tag Manager (GTM) is the most widely deployed.

When a website configures tags in GTM, the tool compiles the entire configuration into a single JavaScript file, gtm.js, known as the container, which is served to every visitor. The container holds the publisher's complete tracking logic: the pixels to load, the events each pixel reports, and the rules that decide when those events fire, for example on page load, on scroll, or on a specific button click.

Why it is hard to read

  1. No specification. gtm.js is compiled, minified output. GTM's documentation explains what publishers can configure, not how it is encoded in the file.
  2. Dynamic analysis is incomplete. A crawler only sees the events its own behavior happens to trigger. Events gated on user interaction, custom conditions or consent state stay invisible unless every condition is exercised.
  3. Configuration is per site. The same tag on two websites may track entirely different events, so studying a tag in isolation shows what it can track, not what a given website does track.

Reverse engineering the container

We follow a differential approach. On our own website we change one GTM setting at a time (a pixel, an event, a trigger, a trigger condition), publish the container, and diff the compiled gtm.js against the previous version. We do this for seven pixels: Google Analytics 4, Universal Analytics, Meta Pixel, TikTok Pixel, Snapchat Pixel, Reddit Pixel and Microsoft Bing UET. Each is configured twice, as an official GTM tag and as a Custom HTML tag.

gtm.js bundles Google's runtime code with one JSON object that holds the website's configuration:

Component What it holds
tags The actions the container performs: load a pixel, send one of its events, or listen for the browser event a trigger waits for
macros GTM variables whose values are computed in the browser, such as the page URL, a cookie or a data-layer value
predicates Single conditions that compare the value of a macro with a constant
rules Compiled triggers: which predicates must hold, and which tags they fire or block
permissions What each template may do: the globals it may call, the scripts it may load, the URLs it may send data to
runtime The compiled code of each template

The arrays refer to each other only by index. A tag does not record its own triggers, so we find them by searching rules for the clauses that name the tag:

predicates[11] = {function: "_eq", arg0: ["macro", 0], arg1: "add_to_cart"}
rules[3]       = [["if", 11], ["add", 19, 21, 27, ..., 69, ...]]
tags[27]       = {function: "__gaawe", vtp_eventName: "add_to_cart", ...}

Here rule 3 fires tag 27, a GA4 event, when the data-layer event is add_to_cart.

From seven pixels to any tracker

The signals that identify the seven pixels are specific to each one. To cover any tracker, GTM-Config generalizes them into three rules that need only the tracker's domain as input:

  1. A loader template. Every template declares in its permissions the URLs it may load scripts from or send data to. A template that lists a URL on the tracker's domain is a loader for that tracker, and every tag using that template belongs to it.
  2. A URL in a tag. A tag that contains a URL on the tracker's domain belongs to the tracker, whether the URL is in a Custom HTML tag's code or in another setting.
  3. A call to a global function. A pixel sends its events through a global function, such as fbq for Meta. Every tag that calls a function defined by the tracker's loader, or whose template is allowed to access it, belongs to the tracker.

Preliminary results

These are the results reported in the poster.

  • 7,277 (22.7%) of the 32K general, health and children's websites we crawled load GTM, and their containers comprise roughly 200K tags.
  • 87.1% of these websites fire at least one tracking event by default on page load.
  • Only 6.2% consent-gate any event.
  • Consent-gating mechanisms appear on only 2.9% of health websites, compared to 30.3% of general websites.

Cite

@inproceedings{jazlan2026gtmconfig,
  title = {Poster: GTM-Config - Reverse Engineering Google Tag Manager in the Wild},
  author = {Jazlan, Muhammad and Nabeel, Eman and Shafiq, Zubair},
  booktitle = {Proceedings of the 2026 ACM Internet Measurement Conference},
  series = {IMC '26},
  pages = {1229--1230},
  year = {2026},
  doi = {10.1145/3777912.3847601}
}

← all publications