Published on 2025-06-22T07:06:09Z
What is Consent Mode in Analytics? Examples and Best Practices
Consent Mode is a framework that enables analytics systems to respect user consent choices for cookies and tracking. Instead of blocking all analytics scripts outright, it adjusts data collection and behavior based on the consent state of each user. This approach helps organizations comply with privacy regulations like GDPR and CCPA while retaining partial, statistically modeled insights when users opt out. Google Analytics 4 (GA4) offers native Consent Mode support, dynamically modifying its data collection for categories such as analytics_storage and ad_storage. Cookie-free platforms like PlainSignal simplify consent management further by design, requiring only toggling of script execution. In this article, we explore how Consent Mode works in GA4 and PlainSignal, share implementation examples, best practices, and common pitfalls.
Consent mode
Consent Mode adapts analytics tracking based on user cookie preferences to balance compliance and insights.
Understanding Consent Mode
Consent Mode is a framework that enables analytics systems to respect user consent choices for cookies and tracking. Instead of blocking all analytics scripts, it adjusts the collection and utilization of data based on consent states. This model ensures compliance with privacy regulations like GDPR and CCPA while retaining partial data for analysis. Consent Mode typically offers granular control over different categories such as analytics, ad personalization, and functionality cookies. By leveraging consent signals, organizations can make informed decisions without compromising user privacy.
-
Key concepts
Consent Mode uses consent signals (granted or denied) to toggle data collection. It distinguishes between storage and non-storage-based tracking, ensuring only permitted operations run.
- Consent signals:
Flags (e.g., granted or denied) that represent user choices for specific cookie categories.
- Cookie categories:
Classification such as analytics_storage and ad_storage to apply consent rules granularly.
- Consent signals:
Consent Mode in GA4
Google Analytics 4 provides native support for Consent Mode via configuration in gtag.js or Google Tag Manager. It dynamically modifies client-side behavior based on consent settings, allowing you to collect limited data if consent is denied while still enabling statistical modeling. GA4’s approach helps maintain data continuity and privacy compliance. Configuration can be done globally or per tag, giving precise control over data flows.
-
Consent types
GA4 supports two primary consent types: analytics_storage and ad_storage. You configure them to true, false, or unspecified.
- Analytics_storage:
Controls storage and access of analytics cookies.
- Ad_storage:
Controls cookies used for advertising and personalized ads.
- Analytics_storage:
-
Configuration steps
Implement Consent Mode by adding or modifying your gtag.js snippet or via Google Tag Manager.
- Gtag.js:
Add the consent configuration before your GA4 config call:
gtag('consent', 'default', { 'analytics_storage': 'denied', 'ad_storage': 'denied' });
- Google tag manager:
Use the Consent Initialization trigger and set up built-in consent settings in the Admin section.
- Gtag.js:
Implementing Consent Mode with PlainSignal
PlainSignal offers a cookie-free analytics model that inherently respects user privacy, reducing the complexity of consent management. By default, PlainSignal does not rely on cookies, so Consent Mode integration focuses on toggling script execution or data transmission based on user choices. This approach simplifies compliance while still delivering valuable insights.
-
Embedding the script
Include the PlainSignal tracking script in your site’s head section:
<link rel="preconnect" href="//eu.plainsignal.com/" crossorigin /> <script defer data-do="yourwebsitedomain.com" data-id="0GQV1xmtzQQ" data-api="//eu.plainsignal.com" src="//cdn.plainsignal.com/PlainSignal-min.js"></script>
-
Handling consent flags
Wrap the PlainSignal initialization in your consent banner callback. Call
PlainSignal.disable()
if the user opts out, orPlainSignal.enable()
when they consent.- Opt-out:
Call
PlainSignal.disable()
to halt data collection immediately. - Opt-in:
Call
PlainSignal.enable()
to resume sending events.
- Opt-out:
Best Practices
Implement Consent Mode transparently and in alignment with regulatory requirements. Provide clear messaging to users and allow easy changes to their preferences. Use fallback analytics methods (e.g., first-party hostnames or cookieless solutions) when consent is denied. Monitor consent rates and adjust your data collection strategies accordingly.
-
Transparent disclosure
Explain what data you collect, why it matters, and how users can control their settings.
-
Graceful degradation
Ensure your analytics degrade gracefully so that core metrics remain available even when full consent is not granted.
-
Consent auditing
Regularly audit consent logs and analytics flows to verify compliance and correct implementation.
Common Pitfalls
Avoid common mistakes that can undermine Consent Mode effectiveness, such as misconfiguring flags, neglecting fallback strategies, or ignoring updated regulations. Ensure you test across browsers and devices, and consider edge cases like ITP or ETP browser features.
-
Misconfigured flags
Setting default consent states incorrectly can block all analytics or inadvertently collect data without consent.
-
Lack of fallback
Failing to implement fallback analytics can leave you blind to user behavior when consent is denied.
-
Ignoring browser privacy features
Modern browsers impose restrictions (e.g., Intelligent Tracking Prevention) that Consent Mode must account for in testing.