Specify analytics behavior before a consent choice, after acceptance or denial, and after a changed preference. Environment-based suppression helps exclude tests but does not by itself represent a user’s consent state.
Inventory initialization before the first interaction
List scripts, tag-manager containers, SDK imports, automatic page views and custom event calls. Identify which execute before any banner response. A consent design is incomplete if the application waits on one wrapper while another tag initializes independently. The inspected measurement-context helper excludes local development, preview hosts and explicit audits; those are environment decisions. It is not a consent manager. Keep the runtime consent design separate from the test-traffic policy so a production hostname is not mistaken for permission to measure every visitor.
Choose basic or advanced mode deliberately
Google’s current consent-mode overview distinguishes basic mode, which blocks tags until consent, from advanced mode, which loads tags with a denied default and can send limited cookieless pings. Advanced denied behavior is therefore not equivalent to no network collection. The responsible privacy and product owners should choose the appropriate implementation for the actual jurisdictions and purposes. Consent mode communicates choices to supported tags; it does not obtain consent or establish legal compliance by itself. Third-party tags without the required checks need their own handling.
| Choice state | Basic mode proposal | Advanced mode boundary |
|---|---|---|
| Unknown | Do not load tag | Denied defaults; limited pings possible |
| Granted | Load under policy | Update granted state |
| Denied | Remain blocked | Respect denied-purpose behavior |
| Changed preference | Apply reviewed transition | Verify tag and storage response |
Write a state matrix instead of one canMeasure flag
Define unknown, granted, denied and revoked or changed states for each relevant consent purpose. Specify initialization, storage and event behavior for each selected integration mode. For a proposed basic-mode fixture, unknown and denied mean the tag is not loaded; granted permits initialization under the reviewed policy. That is an application contract, not a universal rule for advanced mode. Record what happens to events attempted before the choice: drop them, aggregate only permitted diagnostics, or follow another explicitly reviewed policy. Do not silently replay a visitor’s entire earlier activity after acceptance.
// Proposed basic-mode gate, separate from environment exclusions.
const mayInitialize = environmentEligible && consent.analytics === "granted";
// Advanced mode needs its own denied-default and ping contract.Test changed choices and navigation races
A practical browser review includes direct landing, fast route changes, acceptance, denial, reopening preferences and returning in a later session. Inspect script loads, outgoing requests and relevant storage under each state. Set defaults before any tag that depends on them can execute. Keep the region, browser, configuration revision and consent-manager version with the result. A banner screenshot does not prove the ordering is correct. This guide’s matrix is proposed and no live consent integration was modified or exercised. Use synthetic interactions and avoid real private content in diagnostic payloads.
Keep product interpretation within the collected evidence
A decline can affect observable sessions and conversions, while modeled outputs have different provenance from directly observed events. Record the selected mode and reporting limitations beside business analysis. Keep essential application tasks functional when optional measurement is unavailable. If a tag behaves unexpectedly after a preference change, isolate that path rather than bypassing the choice to restore event counts. The completed handoff should make pre-choice behavior inspectable, name the responsible owners and explain how a future script or SDK addition is reviewed against the same consent contract.
Health-product security claims need evidence.
GA4 leads versus form attempts
Bring the selected consent mode, tag inventory and responsible reviewers to define testable collection behavior.
B2B SaaS development: scope and acceptance
Does a production-only measurement helper manage consent?
No. Environment eligibility and user choice are separate states that need their own implementation.
Does denied advanced consent mean no requests are sent?
Not necessarily. Google documents limited cookieless pings; choose and verify the intended mode.
