Location & Identity

Access detected location, override geolocation, change language, and link user identity.

locationInfo

The detected location data, available after initialization completes. Contains the user's country and region as resolved by the c15t backend (or overrides in offline mode).

Subscribe to location changes:

setOverrides(overrides)

Override the detected geolocation. This re-runs initialization with the new location, which may change the consent model (e.g., switching from opt-out to opt-in when changing from US to DE).

Info

setOverrides() triggers a new /init request to the backend (in c15t mode), so the resolved jurisdiction, model, and translations will update accordingly.

setLanguage(language)

Change the active language at runtime. This re-fetches the consent banner to get server-resolved translations for the new language.

Use this to build a language switcher:

identifyUser(user)

Link an authenticated user identity to the consent record. This allows the c15t backend to associate consent across devices for the same user.

The identityProvider field indicates which auth system provided the ID (e.g., 'clerk', 'auth0', 'custom').

Info

identifyUser() sends the user ID to the c15t backend. Only call this after the user has authenticated and consented to being identified.