Skip to main content
TagManifest /Docs Dashboard

Caching

5-minute container cache keyed by GTM ID. Avoids re-fetching gtm.js on repeated calls to the same container.

On this page 5

TagManifest caches parsed GTM containers for five minutes, keyed by container ID. The first scan of a given container fetches gtm.js from the Google Tag Manager CDN and stores the parsed result. Later calls for the same container reuse that parse for up to five minutes instead of fetching again.

What is cached

The cache stores the parsed container object — the structured representation of tags, triggers, variables, and metadata extracted from gtm.js. The raw JavaScript source is not stored. All rules run against the same data structure regardless of whether the response came from the CDN or the cache.

The cache is keyed by GTM container ID (e.g. GTM-EXAMPLE). Two calls that resolve to the same container — one via url, one via gtm_id directly — share the same cache entry.

TTL and expiry

A cache entry is reused for up to 300 seconds (5 minutes) after it is written. Each write stores an expires_at timestamp. A read that finds an entry past its expires_at ignores it and fetches gtm.js again. The new parse then replaces the old entry and starts a new five-minute window.

Expiry is checked when an entry is read. An expired entry is never used, but it is not deleted at the five-minute mark.

The 5-minute window matches how GTM publishes. Containers change only when someone explicitly publishes a new version. Five minutes covers normal iterative use — running scan_url then evaluate_rule against the same container. The cache does not check for a new publication. A version published inside the window is not picked up until the entry expires.

Which endpoints use it

The cache is used whenever a container is resolved from a URL or a GTM ID:

SurfaceUses the cache
RESTPOST /v1/scan-url, POST /v1/evaluate-rule
MCPscan_url, evaluate_rule, get_health_score, compare_containers

All of these share one cache. A container fetched by a REST call is reused by an MCP call for the same GTM ID, and the other way round.

The cache is skipped when you pass the container yourself in data. There is no gtm.js fetch to save in that case. For the same reason POST /v1/scan and the scan_container tool never use the cache.

from_cache field

The from_cache field says whether the parsed container came from the cache or from a fresh fetch. Where it sits depends on the surface:

CallField
REST POST /v1/scan-urlsite.from_cache
REST POST /v1/evaluate-rulecontainer.from_cache
MCP scan_url, evaluate_rule, get_health_scorecontainer.from_cache
MCP compare_containersNot reported. The tool uses the cache but its result has no from_cache field.
from_cacheMeaning
falseContainer was freshly fetched from www.googletagmanager.com and parsed.
trueContainer was served from the cache. Rules ran against the stored parse.
nullYou passed the container in data, so nothing was fetched.

A cached parse skips the fetch from Google. The rules still run on every call, and a call made with a url still fetches the page first to find the container ID.

Implications

A newly published version can take up to five minutes to show. If you publish a new GTM version and scan straight away, the result may be based on the previous version. There is no option to skip the cache. Wait five minutes and scan again.

Rate limits count cache hits the same as cache misses. A scan_url call that returns a cached container still adds one to your daily scan_url count. The cache saves time, not calls.

Examples

Cache hit — REST scan-url (excerpt)
{
  "scanned_at": "2026-05-04T14:02:11.441Z",
  "duration_ms": 34,
  "site": {
    "url": "https://example.com",
    "gtm_id": "GTM-EXAMPLE",
    "from_cache": true
  }
}
MCP scan_url result (excerpt)
{
  "container": {
    "gtm_id": "GTM-EXAMPLE",
    "tag_count": 85,
    "from_cache": true
  }
}
Cache miss — first fetch
{
  "scanned_at": "2026-05-04T14:02:00.001Z",
  "duration_ms": 487,
  "site": {
    "url": "https://example.com",
    "gtm_id": "GTM-EXAMPLE",
    "from_cache": false
  }
}