Sub topic 12
Checking That Consent Behaves as Intended
Prerequisites: you should know how GA4 properties, events, and reports work. You should also understand cookies, client-side tracking, and the basic role of Google Tag Manager or gtag.js.
A consent implementation is correct only when the visitor's choice changes tag behavior as planned. Test both paths:
- A visitor denies consent.
- A visitor grants consent.
- A visitor changes the choice later.
- A visitor visits from a region with a stricter default.
Do not test only whether the consent banner appears. A visible banner can still load analytics or advertising storage before the visitor makes a choice.
Build a test matrix
Use a fresh browser session for each test. Clear cookies or use a private window so that an earlier choice does not affect the result.
| Test case | Expected initial state | Expected after acceptance |
|---|---|---|
| Visitor denies analytics consent | `analytics_storage: denied` | It remains denied |
| Visitor accepts analytics consent | Denied until the choice is made | `analytics_storage: granted` |
| Visitor denies advertising consent | Advertising storage and advertising signals are denied | They remain denied |
| Visitor is in a regulated region | Regional denied default applies | Only the selected signals become granted |
Record the page URL, region, consent choice, time, and events generated during each test. This makes it easier to compare the browser tools with GA4 data later.
Check the consent state in Tag Assistant
Google Tag Assistant can show the consent state received by Google tags.
- Open the site through Tag Assistant.
- Start a new connection.
- Load the page before making a consent choice.
- Open the consent details for the Google tag or Google Analytics tag.
- Check the default values.
- Accept or reject consent in the banner.
- Inspect the next tag event and check the updated values.
The initial state should appear before the first relevant tag event. For an advanced Consent Mode implementation, you may see Google tags send cookieless pings while storage remains denied. For a basic implementation, the Google tag should not send measurement data until the visitor grants consent.
Check all Consent Mode v2 signals, not only analytics_storage:
analytics_storagecontrols analytics cookies and analytics-related storage.ad_storagecontrols advertising cookies and advertising-related storage.ad_user_datacontrols whether user data can be sent to Google for advertising purposes.ad_personalizationcontrols personalized advertising use.
A common error is updating analytics_storage but leaving the advertising signals at an unintended default.
Confirm events in DebugView
Use a test device with debug mode enabled. In Google Tag Manager, preview mode normally marks events for debugging. With gtag.js, you can add the debug_mode parameter to test events.
Open the GA4 property and select DebugView. Perform a known action, such as viewing a page or clicking a test button. Confirm:
- The event appears after consent is granted.
- The event timing matches the action.
- The event does not contain unexpected user identifiers.
- Events behave as expected while consent is denied.
DebugView is useful for tag timing and event delivery, but it is not a complete privacy audit. It may show a cookieless event in advanced mode even though analytics storage is denied. Use Tag Assistant to inspect the consent state and network tools, when necessary, to inspect requests.
Check consent fields in BigQuery
If BigQuery export is enabled, inspect recent events. GA4 exports consent-related values in the privacy_info record. The exact available fields depend on the export schema and property configuration. Common fields include analytics_storage, ads_storage, and uses_transient_token.
SELECT
event_date,
privacy_info.analytics_storage AS analytics_storage,
privacy_info.ads_storage AS ads_storage,
COUNT(*) AS events
FROM `my_project.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20261101' AND '20261107'
GROUP BY event_date, analytics_storage, ads_storage
ORDER BY event_date, analytics_storage, ads_storage;Replace the project, dataset, and dates. Compare the query results with your test choices. Do not expect BigQuery to reproduce every value shown in the GA4 interface. Some interface reports can include modelled data that is not present as individual exported events.
Diagnose common failures
If consent updates arrive too late, tags may send data under the wrong state. Place the default consent command before Google tags load and use wait_for_update when the banner needs time to respond.
If every test shows the same result, stored consent may be overriding the default. Clear the consent cookie or use a new private session.
If DebugView is empty, check the measurement ID, debug mode, filters, network errors, and property time zone. If BigQuery is empty, check the export configuration and table date.
Exercise
A visitor initially denies analytics consent. Tag Assistant shows analytics_storage: denied, but DebugView shows a cookieless event. Is this automatically a failure?
Show answer
No. Advanced Consent Mode can send cookieless pings while analytics storage is denied. Confirm the consent state in Tag Assistant and check whether cookies or other prohibited storage were written.