Skip to main content
TagManifest /Docs Dashboard

Scan modes

Two scan modes: JSON export upload and public gtm.js scan. What each captures, what each misses, and when to use which.

On this page 5

TagManifest supports two input modes for container analysis. The JSON export scan accepts a GTM container export, sent as it was downloaded. The public scan fetches and parses the live gtm.js file served by the Google Tag Manager CDN. Both modes run the same rule engine, but they have different visibility into the container. Some rules require the richer data available only in an export.

JSON export scan

The JSON export scan takes a container in the data field of a POST /v1/scan request. Export the container from the GTM admin interface (Admin → Export container) and send the file's JSON as it is. The API recognises an export by its containerVersion key and parses it for you.

data also accepts a container that TagManifest has already parsed: an object with tags, triggers and variables arrays. Anything else is refused with a 400. See POST /scan for the exact checks.

The export format includes the complete container definition as Google stores it: full tag parameter sets, trigger configurations, variable values, folder assignments, workspace metadata, and a fingerprint on the tags, triggers and variables that GTM stamped with one. TagManifest reads each fingerprint as a date, the fingerprintDate, which records when the entity was last modified. An entity with no fingerprint gets a fingerprintDate of null. Rules that detect staleness depend on this date.

The export also includes data that the public gtm.js file leaves out, such as workspace-specific settings and folder structure. The referencedByTags cross-reference, which links triggers and variables to the tags that use them, is in neither file. TagManifest builds it from the tags in both modes.

Public gtm.js scan

The public scan fetches https://www.googletagmanager.com/gtm.js?id=<GTM-ID>, parses the minified JavaScript, and reconstructs a container-like object from it. This requires no GTM account access — any published container is scannable.

Pass either a gtm_id directly, or a url. When you pass a URL, the API fetches the page HTML and takes the first GTM container ID it finds there. That is the only use made of the page: the audit runs on the container, not on the page. The page fetch gives up after 8 seconds per request, follows at most 3 redirects, and reads at most 5 MB. Both inputs go to POST /v1/scan-url.

The public scan covers all tags, triggers, and variables that appear in the published container version.

What each misses

JSON export — what it cannot see

The export reflects the container at the time of export, not the live state of the page. If the export is from an unpublished workspace, it represents a draft state that may not match what visitors see. The API does not check the export against the page it runs on, such as other scripts on the page or a consent banner loaded outside GTM.

Public scan — what it cannot see

The CDN-served gtm.js file is a compiled representation of the published container. Several data types are absent or degraded:

  • fingerprintDate. The public file carries no fingerprints, so every tag, trigger and variable has a null fingerprintDate on a public scan. stale-paused-tags needs the date to work out how long a tag has been paused. It skips tags without one, so it returns no finding on a public scan. It can fire only on a JSON export scan.
  • Folder structure. The public file carries no folders. tags-no-folder skips public scans and returns no finding there.
  • referencedByTags resolution. Neither file carries this cross-reference. Both parsers build it from each tag's triggers and variable references. The public parser works from the compiled file, which may miss edge cases in complex sequencing chains.
  • Workspace metadata. Draft workspaces, submission state, and user annotations are not present in the public bundle.

Rule layers

Each rule in GET /v1/rules has a layer_requirements field, a string that names the data the rule needs. Every shipped rule has the value container: it needs only the container, so it runs in both scan modes.

One rule in the catalog, consent-page-cmp-not-enforcing, has the value container+page. Its status is deferred. It does not run through the API or the MCP server.

The API and the MCP server run no page checks. scan_url and POST /v1/scan-url read the page HTML only to find the GTM container ID, then audit that container. When you pass a gtm_id, no page is fetched at all.

The web scanner at tagmanifest.com adds its own page checks on top of the container audit. Those checks are not part of the API or MCP results.

A rule that needs data the public gtm.js file lacks returns no finding. It does not guess. stale-paused-tags is the example: it skips any paused tag that has no fingerprintDate.

Choosing a mode

Use the public scan when:

  • You want to audit a site without GTM account access.
  • You are running automated checks in CI against a deployed URL.
  • You need results in a single API call with no file handling.
  • You want to audit a container on a site you do not own.

Use the JSON export scan when:

  • You need complete coverage, including staleness detection and folder structure.
  • You are auditing a container before publishing (draft state).
  • You need to audit a private or internal container not reachable over the public web.
  • You need stale-paused-tags to fire.

Both modes return the same findings shape and the same health score structure. A POST /v1/scan-url response also has a site object with the URL, the GTM ID and the cache state.

Examples

JSON export scan
# Export your container from GTM → Admin → Export container.
# Send the export file as it is in the "data" field.

curl https://developer.tagmanifest.com/v1/scan \
  -H "Authorization: Bearer $TM_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"data\": $(cat container-export.json)}"
Public URL scan
curl https://developer.tagmanifest.com/v1/scan-url \
  -H "Authorization: Bearer $TM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'