# Container JSON: the fields the audit reads

The scripts read three shapes of the same data: a ContainerVersion resource from the Tag Manager API v2 in different wrappers. Checked on 2026-11-01 against the API v2 reference (Tag, Trigger, Condition, Parameter, Variable, CustomTemplate, Zone, ContainerVersion, GtagConfig), Google's gtm-boilerplate export (`exportFormatVersion` 2), Google's ga4-gtm-utilities code and Meta's archived GTM template. Re-check the reference when a field seems missing, and compare with the user's own export.

## The three input shapes

- UI export: `exportFormatVersion` (2 in every export seen), `exportTime` (`YYYY-MM-DD HH:MM:SS`, no timezone; read as UTC) and `containerVersion`.
- API read: `versions.live` or `versions.get` returns the ContainerVersion itself, with no wrapper and no `exportTime`.
- MCP read: pages assembled by `scripts/assemble-mcp-pages.mjs`, which writes the UI export shape (with `exportTime` only when `--read-time` is given, so always give it). A single page or a saved tool result passed straight to the audit is refused with exit 2.

## Enum spelling

- UI exports use upper snake case (`CUSTOM_EVENT`, `MATCH_REGEX`, `ONCE_PER_EVENT`, `NOT_SET`); the API reference uses camel case (`customEvent`, `matchRegex`, `oncePerEvent`, `notSet`). The scripts remove underscores and lower-case every enum before comparing, so the audit and the diff treat both spellings as the same version (the regression check proves it on the Acme export).
- Tag and variable type codes (`googtag`, `gaawe`, `html`, `c`, `v`) are the same in both.

## containerVersion fields

- `containerVersionId`, `name`, `description`: R14. Workspace exports and assembled workspace reads show `"0"` or no ID; the audit reports them as not a published version (an INFO line, not scored). Assembled `gtm_version` live pages keep the live ID.
- `fingerprint`: documented only as computed at storage time. The assembler uses it to detect a publish mid-read; never read it as a timestamp.
- `container`: `name`, `publicId`, `usageContext` (`WEB`, or `SERVER` for a server container).
- `tag[]`, `trigger[]`, `variable[]`, `builtInVariable[]`, `customTemplate[]`, `folder[]`, `zone[]`, `client[]`, `gtagConfig[]`, `transformation[]`.
- The Settings tab (Google destinations, consent mode override, default consent settings, automatic event detection, domains) is not described in the ContainerVersion reference. Treat it as not in the file.
- A partial export keeps variable references but drops missing tag and trigger references (Google's export help); R10 makes a partial file visible.

## Tag fields

```json
{
  "tagId": "6",
  "name": "Ads - Conversion - Purchase",
  "type": "awct",
  "parameter": [{ "type": "TEMPLATE", "key": "conversionId", "value": "{{Const - Ads ID}}" }],
  "firingTriggerId": ["10"],
  "blockingTriggerId": ["17"],
  "paused": true,
  "liveOnly": false,
  "priority": { "type": "INTEGER", "key": "priority", "value": "10" },
  "parentFolderId": "3",
  "notes": "Owner: paid search lead",
  "setupTag": [{ "tagName": "HTML - set checkout data", "stopOnSetupFailure": true }],
  "tagFiringOption": "ONCE_PER_EVENT",
  "consentSettings": { "consentStatus": "NEEDED", "consentType": { "type": "LIST", "list": [{ "type": "TEMPLATE", "value": "ad_storage" }] } }
}
```

- `blockingTriggerId` (exceptions) sits outside `parameter`; tags copied by parameters through the API lose it.
- `tagFiringOption`: `unlimited`, `oncePerEvent` (the default when absent), `oncePerLoad` (R17).
- `liveOnly`: the API says the tag then fires only in the live environment, not in preview or debug mode. Read the UI label in the tag's advanced settings.
- `priority` is a Parameter; `monitoringMetadata` is a MAP Parameter (empty in Google's boilerplate) that the audit ignores.
- `consentSettings.consentStatus`: `notSet`, `notNeeded`, `needed`. A missing block is treated as not set.
- `setupTag` and `teardownTag` refer to other tags by name. `scheduleStartMs` and `scheduleEndMs` are millisecond strings.

## Parameters by tag type

- `googtag` (Google tag): `tagId` (G- or AW- ID, often a Constant), `configSettingsTable` and `eventSettingsTable` as LIST of MAP rows with keys `parameter` and `parameterValue`, and references to settings variables. Rows the rules read: `send_page_view`, `server_container_url`, `transport_url` (R03, R13); `debug_mode`, `user_id`, `ignore_referrer`, `campaign_*`, `cookie_*`, `page_location`, `page_referrer`, `client_id`, `linker`, `allow_google_signals`, `allow_ad_personalization_signals` (R20). Google's boilerplate export ships `debug_mode` = `true` in its Google tag, which is why copies of it leak debug traffic.
- `gaawe` (GA4 event): `eventName`, `measurementIdOverride`, `sendEcommerceData` (BOOLEAN), `getEcommerceDataFrom` (`dataLayer` or `customObject`), `ecommerceMacroData`, `eventSettingsTable`, `userProperties` (LIST of MAP with `name` and `value`), `userDataVariable`.
- `awct` (Google Ads conversion): `conversionId` (bare digits), `conversionLabel`, `orderId`, `conversionValue`, `currencyCode`, `enableConversionLinker`, `enableEnhancedConversion`, `cssProvidedEnhancedConversionValue` (a User-Provided Data variable). Keys from Google's boilerplate export.
- `awcc` (Google Ads Calls from Website Conversion): `phoneConversionNumber`, `conversionId`, `conversionLabel`. `awud` (Google Ads User-provided Data Event): `conversionId`, `userDataVariable`, `enableConversionLinker`. Both codes and their keys were read in public Tag Manager templates on 2026-11-06; neither code is on Google's published tag type list, so compare with the user's own export.
- `flc`, `fls` (Floodlight): `advertiserId`, `groupTag`, `activityTag`, `countingMethod`, `orderId`, `revenue`.
- `sp` (remarketing), `gclidw` (Conversion Linker: `enableCrossDomain`, `linkerDomains`, `acceptIncoming`, `formDecoration`, `urlPosition`, `enableUrlPassthrough`), `html` (`html`, `supportDocumentWrite`), `ua` (`trackType`, `gaSettings`).
- `cvt_<containerId>_<templateId>`: a tag built from a template. Its parameters are whatever the template defines. Meta's archived template uses `pixelId`, `eventName` (standard or custom), `standardEventName`, `eventId` (passed to Meta as eventID), `consent`, `advancedMatching`, `disablePushState` and `disableAutoConfig`; current gallery versions may differ, so the script falls back to the template's permissions and name.
- Destination tags (12 October 2026): type codes not confirmed; reported as unclassified.

## Template fields

- `customTemplate[]`: `templateId`, `name`, `templateData` (the .tpl text with sections `___INFO___`, `___TEMPLATE_PARAMETERS___`, `___SANDBOXED_JS_FOR_WEB_TEMPLATE___`, `___WEB_PERMISSIONS___`) and, for gallery templates, `galleryReference` (`host`, `owner`, `repository`, `version`, `signature`, `isModified`).
- `___WEB_PERMISSIONS___` is a JSON array. Each entry names a permission in `instance.key.publicId` and lists parameters under `instance.param`, with allowed URLs as `{ "type": 1, "string": "https://..." }` items. R01 and R25 read the URLs under `inject_script`, `send_pixel` and `inject_hidden_iframe`; R25 reads `allowedKeys`, `urlParts`, `queriesAllowed` and cookie access values of `any`. R02 reads the sandboxed code for `setDefaultConsentState` and `updateConsentState`.

## Trigger fields

```json
{
  "triggerId": "11",
  "name": "CE - purchase - shop host",
  "type": "CUSTOM_EVENT",
  "customEventFilter": [{ "type": "EQUALS", "parameter": [{ "type": "TEMPLATE", "key": "arg0", "value": "{{_event}}" }, { "type": "TEMPLATE", "key": "arg1", "value": "purchase" }] }],
  "filter": [{ "type": "EQUALS", "parameter": [{ "type": "TEMPLATE", "key": "arg0", "value": "{{Page Hostname}}" }, { "type": "TEMPLATE", "key": "arg1", "value": "shop.example.com" }] }]
}
```

- `customEventFilter` holds the event name match (`arg0` is `{{_event}}`); `filter` holds "Some events" or "Some page views" conditions; `autoEventFilter` holds the enable conditions of click and form listeners.
- `checkValidation`, `waitForTags`, `interval`, `limit` and `eventName` are single Parameter objects (form, link click and timer triggers). A timer with no `limit` fires until the visitor leaves (R28).
- Condition types: equals, contains, startsWith, endsWith, matchRegex, greater, greaterOrEquals, less, lessOrEquals, cssSelector, urlMatches; optional BOOLEAN `negate` and `ignore_case`.
- Built-in triggers are not in `trigger[]`: `2147479553` All Pages, `2147479572` Consent Initialization - All Pages, `2147479573` Initialization - All Pages (IDs from Google's ga4-gtm-utilities code). Other IDs from 2147479000 up are reported as unnamed built-ins.
- Element visibility triggers have an option to observe DOM changes; its export key is not confirmed, so R28 leaves it to the UI.
- The regex flavour of web triggers is not documented; the scripts use JavaScript RegExp and treat a pattern JavaScript cannot compile as no match.

## Variable fields

- Type codes: `c` Constant, `v` Data Layer Variable, `jsm` Custom JavaScript, `j` JavaScript Variable, `k` First Party Cookie, `u` URL, `smm` Lookup Table, `remm` RegEx Table, `gas` legacy GA Settings, `awec` User-Provided Data (mode `MANUAL` in Google's boilerplate; automatic and code modes exist in the UI, so the script treats any mode containing "auto" as automatic).
- `v`: `name` (the key), `dataLayerVersion` (1 treats dots as part of the name), `setDefaultValue`, `defaultValue`.
- All variables can carry `formatValue` with `caseConversionType`, `convertNullToValue`, `convertUndefinedToValue`, `convertTrueToValue` and `convertFalseToValue`; R29 fails ID variables that convert null or undefined to a literal.
- `smm` and `remm`: `input`, `map` (LIST of MAP with `key` and `value`), `setDefaultValue`, `defaultValue`.
- `builtInVariable[]`: `{ "type": "PAGE_HOSTNAME", "name": "Page Hostname" }`; only enabled built-ins are listed.

## Zone fields

- `zone[]`: `zoneId`, `name`, `childContainer[]` (`publicId`, `nickname`), `boundary` (`condition[]`, `customEvaluationTriggerId[]`) and `typeRestriction` (`enable`, `whitelistedTypeId[]`). R24 reads all of them.

## What a file cannot show

- Tags hard-coded in the page, theme, CMS plugins, platform apps or a Google tag gateway.
- How the container is loaded: since 9 July 2026 a G- or AW- loading ID runs only Google-provided tags and variables.
- The Settings tab, workspaces, conflicts, which version is live, user permissions, environments and the Size indicator.
- The site's data layer pushes, and what fires at runtime. Every finding is a lead until Preview or Tag Assistant shows it.
