The GA4 shadow API
A field guide to the undocumented URL contract that GA4 reads when you open an Exploration, a comparison or the dashboard builder from a link. The Report, Comparison and Dashboard builders all write this format.
01What it is
When you open a GA4 Exploration or free-form report, the app restores its initial state from a key-value string that follows ?params= in the URL hash. Google has never documented this contract, but it has been stable since Explorations launched, and it is what makes a fully configured report linkable without any backend integration. We call it the shadow API.
TagSpy never calls GA4 for you. The link opens in your own browser session and uses your existing permissions on the property you target.
02URL anatomy
https://analytics.google.com/analytics/web/
#/p<PROPERTY_ID>/<SURFACE>
?params=<payload>
[&r=new-report]p<PROPERTY_ID>: the numeric GA4 property. The viewer needs access to it.<SURFACE>:assetlibrary/explorer/new,reports/reportinghub,reports/dashboardorassetlibrary/builder/new.params=: the payload. For Explorer and Reporting hub links, keys are joined with the literal three characters%26(the encoded form of&), never a real ampersand, which keeps the whole payload inside the hash.r=new-report: Explorer only. Marks the link as a brand-new report instead of loading a saved one.
Every key starts with _u.. (user and view state, such as comparisons and navigation mode) or _r.. (the report definition). A dotted path such as _r.explorerCard..metrics reads as: set metrics on the explorerCard of the report.
https://analytics.google.com/analytics/web/#/p123456/assetlibrary/explorer/new?params=_u..nav=maui%26_r.explorerCard..dimensions=["hostname"]%26_r.explorerCard..metrics=["sessions"]&r=new-report
03Surfaces
The same contract works on several GA4 screens. Pick the one you want people to land on.
- Explorer (
/assetlibrary/explorer/new): a free-form report with dimensions, metrics, sort, filters and comparisons. Writes the full_r.explorerCard..*chain. - Reporting hub (
/reports/reportinghub): standard reports. Ideal for comparison-only links: one_u..comparisonskey and no explorer state. GA4 emits this flavour itself when you save a comparison from the top bar. - Dashboard (
/reports/dashboard): the default reports dashboard, with the same payload contract as the hub but a different landing screen. - Builder (
/assetlibrary/builder/new): the dashboard builder canvas, covered under Dashboards below.
04Explorer keys
These keys cover most free-form reports.
fieldName, seldim and selmet value is the GA4 frontend name: hostname, pagePath, landingPage, conversions. Not hostName, pagePathPlusQueryString or keyEvents. Using the wrong flavour is the most common reason a link opens empty. The field list shows both names for every field.| Key | Value | Notes |
|---|---|---|
| _u..nav | "maui" | Switches the app to the free-form navigation surface. |
| _r.explorerCard..dimensions | ["dim1","dim2"] | Dimensions added to the table. |
| _r.explorerCard..seldim | ["dim1"] | Dimensions currently selected (a subset of the above). |
| _r.explorerCard..ddimensions | ["dim"] | Optional detail dimensions for the secondary card. |
| _r.explorerCard..metrics | ["m1","m2"] | Metrics added to the table. |
| _r.explorerCard..selmet | ["m1"] | Metrics currently selected (a subset of the above). |
| _r.explorerCard..sortKey | "metricName" | Column the table sorts by. |
| _r.explorerCard..isAscending | true | false | Sort direction. |
| _r.explorerCard.primaryCard..isHidden | true | false | Hide the chart card. |
| _r.explorerCard.secondaryCard..isHidden | true | false | Hide the table card. |
| _r..dataFilters | [Filter, …] | Report-level filters (JSON array). |
| _u..comparisons | [Comparison, …] | Comparison segments (JSON array). View state, not report state. |
| _r..title | "My report" | Visible report title. |
| _r..defaultReportTitle | "My report" | Title GA4 falls back to if the visible one is cleared. |
05Filter shape
Each entry of _r..dataFilters is a JSON object:
{
"type": 1,
"fieldName": "pagePath",
"evaluationType": 3,
"expressionList": ["checkout"],
"complement": false,
"isCaseSensitive": true,
"expression": ""
}type: 1: a dimension or metric filter, the only kind Explorer surfaces.fieldName: the GA4 frontend field name.evaluationType: the operator code, see below.expressionList: the values. The builders send several values as one comma-joined string, which GA4 treats as OR. Empty for the (not set) operators.complement: negates the operator. Every "does not" operator is its positive twin withcomplement: true.isCaseSensitive: honoured by most string operators.
06Operator codes (evaluationType)
| Operator | Code | Complement |
|---|---|---|
| matches exactly | 8 | false |
| contains | 3 | false |
| begins with | 4 | false |
| ends with | 5 | false |
| matches regex | 2 | false |
| matches partial regex | 11 | false |
| does not match exactly | 8 | true |
| does not contain | 3 | true |
| does not begin with | 4 | true |
| does not end with | 5 | true |
| does not match regex | 2 | true |
| does not match partial regex | 11 | true |
| is (not set) | 12 | false |
| is not (not set) | 12 | true |
Codes 3, 4, 5 and 8 are the everyday string operators. Code 2 is a full regex, code 11 a partial-match regex, and code 12 the (not set) check, which ignores expressionList. Regex operators take a single pattern.
07Comparisons
Comparisons live under _u..comparisons, which is view state rather than report definition. That is why a link carrying only this key still works on the Reporting hub. The compact shape is a name plus conditions that are ANDed together:
{
"name": "Mobile + Spain",
"filters": [
{ "fieldName": "deviceCategory", "expressionList": ["mobile"], "evaluationType": 8, "isCaseSensitive": false, "complement": false },
{ "fieldName": "country", "expressionList": ["Spain"], "evaluationType": 8, "isCaseSensitive": false, "complement": false }
]
}GA4's built-in "All users" comparison is referenced through a saved comparison id and a system type:
{
"savedComparisonId": "7034674712",
"name": "All users",
"isEnabled": true,
"filters": [],
"systemDefinedSavedComparisonType": 8,
"isSystemDefined": true
}Comparisons appear as extra series next to the baseline. They are scoped to the report and do not create a saved segment in the property. The id above comes from a captured URL; if a system comparison does not appear, drop the entry and add it in GA4.
08Dashboards
The dashboard builder is a richer flavour of the same contract. It hydrates a whole canvas of cards from one URL.
https://analytics.google.com/analytics/web/
#/p<PROPERTY_ID>/assetlibrary/builder/new
?params=<encodeURIComponent(inner)>- Anyone can open the link, but only users with Editor or Administrator access can save the result.
- Unlike Explorer, the whole inner string is encoded once with
encodeURIComponentand keys inside it are separated by a real&. - The minimum state is
_u..nav=maui. _u.*holds global state (navigation, dates, comparison)._r.*holds report and card state._r.._cidsis the ordered card registry, a comma list of<cardId>.<templateId>pairs rather than JSON. The observed template id is182.- The account segment is optional:
#/p<PROPERTY>/…resolves it. Legacya<ACCOUNT>p<PROPERTY>links still work. - Arrays and objects are
JSON.stringify-ed into the value. Never encode twice.
_u..nav=maui
_u.dateOption=last28Days
_r.._cids=c1.182,c2.182
_r.c1..cardType=59
_r.c1..selmet=["activeUsers"]
_r.c1..positioning={"x":2,"y":2,"width":22,"height":14}Date presets: last7Dayslast28Dayslast30Dayslast90DaysmonthToDateyearToDatecustom. Comparison options: disabledprecedingPeriodpreviousYearcustom. Custom ranges are written as YYYYMMDD in _u.date00/_u.date01 (and _u.date10/_u.date11 for the comparison range).
09Card types
| cardType | Chart | Requires | Default size |
|---|---|---|---|
| 59 | Scorecard | 1 metric | 18 x 9 |
| 65 | Table | dimension + metric | 46 x 28 |
| 72 | Line chart | dimension (usually date) + metric | 46 x 24 |
| 3 | Bar chart | dimension + metric (horizontal bars) | 30 x 20 |
| 67 | Column chart | dimension + metric (vertical columns) | 30 x 20 |
| 73 | Donut | dimension + metric | 24 x 22 |
| 66 | Funnel | analysisFeature.funnel | 46 x 26 |
Geo maps and touchpoint segments are not covered: their state has not been reverse-engineered reliably.
Positions use an approximate 0-100 grid: {"x":2,"y":2,"width":44,"height":28}. The builder flows cards left to right from x=2 and starts a new row when a card would pass x=98, leaving a gap of 2 between cards.
10Dashboard keys
| Key | Example | Notes |
|---|---|---|
| _u..nav | maui | Required. Puts the app in builder navigation mode. |
| _u.dateOption | last28Days | Date preset. Use custom together with _u.date00 / _u.date01 (YYYYMMDD). |
| _u.comparisonOption | precedingPeriod | Date comparison. Custom ranges use _u.date10 / _u.date11. |
| _r..dataFilters | [{"fieldName":"country",…}] | Dashboard-wide filters, same JSON shape as explorer filters. |
| _r.._cids | c1.182,c2.182 | Ordered card registry: cardId.templateId, comma separated (not JSON). |
| _r.{id}..cardType | 65 | Chart type for that card. |
| _r.{id}..seldim | ["pagePath"] | Selected dimensions (GA4 frontend names). |
| _r.{id}..selmet | ["screenPageViews"] | Selected metrics (GA4 frontend names). |
| _r.{id}..innerTitle | Top pages | Card title on the canvas. |
| _r.{id}..positioning | {"x":2,"y":2,"width":44,"height":28} | Grid position on an approximate 0-100 scale. |
| _r.{id}..sortKey | d-0 | Table only. Column the table sorts by. |
| _r.{id}..rowsPerPage | 500 | Table only. Page size; startRow sets the offset. |
| _r.{id}..dashboardTableMetadata.showSearchRow | true | Table only. Search row (showTotalsRow toggles totals). |
| _r.{id}..dataFilters | [{"fieldName":"country",…}] | Card-scoped filters. |
| _r.{id}..analysisFeature | {"funnel":{"sequence":{"step":[…]}}} | Funnel only. Steps carry an event filter, a label and immediatelyFollows. |
Build pipeline: model, then a key/value map, then the inner parameter string, then a single encodeURIComponent. Validate before serializing: unique card ids, every card has its required fields, every position has x, y, width and height.
11Limits and gotchas
- Comparisons: 4 at most per report; GA4 silently ignores the rest.
- Dimensions: 5 at most in a free-form table.
- Metrics: 10 at most in a free-form table.
- URL length: long filter values and many comparisons can pass browser limits (around 32,000 characters in Chrome, less elsewhere). The builders show characters and bytes beside the preview.
- Access: the link opens in the signed-in user's session. They need access to the property; nothing bypasses authentication. Saving a report or dashboard needs Editor or Administrator.
- Frontend names: use
hostname(nothostName),conversions(notkeyEvents),landingPage(notlandingPagePlusQueryString). - Special characters: values are written raw. Avoid
&,#and line breaks in titles and filter values. - Undocumented: Google can change the contract at any time. If a link stops working, re-test against a link GA4 itself generates.
12Contract changelog
Observed changes to the undocumented contract and the options the builders support. These describe tested behaviour, not an official Google release history.
- Dashboard: documented the Asset Library builder URL, card registry and positioning.
- Cards: scorecard, table, line, bar, column, donut and funnel types.
- Filters: global and card-scoped dashboard filters.
- Comparisons: compact and full payload shapes plus system comparisons.
- Surfaces: separated Explorer, Reporting hub and Dashboard flavours.
- Filters: mapped evaluationType codes, complement and case sensitivity.
- Comparisons: confirmed _u..comparisons as view state outside the report payload.
- Explorer: dimensions, metrics, sorting, titles and visibility keys.
- Encoding: the params key/value chain and its single-encoding rules.