---
title: IAB TCF 2.3
description: Implement IAB Transparency & Consent Framework 2.3 compliance for programmatic advertising in EU/EEA jurisdictions.
---
<import src="../../../shared/react/iab/overview.mdx#intro" />

## Quick Setup

Enable IAB TCF in the runtime options:

```ts
import { getOrCreateConsentRuntime } from 'c15t';
import { iab } from '@c15t/iab';

const { consentStore } = getOrCreateConsentRuntime({
  mode: 'hosted',
  backendURL: 'https://your-instance.c15t.dev',
  iab: iab({
    vendors: [1, 2, 10, 25],  // IAB vendor IDs you work with
    // cmpId is automatically provided by the backend (inth.com).
    // Only set this if you have your own CMP registration with IAB Europe.
    // cmpId: 123,
  }),
});
```

## Accessing IAB State

The IAB manager is available on the store state when IAB is enabled:

```ts
const { iab } = consentStore.getState();

if (iab) {
  console.log('GVL:', iab.gvl);
  console.log('Vendor consents:', iab.vendorConsents);
  console.log('Purpose consents:', iab.purposeConsents);
}

// Subscribe to IAB state changes
consentStore.subscribe((state, prevState) => {
  if (state.iab !== prevState.iab && state.iab) {
    console.log('IAB state updated:', state.iab);
  }
});
```

## `__tcfapi` Stub

When IAB is enabled, c15t automatically registers the `__tcfapi` function on the window object. This is the standard CMP API that ad tech vendors use to check consent:

```ts
// Third-party scripts can use the standard TCF API
window.__tcfapi('getTCData', 2, (tcData, success) => {
  if (success) {
    console.log('TC String:', tcData.tcString);
    console.log('Purpose consents:', tcData.purpose.consents);
  }
});
```

<import src="../../../shared/react/iab/overview.mdx#config-and-concepts" />

> ℹ️ **Info:**
> The c15t core package handles all IAB logic (TC string generation, \_\_tcfapi registration, GVL fetching) without any framework-specific components. Build your own IAB consent UI using the store state, or use @c15t/react for pre-built IAB components.
