Svelte

Public Preview

Svelte is currently in public preview.

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

<script lang="ts">
  import { IabPrivacyConsentPurposeId, IabPrivacyConsentPurposeIdMap } from '@seeka-labs/converge';
  import { convergeSDK } from '@seeka-labs/converge-svelte';

  $: sdk = $convergeSDK;

  function optIn() {
    sdk?.privacy.setPrivacyState({
      grantedIabPurposeIds: [IabPrivacyConsentPurposeIdMap[IabPrivacyConsentPurposeId.MeasureAdvertisingPerformance]],
      deniedIabPurposeIds: [],
    });
  }

  function optOut() {
    sdk?.privacy.setPrivacyState({
      grantedIabPurposeIds: [],
      deniedIabPurposeIds: [IabPrivacyConsentPurposeIdMap[IabPrivacyConsentPurposeId.MeasureAdvertisingPerformance]],
    });
  }
</script>

<main>
  <button on:click={optIn} disabled={!sdk}>Opt in</button>
  <button on:click={optOut} disabled={!sdk}>Opt out</button>
</main>

Pass a TCF v2 consent string instead

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

function applyConsent(tcfString) {
  sdk?.privacy.setPrivacyState({ tcfConsentString: tcfString });
}

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

Multi-instance installs

If you install multiple converge instances per page, call setPrivacyState on the scoped SDK wrapper - it fans out across every instance. See Multi-instance installs in the browser overview.

Verifying it works

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