Crossdeck University
Watch — collection that honours the user's choice Film in production
0:00 / 0:00
Reference · Lesson 1 of 4

Consent & privacy

Crossdeck collects by default, so you're never silently missing data — but the user's choice is the law. One call turns categories off when someone opts out, and Do Not Track can be honoured automatically.

3 min Web

When you're done: you can gate analytics, marketing, and error collection on the user's consent.

1 What this is & why it matters

Default-on, but the user can switch it off

Privacy law (GDPR and friends) requires you to honour what a user agrees to collect. Crossdeck's stance is collect by default — so you don't lose data to a forgotten config — paired with one switch to drop categories the moment a user opts out. You get full signal for the users who consent, and a clean, honest off-state for those who don't.

2 How to set consent

One call, per category

Pass any subset of the categories to consent() — the ones you set change, the rest stay as they were:

// user opted out of analytics but is fine with crash reporting
Crossdeck.consent({ analytics: false, errors: true });

// honour the browser's Do Not Track signal automatically, at init
Crossdeck.init({ publishableKey: "cd_pub_…", appId: "app_…", respectDnt: true });
3 How it works, piece by piece

Categories map to event families

Each consent category gates a family of events. Analytics consent gates your track() events and the auto-captured analytics; errors consent gates the error.* and webvitals.* families (crashes and performance). That separation is deliberate and useful: a user can decline analytics while still letting you capture the crash that's breaking their session — a reasonable, common choice.

respectDnt: true reads the browser's Do Not Track signal once at init and applies it as the starting consent, so you honour DNT without wiring anything yourself. The one rule of thumb: set consent before user-meaningful events fire, so a user's choice is in effect from the first event, not retroactively.

4 The result

Collection that respects the choice

With consent wired, every event checks the user's current consent before it ships — analytics stop when analytics are declined, crash reports continue if the user allowed them, and Do Not Track is honoured from the first page view. Full data where you're allowed it, nothing where you're not.

sdk · consent
analytics off · errors on

This user's track() events are dropped at the boundary; their crash reports still flow — exactly the consent they gave.

Crossdeck.consent({ analytics, marketing, errors }) sets any subset; analytics gates track() + auto-analytics, errors gates error.* / webvitals.*. respectDnt: true honours Do Not Track at init. Default-on so you don't lose data; set consent before user-meaningful events fire.