Consent by location
Geo consent defaults let one project start visitors from different places in different consent modes: opt-in where the law requires prior consent, opt-out...
Geo consent defaults let one project start visitors from different places in different consent modes: opt-in where the law requires prior consent, opt-out elsewhere, or cookieless (anonymous counting with no storage).
Rules
settings.sdk.consent_geo_rules is a list of up to 300 rules:
[
{"country": "EU", "mode": "opt_in"},
{"country": "US", "region": "CA", "mode": "opt_in"},
{"country": "BR", "mode": "cookieless"},
{"country": "*", "mode": "opt_out"}
]country: ISO 3166-1 alpha-2 (upper case),EU(the EU 27, Iceland, Liechtenstein, Norway, the UK and Switzerland) or*(everywhere else).region: optional subdivision code without the country prefix (CAfor California); only with a real country.mode:opt_in,opt_outorcookieless.
The most specific match wins: country + region, then country, then EU, then *. When nothing matches the SDK keeps the mode set in code.
Edit them in Project settings -> Consent by location (a GDPR / California preset is offered) or with PUT /v1/projects/{project_id}/settings/sdk {"consent_geo_rules": [...]} (admins only).
How it resolves
GET /v1/config reads the visitor's location from the CDN headers: CF-IPCountry / CF-Region-Code (Cloudflare, enable "Add visitor location headers" for the region), X-Vercel-IP-Country / X-Vercel-IP-Country-Region, CloudFront-Viewer-Country / CloudFront-Viewer-Country-Region, or X-Region-Code from your own proxy. Without a country header the gateway falls back to the operator GeoIP database (LC_GEOIP_PATH). The response then carries consent_default, consent_country and consent_region, is marked Cache-Control: private, no-store, and nothing about the visitor is stored.
A cookieless rule also lets the gateway derive the daily cookieless id for events without a distinct_id, even when the project itself is not in cookieless mode (the deployment still needs LC_COOKIELESS_SECRET).
Cookieless counting: our position
Lucida does offer a server-side daily hash, and it is the only cookieless counting it offers. When a project is in cookieless mode (or a cookieless geo rule applies) and an event arrives without a distinct_id, the gateway derives one: a SHA-256 of the client IP, user agent and site host, salted with a secret that is derived per project and per UTC day from the deployment's LC_COOKIELESS_SECRET. Nothing is stored in the browser, and nothing is stored on the server except the resulting id on the event.
What it means for your numbers:
The id changes at 00:00 UTC, so a visitor is one unique per day and a returning visitor is a new one the next day. Weekly or monthly unique counts are therefore sums of daily uniques, not true uniques, and funnels and retention across days do not link.
Visitors behind one IP with the same browser (an office, a school) collapse into one; one person on two networks counts twice.
We do not offer a longer-lived or cross-day hash, because linking days is what turns anonymous counting back into tracking. If you need cross-day identity, ask for consent and use the normal anonymous id, or send your own
distinct_idfor logged-in users.Without
LC_COOKIELESS_SECRETon the deployment, cookieless events carry no id and are not counted per visitor.
SDK
Turn it on in the snippet:
lucida.init("lc_pk_...", { consent: { geo: true } });Until the answer arrives every consent category is denied: nothing is written to cookies or storage and events wait in memory. Then:
opt_out: held state is stored and held events are sent;opt_in: nothing is stored or sent until the visitor decides (held events are kept only withqueueBeforeConsent);cookieless: held state is dropped and events go out without ids or person properties.
A visitor who already decided (a stored decision) never waits. If the config does not answer within 3 seconds the local consent.mode applies. In @lucida-analytics/sdk-core the same flow is consent: { awaitRemote: true } plus core.applyRemote(config).
Defaults: events are allow-unless-denied, list joins are deny-unless-granted
The two paths have opposite defaults. Know which one you are on.
Events from the SDK: sent unless the visitor denied analytics. The browser SDK's default mode is opt_out. A visitor who has not decided is tracked under the default settings: getConsentStatus() says pending, yet the SDK stores and sends from the first page view. Only an explicit denial of analytics stops capture, and it removes the lc_* items already stored. The same holds on the way out: the default delivery rules of a connector destination withhold a record only when the person denied a consent category. A record with no recorded decision goes out.
To make events default-deny, start in opt_in. Either set it in code, or set it for the whole project, which wins over any page setting:
init("lc_pk_YOUR_PUBLIC_KEY", { consent: { mode: "opt_in" } });curl -X PUT https://lucidace.com/v1/projects/$LUCIDA_PROJECT_ID/settings/sdk \
-H "Authorization: Bearer $LUCIDA_SECRET_KEY" -H "Content-Type: application/json" \
-d '{"consent_mode": "opt_in"}'In opt_in mode nothing is stored or sent until setConsent({ analytics: true }) (or optIn(), or your Cookie Munch bridge) runs. A project opt_in is stricter than the page and always wins; a project opt_out never loosens a page opt_in. Until the project config answers, the SDK holds every send, and if it does not answer in 3 seconds it fails closed to opt_in. The classic script takes the same option in lucidaQueue.push(["init", key, { consent: { mode: "opt_in" } }]). Server SDKs have no banner: you decide before you call capture.
List and person joins from connectors: sent only when consent is granted. Audience syncs and messaging connectors add a person only when their consent property is true; a missing value means no. For example, a sync with a consent_property (beehiiv defaults to marketing_consent) adds only people whose property is true. A destination route that names consent categories drops a record with no decision by default (missing: "drop"); hold parks it for a later re-check and allow is for consent collected outside Lucida. An explicit denial always drops.
So an undecided visitor can show up in your event data under the default settings but never in a list pushed to an outside tool. If you want events default-deny too, use opt_in as above.
Verify
cargo test -p lc-api sdk_consent_geogo test ./gateway -run 'ConsentGeo|GeoConsent|CookielessGeo'pnpm --filter @lucida-analytics/sdk-core test remote-settings,pnpm --filter @lucida-analytics/browser test geo-consentpnpm --filter @lucida/web test session-geo-consent
Using Cookie Munch as the banner? The SDK can follow it: see Cookie Munch consent.