Sub topic 12
Checking that consent behaves as intended
A consent setup can look correct in the banner and still send the wrong signals to Google. This chapter shows how to test consent behavior at four layers: the page, Tag Assistant, the network requests, and the data that reaches GA4 and BigQuery. You test in that order because each layer depends on the one before it.
This chapter assumes you have read the earlier chapters on the Consent Mode v2 signals, basic versus advanced mode, and implementing defaults and updates. It also assumes you can open browser developer tools and run a query in BigQuery.
What you are verifying
Validation answers five questions:
- Is a default consent state set before any Google tag loads?
- Does the default match your design, including regional defaults?
- Does the banner send an update when the visitor chooses, and does the update carry the right values?
- Do the tags behave as your mode requires? In basic mode they must not send anything before consent. In advanced mode they may send cookieless pings.
- Does the data in GA4 and BigQuery show the consent state you expect?
Test with a clean browser profile or a private window. Stored cookies and a remembered banner choice from earlier visits will hide default-state problems.
Build a test matrix first
Decide the expected result for each scenario before you open any tool. Otherwise you will rationalize whatever you see.
| Scenario | Expected consent state | Expected `_ga` cookies | Expected BigQuery `privacy_info.analytics_storage` |
|---|---|---|---|
| First visit, no choice made | Defaults (all denied in a strict region) | None | `No` |
| Visitor accepts all | Update to granted | Set after the update | `Yes` for events after the update |
| Visitor rejects all | Stays denied | None | `No` |
| Visitor accepts, later revokes | Update back to denied | No new cookie writes | `No` for events after revoking |
| Visitor in a region with a granted default | Granted from the start | Set immediately | `Yes` |
Add one row per region you configured. A regional default that you never tested from that region is a common source of silent errors.
Layer 1: the order of commands on the page
The most frequent consent bug is ordering. The default command must run before the Google tag loads. An update that fires before the default, or a default that fires after the first tag, leaves the first hits with the wrong state.
Open the console on your page and list the consent commands in the order they were pushed to dataLayer:
const consentCommands = window.dataLayer
.filter((entry) => entry && entry[0] === 'consent')
.map((entry) => ({ command: entry[1], settings: entry[2] }));
console.table(consentCommands);You should see the default commands first, then one update after each banner interaction. If a default row is missing, your banner script or tag manager template is not running early enough. If you see two default rows for the same signals with no region value, the later one can overwrite the earlier one.
Check the array order too. Index zero of window.dataLayer should be the earliest entry. If a config or js entry sits above your default row, the tag loaded first.
Layer 2: Tag Assistant
Tag Assistant is the quickest place to see consent state per event. Connect it to your site (or start Preview from Google Tag Manager) and open the consent information for each event in the summary. For every event, check:
- The default state, including whether it was set on the page or by a Tag Manager consent template.
- The update state, shown after the visitor interacts with the banner.
- Which tags fired, and which were blocked or fired in a limited way because a required signal was denied.
Walk through the matrix. On the first event of a first visit you should see your default values. After clicking accept, a new event should show the updated values. If the state still shows denied after you accept, the banner is not calling gtag('consent', 'update', ...), or it uses a different gtag function than the one the page loaded.
In Tag Manager, also confirm that each tag has the consent settings you intend. A Google tag with built-in consent checks respects the state automatically. A third-party tag that has no consent check needs its own trigger condition.
Layer 3: the network requests
Tag Assistant shows what the tag intended. The network panel shows what left the browser. Filter requests by collect and look at hits to Google Analytics endpoints such as /g/collect.
Two query parameters matter:
gcsis a compact consent string. It looks likeG1followed by two digits. The first digit isad_storageand the second isanalytics_storage, where1means granted and0means denied. SoG100means both denied,G111means both granted, andG101means ads denied with analytics granted.gcdis a longer string that encodes the default and update state of all four v2 signals. You rarely decode it by hand. It is useful as a quick comparison between a request that should be granted and one that should be denied.
What to expect depends on your mode:
| Mode | Before consent | After accept |
|---|---|---|
| Basic | No Google requests at all | Requests start with `gcs=G111` (if all granted) |
| Advanced | Cookieless pings with `gcs=G100` and no cookie identifiers | Normal requests with `gcs=G111` |
If you run basic mode and still see collect requests before the visitor chooses, a tag is loading outside your consent gating. If you run advanced mode and see no pings at all, check that the tag loads before consent and that the default is not blocking the tag script itself.
Also look at the cookies in the Application panel. With analytics_storage denied, the _ga and _ga_<container> cookies should not be written. They should appear only after an update to granted.
The diagram shows the sequence you are checking.
Layer 4: DebugView
DebugView shows events from a device flagged as a debug device, in near real time. Turn on debug mode in your configuration for the test session:
gtag('config', 'G-XXXXXXXXXX', { debug_mode: true });Replace G-XXXXXXXXXX with your measurement ID. Then open DebugView in the GA4 Admin area and select your device.
Use DebugView to confirm that events arrive after consent is granted, with a stable device and a continuous timeline. Do not expect the same continuity for a denied visitor. Without analytics_storage there is no persistent client identifier, so cookieless pings cannot be stitched into one visitor journey. If a denied session looks fragmented or missing in DebugView, that is not by itself a failure. Compare it with the network panel: if the request left the browser with gcs=G100, the page behaved correctly.
Remove debug_mode after testing so you do not mix test traffic into production data.
Layer 5: BigQuery consent fields
If you export GA4 to BigQuery, the export records the consent state on each event in the privacy_info record. This is the most reliable check over a longer period, because it covers real visitors rather than your own test session. The export is not modelled, so what you see is what was collected.
Count events by consent state per day:
SELECT
event_date,
privacy_info.analytics_storage AS analytics_storage,
COUNT(*) AS events
FROM `my_project.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20261101' AND '20261107'
GROUP BY event_date, analytics_storage
ORDER BY event_date, analytics_storage;Replace the project, dataset ID, and dates with your own. Then read the result against your design:
- A strict-region property that shows almost no
Yesrows suggests the update never fires, or visitors never see the banner. - A property that shows no
Norows, with a banner that offers a reject option, suggests the default is granted or the reject button sends no update. - A sudden change in the share of
Yesafter a site release points to a banner or tag manager change.
You can run the same check for privacy_info.ads_storage. Also check identifiers. Events without analytics consent normally carry no usable user_pseudo_id, so counts of distinct users will be lower than counts of events.
Common failures and how to recognize them
- Default set too late. The first hit on a page shows
gcs=G111before the banner appears. Fix by moving the default command above the tag snippet or by setting it in the earliest Tag Manager trigger (Consent Initialization). - Update never sent. The banner stores the choice in its own cookie but never calls
gtag. Tag Assistant shows only the default state. - Only some signals updated. The banner updates
analytics_storagebut notad_user_dataorad_personalization. Check all four signals in theupdatecall. - Region codes wrong. The
regionvalue must be an ISO 3166 country or subdivision code. A mistyped code makes the denied default apply nowhere, so visitors in that region fall through to the general default. - Update on page load missing. A returning visitor who accepted before gets a default of denied on every page, because nothing replays the stored choice. Your banner must send an update on load.
A repeatable checklist
- Open a clean private window and clear stored consent choices.
- Run the console snippet and confirm the order of commands.
- Load the page in Tag Assistant and confirm the default state per signal.
- Check the network panel for
gcsand cookies before any choice. - Accept, then confirm the update, the new
gcsvalue, and the cookies. - Repeat with reject, and with accept followed by revoke.
- Repeat from each region with its own default.
- After a few days of live traffic, run the BigQuery query and compare shares against the design.
Exercise
A site uses advanced Consent Mode with all four signals denied by default. A visitor opens the page and has not touched the banner. In the network panel you see a collect request with gcs=G111 and a _ga cookie already present. List two likely causes.
Show answer
The default command probably ran after the Google tag loaded, so the first hit went out with a granted state. Or a stored earlier choice was replayed as an update before the first hit. A third possible cause is that a region-specific default did not match this visitor's region and a general granted default applied instead. In each case, check the order of commands in dataLayer and the region codes.
Exercise
Your BigQuery query shows that 100% of events from last week have privacy_info.analytics_storage equal to Yes, but your banner has a working Reject button. What does this suggest, and what do you check first?
Show answer
It suggests that rejecting does not reach Google, or that the default is granted so no event is ever collected as denied. Check first that the default command sets analytics_storage to denied for the visitor's region, then that the Reject button leaves the denied state in place and does not send a granted update.