Use Consent Manager

Location Info

locationInfo

The locationInfo state contains the user's detected geographic information:

const { locationInfo } = useConsentManager();

if (locationInfo) {
  console.log(locationInfo.jurisdiction); // 'GDPR', 'CCPA', etc.
  console.log(locationInfo.countryCode);  // 'DE', 'US', etc.
  console.log(locationInfo.regionCode);   // 'BY', 'CA', etc.
}

locationInfo is null until the backend responds with geolocation data (or in offline mode if no overrides are set).

Jurisdiction Codes

CodeRegionConsent Model
GDPREuropean Unionopt-in
UK_GDPRUnited Kingdomopt-in
CHSwitzerlandopt-in
BRBrazil (LGPD)opt-in
APPIJapanopt-in
PIPASouth Koreaopt-in
PIPEDACanada (excl. Quebec)opt-out
QC_LAW25Quebec, Canadaopt-in
CCPACalifornia, USAopt-out
AUAustraliaopt-out
NONENo jurisdictionnull model

setOverrides()

Override detected values for testing or manual configuration. This triggers a re-fetch of consent banner data with the new values:

const { setOverrides } = useConsentManager();

// Override country (triggers jurisdiction detection)
await setOverrides({ country: 'DE' });

// Override language
await setOverrides({ language: 'de' });

// Override both
await setOverrides({ country: 'US', region: 'CA', language: 'es' });

setLocationInfo()

Directly set location info without triggering a re-fetch:

const { setLocationInfo } = useConsentManager();

setLocationInfo({
  jurisdiction: 'GDPR',
  countryCode: 'DE',
  regionCode: 'BY',
});

Testing Different Jurisdictions

A development-only component for testing consent behavior across jurisdictions:

function JurisdictionTester() {
  const { setOverrides, model, locationInfo } = useConsentManager();

  const testCases = [
    { label: 'GDPR', country: 'DE' },
    { label: 'CCPA', country: 'US', region: 'CA' },
    { label: 'PIPEDA', country: 'CA', region: undefined },
    { label: 'QC_LAW25', country: 'CA', region: 'QC' },
    { label: 'NONE', country: 'US', region: 'TX' },
  ];

  return (
    <div>
      <p>Current: {locationInfo?.jurisdiction ?? 'none'} → model: {model}</p>
      {testCases.map((tc) => (
        <button key={tc.label} onClick={() => setOverrides({ country: tc.country, region: tc.region })}>
          Test as {tc.label}
        </button>
      ))}
    </div>
  );
}