React / Next.js / Gatsby

Wire the Seeka consent API into your cookie banner component.

Before this works

These consent calls gate destinations only when the session's effective data control mode is implicit or explicit - from the brand's configured default or a session override. With a disabled default and no override, the calls below are recorded but block nothing.

Opt in / opt out

import { useSeekaConverge } from '@seeka-labs/converge-react';
import { IabPrivacyConsentPurposeId, IabPrivacyConsentPurposeIdMap } from '@seeka-labs/converge';

export const ConsentControls = () => {
  const converge = useSeekaConverge();

  const optOut = () => {
    converge.privacy.setPrivacyState({
      grantedIabPurposeIds: [],
      deniedIabPurposeIds: [IabPrivacyConsentPurposeIdMap[IabPrivacyConsentPurposeId.MeasureAdvertisingPerformance]],
    });
  };

  const optIn = () => {
    converge.privacy.setPrivacyState({
      grantedIabPurposeIds: [IabPrivacyConsentPurposeIdMap[IabPrivacyConsentPurposeId.MeasureAdvertisingPerformance]],
      deniedIabPurposeIds: [],
    });
  };

  return (
    <>
      <Button variant="outlined" onClick={optOut}>Opt out</Button>
      <Button variant="outlined" onClick={optIn}>Opt in</Button>
    </>
  );
};

Pass a TCF v2 consent string instead

If your CMP exposes a TCF v2 consent string, hand it through directly:

const applyConsent = (tcfString) => {
  converge.privacy.setPrivacyState({ tcfConsentString: tcfString });
};

If you supply both grantedIabPurposeIds and tcfConsentString, the explicit purpose list wins.

Session-scoped data control override for embedding vendors

If you embed Seeka on behalf of a brand, you can tighten the data control mode for a single browser session without changing the brand's configured mode. See the browser overview for the full semantics and the important explicit caveat.

React installs Seeka via <SeekaProvider> (or useSeekaConverge), so set the override on the data layer global before the provider mounts - e.g. at the top of your entry module, before ReactDOM.createRoot(...).render(...):

window.Seeka = window.Seeka || {};
window.Seeka.privacy = { mode: 'explicit' }; // 'disabled' | 'implicit' | 'explicit'

// ...then render your <SeekaProvider>

It tightens only (disabled > implicit > explicit) and persists nothing against the brand. The React example project ships this snippet ready to uncomment in src/index.tsx (commented out so the example tracks normally by default).

Remember: an explicit override blocks all tracking - including Seeka's own first-party collection - until you capture consent via setPrivacyState(...). Use implicit for opt-out behaviour that keeps data flowing unless the visitor denies a purpose.

Multi-instance installs

If you install multiple converge instances per page, useSeekaConverge() already hands you the scoped SDK - setPrivacyState called on it fans out across every instance, so no special handling is needed in React. See Multi-instance installs in the browser overview.

Verifying it works

See Privacy SDK troubleshooting for how to confirm destinations are actually being gated.