localStorage).
How It Works
When you enable consent management, Radar operates in two stages on your customer’s website:- Before Consent: The tracker is fully functional but stores all data (like the device ID and user traits) in the end user’s
sessionStorage. This data is cleared when the user closes their tab. - After Consent: Once the end user gives consent, a specific Radar function must be called. The tracker then migrates all data from
sessionStoragetolocalStorageand will use persistent storage from that point forward, allowing it to remember users across multiple sessions.
1. Enable Consent Management
To enable consent management, set thewaitForConsent option to true in your Radar loader script configuration.
HTML
localStorage on your customer’s site until you explicitly tell it to via the giveCookieConsent method, or automatically via a supported consent management platform (CMP).
2. Granting Consent
There are two ways for your customers to grant consent:a. Automatic Consent (CMP Integration)
Radar includes built-in integrations with major Consent Management Platforms (CMPs): If your customer uses one of these CMPs, Radar will automatically detect when a user has granted consent and will call giveCookieConsent() behind the scenes. No extra coding is required — simply enable waitForConsent and install Radar after the CMP script. This ensures Radar seamlessly respects your customer’s existing consent workflow without requiring duplicate consent logic.
b. Manual Consent (Custom Banner or Logic)
Your customer will need to implement logic to call thegiveCookieConsent() method on the tracker’s namespace object when one of their users provides consent (for example, by clicking “Accept” on a cookie banner).
- It signals to Radar that it now has permission to use persistent storage for that end user.
- It migrates any existing anonymous ID and user traits from that user’s session storage to
localStorage, so their identity is maintained.
The
giveCookieConsent function only needs to be called once per user. Radar will remember that consent has been granted for all future sessions from that device.Example: Integrating with a Cookie Banner
Here is a simple example of how your customer could integrate Radar with a common cookie consent banner on their website. You can provide this snippet to them as a guide.HTML
3. Revoking Consent (CCPA Opt-Out)
ThewaitForConsent flow above is the opt-in model used for regulations like GDPR, where tracking stays session-scoped until the user actively agrees. Regulations like the CCPA instead use an opt-out model: tracking is on by default, and the user has the right to withdraw consent at any time (for example, via a “Do Not Sell or Share My Personal Information” link).
For this posture, leave waitForConsent at its default (false) so Radar identifies visitors normally, and call the denyCookieConsent() method when one of your customer’s users opts out.
- It clears that end user’s persisted identity — device ID, user traits, and session data — from both cookies and
localStorage. - It drops Radar back to session-scoped storage, so the user is no longer recognized across sessions from that point forward.
- It records the opt-out durably, so the choice survives page loads and future sessions and is not overridden by an automatic (CMP-reported) grant.
The opt-out is reversible. If the user later opts back in, calling
giveCookieConsent() clears the recorded opt-out and re-enables persistent storage.Example: Integrating an Opt-Out Control
Here is a simple example of how your customer could wire a “Do Not Track” control to Radar. It mirrors the accept flow above.HTML