@c15t/nextjs 2.0.0-rc.3 → 2.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/components/consent-dialog-link.js +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/libs/browser-initial-data.cjs +1 -0
- package/dist/libs/browser-initial-data.js +1 -0
- package/dist/libs/initial-data.cjs +1 -1
- package/dist/libs/initial-data.js +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist-types/headless.d.ts +1 -0
- package/{dist → dist-types}/index.d.ts +4 -3
- package/dist-types/libs/browser-initial-data.d.ts +9 -0
- package/{dist → dist-types}/libs/initial-data.d.ts +1 -2
- package/dist-types/types.d.ts +38 -0
- package/dist-types/version.d.ts +1 -0
- package/docs/README.md +73 -0
- package/docs/building-headless-components.md +250 -0
- package/docs/callbacks.md +117 -0
- package/docs/components/consent-banner.md +174 -0
- package/docs/components/consent-dialog-link.md +59 -0
- package/docs/components/consent-dialog-trigger.md +103 -0
- package/docs/components/consent-dialog.md +137 -0
- package/docs/components/consent-manager-provider.md +422 -0
- package/docs/components/consent-widget.md +78 -0
- package/docs/components/dev-tools.md +63 -0
- package/docs/components/frame.md +73 -0
- package/docs/concepts/client-modes.md +163 -0
- package/docs/concepts/consent-categories.md +97 -0
- package/docs/concepts/consent-models.md +116 -0
- package/docs/concepts/cookie-management.md +122 -0
- package/docs/concepts/glossary.md +23 -0
- package/docs/concepts/initialization-flow.md +141 -0
- package/docs/concepts/policy-packs.md +229 -0
- package/docs/headless.md +184 -0
- package/docs/hooks/use-color-scheme.md +40 -0
- package/docs/hooks/use-consent-manager/checking-consent.md +94 -0
- package/docs/hooks/use-consent-manager/location-info.md +95 -0
- package/docs/hooks/use-consent-manager/overview.md +390 -0
- package/docs/hooks/use-consent-manager/setting-consent.md +92 -0
- package/docs/hooks/use-draggable.md +57 -0
- package/docs/hooks/use-focus-trap.md +41 -0
- package/docs/hooks/use-reduced-motion.md +35 -0
- package/docs/hooks/use-ssr-status.md +31 -0
- package/docs/hooks/use-text-direction.md +49 -0
- package/docs/hooks/use-translations.md +116 -0
- package/docs/iab/consent-banner.md +95 -0
- package/docs/iab/consent-dialog.md +135 -0
- package/docs/iab/overview.md +119 -0
- package/docs/iab/use-gvl-data.md +208 -0
- package/docs/iframe-blocking.md +107 -0
- package/docs/integrations/databuddy.md +186 -0
- package/docs/integrations/google-tag-manager.md +153 -0
- package/docs/integrations/google-tag.md +149 -0
- package/docs/integrations/linkedin-insights.md +109 -0
- package/docs/integrations/meta-pixel.md +342 -0
- package/docs/integrations/microsoft-uet.md +112 -0
- package/docs/integrations/overview.md +89 -0
- package/docs/integrations/posthog.md +177 -0
- package/docs/integrations/tiktok-pixel.md +113 -0
- package/docs/integrations/x-pixel.md +143 -0
- package/docs/internationalization.md +197 -0
- package/docs/network-blocker.md +178 -0
- package/docs/optimization.md +156 -0
- package/docs/policy-packs.md +246 -0
- package/docs/quickstart.md +145 -0
- package/docs/script-loader.md +300 -0
- package/docs/server-side.md +171 -0
- package/docs/styling/classnames.md +84 -0
- package/docs/styling/color-scheme.md +82 -0
- package/docs/styling/css-variables.md +92 -0
- package/docs/styling/overview.md +312 -0
- package/docs/styling/slots.md +93 -0
- package/docs/styling/tailwind.md +86 -0
- package/docs/styling/tokens.md +214 -0
- package/docs/troubleshooting.md +146 -0
- package/package.json +20 -10
- package/dist/headless.d.ts +0 -2
- package/dist/headless.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/libs/initial-data.d.ts.map +0 -1
- package/dist/types.d.ts +0 -16
- package/dist/types.d.ts.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: useTextDirection
|
|
3
|
+
description: Manage RTL/LTR text direction based on the active language for consent UI.
|
|
4
|
+
---
|
|
5
|
+
`useTextDirection()` determines the correct text direction (`'ltr'` or `'rtl'`) based on the provided language and sets it on the document. It wraps the `@c15t/ui` text direction utilities as a React hook.
|
|
6
|
+
|
|
7
|
+
This is used internally by IAB components but is available for custom UI that needs to handle bidirectional text.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { useTextDirection } from '@c15t/react/hooks';
|
|
11
|
+
|
|
12
|
+
function CustomConsentUI({ language }: { language: string }) {
|
|
13
|
+
const direction = useTextDirection(language);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div dir={direction}>
|
|
17
|
+
{/* Content renders correctly for RTL languages like Arabic and Hebrew */}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Parameters
|
|
24
|
+
|
|
25
|
+
|Parameter|Type|Default|Description|
|
|
26
|
+
|--|--|--|--|
|
|
27
|
+
|`language`|`string \|undefined`|—|BCP 47 language tag (e.g. `'en'`, `'ar'`, `'he'`)|
|
|
28
|
+
|
|
29
|
+
## Return Value
|
|
30
|
+
|
|
31
|
+
|Type|Description|
|
|
32
|
+
|--|--|
|
|
33
|
+
|`'ltr' \|'rtl'`|The text direction for the given language|
|
|
34
|
+
|
|
35
|
+
## RTL Languages
|
|
36
|
+
|
|
37
|
+
The hook recognizes standard RTL languages including Arabic (`ar`), Hebrew (`he`), Persian (`fa`), and Urdu (`ur`), among others.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { useConsentManager } from '@c15t/nextjs';
|
|
41
|
+
import { useTextDirection } from '@c15t/react/hooks';
|
|
42
|
+
|
|
43
|
+
function BiDirectionalBanner() {
|
|
44
|
+
const { translationConfig } = useConsentManager();
|
|
45
|
+
const dir = useTextDirection(translationConfig.defaultLanguage);
|
|
46
|
+
|
|
47
|
+
return <div dir={dir}>...</div>;
|
|
48
|
+
}
|
|
49
|
+
```
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: useTranslations
|
|
3
|
+
description: Access the current language's translations for building custom consent UI.
|
|
4
|
+
---
|
|
5
|
+
`useTranslations()` returns the `Translations` object for the currently active language. Use it when building custom consent UI that needs translated text.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { useTranslations } from '@c15t/nextjs';
|
|
9
|
+
|
|
10
|
+
function CustomBanner() {
|
|
11
|
+
const translations = useTranslations();
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<h2>{translations.cookieBanner.title}</h2>
|
|
16
|
+
<p>{translations.cookieBanner.description}</p>
|
|
17
|
+
<button>{translations.common.acceptAll}</button>
|
|
18
|
+
<button>{translations.common.rejectAll}</button>
|
|
19
|
+
</div>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Translation Sections
|
|
25
|
+
|
|
26
|
+
The returned `Translations` object has these sections:
|
|
27
|
+
|
|
28
|
+
### Translations
|
|
29
|
+
|
|
30
|
+
|Property|Type|Description|Default|Required|
|
|
31
|
+
|:--|:--|:--|:--|:--:|
|
|
32
|
+
|common|CommonTranslations|-|-|✅ Required|
|
|
33
|
+
|cookieBanner|CookieBannerTranslations|-|-|✅ Required|
|
|
34
|
+
|consentManagerDialog|ConsentManagerDialogTranslations|-|-|✅ Required|
|
|
35
|
+
|consentTypes|Object \|undefined|-|-|✅ Required|
|
|
36
|
+
|frame|FrameTranslations \|undefined|-|-|Optional|
|
|
37
|
+
|legalLinks|LegalLinksTranslations \|undefined|-|-|Optional|
|
|
38
|
+
|iab|Object \|undefined|-|-|Optional|
|
|
39
|
+
|
|
40
|
+
#### `common` CommonTranslations
|
|
41
|
+
|
|
42
|
+
|Property|Type|Description|Default|Required|
|
|
43
|
+
|:--|:--|:--|:--|:--:|
|
|
44
|
+
|acceptAll|string \|undefined|-|-|✅ Required|
|
|
45
|
+
|rejectAll|string \|undefined|-|-|✅ Required|
|
|
46
|
+
|customize|string \|undefined|-|-|✅ Required|
|
|
47
|
+
|save|string \|undefined|-|-|✅ Required|
|
|
48
|
+
|
|
49
|
+
#### `cookieBanner` CookieBannerTranslations
|
|
50
|
+
|
|
51
|
+
|Property|Type|Description|Default|Required|
|
|
52
|
+
|:--|:--|:--|:--|:--:|
|
|
53
|
+
|title|string \|undefined|-|-|✅ Required|
|
|
54
|
+
|description|string \|undefined|-|-|✅ Required|
|
|
55
|
+
|
|
56
|
+
#### `consentManagerDialog` ConsentManagerDialogTranslations
|
|
57
|
+
|
|
58
|
+
|Property|Type|Description|Default|Required|
|
|
59
|
+
|:--|:--|:--|:--|:--:|
|
|
60
|
+
|title|string \|undefined|-|-|✅ Required|
|
|
61
|
+
|description|string \|undefined|-|-|✅ Required|
|
|
62
|
+
|
|
63
|
+
#### `consentTypes`
|
|
64
|
+
|
|
65
|
+
|Property|Type|Description|Default|Required|
|
|
66
|
+
|:--|:--|:--|:--|:--:|
|
|
67
|
+
|experience|ConsentTypeTranslations \|undefined|-|-|✅ Required|
|
|
68
|
+
|functionality|ConsentTypeTranslations \|undefined|-|-|✅ Required|
|
|
69
|
+
|marketing|ConsentTypeTranslations \|undefined|-|-|✅ Required|
|
|
70
|
+
|measurement|ConsentTypeTranslations \|undefined|-|-|✅ Required|
|
|
71
|
+
|necessary|ConsentTypeTranslations \|undefined|-|-|✅ Required|
|
|
72
|
+
|
|
73
|
+
#### `frame` FrameTranslations
|
|
74
|
+
|
|
75
|
+
|Property|Type|Description|Default|Required|
|
|
76
|
+
|:--|:--|:--|:--|:--:|
|
|
77
|
+
|title|string \|undefined|You can use the \{category} placeholder to dynamically insert the consent category name.|-|✅ Required|
|
|
78
|
+
|actionButton|string \|undefined|You can use the \{category} placeholder to dynamically insert the consent category name.|-|✅ Required|
|
|
79
|
+
|policyBlocked|string \|undefined|Message shown when the frame category is blocked by active policy scope.|-|✅ Required|
|
|
80
|
+
|
|
81
|
+
#### `legalLinks` LegalLinksTranslations
|
|
82
|
+
|
|
83
|
+
|Property|Type|Description|Default|Required|
|
|
84
|
+
|:--|:--|:--|:--|:--:|
|
|
85
|
+
|privacyPolicy|string \|undefined|-|-|✅ Required|
|
|
86
|
+
|cookiePolicy|string \|undefined|-|-|✅ Required|
|
|
87
|
+
|termsOfService|string \|undefined|-|-|✅ Required|
|
|
88
|
+
|
|
89
|
+
#### `iab`
|
|
90
|
+
|
|
91
|
+
|Property|Type|Description|Default|Required|
|
|
92
|
+
|:--|:--|:--|:--|:--:|
|
|
93
|
+
|banner|DeepPartial\<IABBannerTranslations> \|undefined|-|-|✅ Required|
|
|
94
|
+
|preferenceCenter|DeepPartial\<IABPreferenceCenterTranslations> \|undefined|-|-|✅ Required|
|
|
95
|
+
|common|DeepPartial\<IABCommonTranslations> \|undefined|-|-|✅ Required|
|
|
96
|
+
|
|
97
|
+
## With setLanguage
|
|
98
|
+
|
|
99
|
+
Translations update automatically when the language changes:
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import { useConsentManager, useTranslations } from '@c15t/nextjs';
|
|
103
|
+
|
|
104
|
+
function LocalizedConsent() {
|
|
105
|
+
const { setLanguage } = useConsentManager();
|
|
106
|
+
const translations = useTranslations();
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<div>
|
|
110
|
+
<p>{translations.cookieBanner.description}</p>
|
|
111
|
+
<button onClick={() => setLanguage('de')}>Deutsch</button>
|
|
112
|
+
<button onClick={() => setLanguage('fr')}>Français</button>
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: IABConsentBanner
|
|
3
|
+
description: An IAB TCF 2.3 compliant consent banner that displays partner count, purpose summaries, and legitimate interest notices.
|
|
4
|
+
---
|
|
5
|
+
> ❌ **Error:**
|
|
6
|
+
> c15t is not yet IAB certified. The IAB TCF components are under active development and should not be used in production. APIs and behavior may change before certification is achieved.
|
|
7
|
+
|
|
8
|
+
`IABConsentBanner` is a pre-built consent banner that follows the [IAB Transparency & Consent Framework (TCF) 2.3](https://iabeurope.eu/tcf-2-0/) specification. It renders when the consent model is set to `'iab'` and includes required disclosures like partner count, purpose summaries, and legitimate interest notices.
|
|
9
|
+
|
|
10
|
+
Use this component instead of `ConsentBanner` when you need IAB TCF compliance for programmatic advertising in EU jurisdictions.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
* Your site participates in the IAB TCF ecosystem (ad exchanges, SSPs, DSPs)
|
|
15
|
+
* You need to disclose vendor partnerships and data processing purposes per IAB requirements
|
|
16
|
+
* The detected jurisdiction requires IAB TCF compliance (typically EU/EEA)
|
|
17
|
+
|
|
18
|
+
## Basic Usage
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { type ReactNode } from 'react';
|
|
22
|
+
import {
|
|
23
|
+
ConsentManagerProvider,
|
|
24
|
+
IABConsentBanner,
|
|
25
|
+
IABConsentDialog,
|
|
26
|
+
} from '@c15t/nextjs';
|
|
27
|
+
|
|
28
|
+
export default function ConsentManager({ children }: { children: ReactNode }) {
|
|
29
|
+
return (
|
|
30
|
+
<ConsentManagerProvider
|
|
31
|
+
options={{
|
|
32
|
+
mode: 'hosted',
|
|
33
|
+
backendURL: '/api/c15t',
|
|
34
|
+
iab: {
|
|
35
|
+
enabled: true,
|
|
36
|
+
cmpId: 123,
|
|
37
|
+
vendors: [1, 2, 10, 25],
|
|
38
|
+
},
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
<IABConsentBanner />
|
|
42
|
+
<IABConsentDialog />
|
|
43
|
+
{children}
|
|
44
|
+
</ConsentManagerProvider>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> ℹ️ **Info:**
|
|
50
|
+
> The banner only renders when IAB mode is enabled and the GVL (Global Vendor List) has been loaded. If iab.enabled is false or the server does not return GVL data, nothing is rendered.
|
|
51
|
+
|
|
52
|
+
## Banner Content
|
|
53
|
+
|
|
54
|
+
The IAB banner automatically displays:
|
|
55
|
+
|
|
56
|
+
* **Title** — Heading text from IAB translations
|
|
57
|
+
* **Description** — Includes the partner count (e.g., "We and our \{partnerCount} partners...")
|
|
58
|
+
* **Partners link** — Clickable link that opens the vendor tab in the preference center
|
|
59
|
+
* **Purpose/stack list** — Up to 5 purpose/stack names summarizing data usage, with an "and X more" overflow
|
|
60
|
+
* **Legitimate interest notice** — Required IAB disclosure about legitimate interest processing
|
|
61
|
+
* **Scope notice** — Service-specific scope disclosure
|
|
62
|
+
|
|
63
|
+
## Buttons
|
|
64
|
+
|
|
65
|
+
The banner includes three action buttons:
|
|
66
|
+
|
|
67
|
+
|Button|Action|
|
|
68
|
+
|--|--|
|
|
69
|
+
|**Reject All**|Rejects all IAB purposes and closes the banner|
|
|
70
|
+
|**Accept All**|Accepts all IAB purposes and closes the banner|
|
|
71
|
+
|**Customize**|Opens the IABConsentDialog purposes tab|
|
|
72
|
+
|
|
73
|
+
### Primary Button
|
|
74
|
+
|
|
75
|
+
Highlight a specific button as the primary action:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
<IABConsentBanner primaryButton="accept" />
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Options: `'reject'`, `'accept'`, `'customize'` (default: `'customize'`)
|
|
82
|
+
|
|
83
|
+
## Props
|
|
84
|
+
|
|
85
|
+
### IABConsentBannerProps
|
|
86
|
+
|
|
87
|
+
|Property|Type|Description|Default|Required|
|
|
88
|
+
|:--|:--|:--|:--|:--:|
|
|
89
|
+
|noStyle|boolean \|undefined|When true, removes all default styling from the component.|false|Optional|
|
|
90
|
+
|disableAnimation|boolean \|undefined|When true, disables entrance/exit animations.|false|Optional|
|
|
91
|
+
|scrollLock|boolean \|undefined|When true, locks page scroll when the banner is visible.|true|Optional|
|
|
92
|
+
|trapFocus|boolean \|undefined|When true, traps keyboard focus within the banner.|true|Optional|
|
|
93
|
+
|primaryButton|"customize" \|"accept" \|"reject" \|undefined|Specifies which button should be highlighted as primary.|'customize'|Optional|
|
|
94
|
+
|models|Model \|undefined|Which consent models this banner responds to.|\['iab']|Optional|
|
|
95
|
+
|uiSource|string \|undefined|Override the UI source identifier sent with consent API calls.|'iab\_banner'|Optional|
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: IABConsentDialog
|
|
3
|
+
description: An IAB TCF 2.3 compliant preference center with tabbed purpose and vendor management.
|
|
4
|
+
---
|
|
5
|
+
> ❌ **Error:**
|
|
6
|
+
> c15t is not yet IAB certified. The IAB TCF components are under active development and should not be used in production. APIs and behavior may change before certification is achieved.
|
|
7
|
+
|
|
8
|
+
`IABConsentDialog` is an IAB TCF 2.3 compliant consent dialog that provides a tabbed interface for managing purpose consent and vendor preferences. It includes purpose grouping via stacks, individual purpose/vendor toggles, special purpose and feature disclosures, and legitimate interest handling.
|
|
9
|
+
|
|
10
|
+
## Basic Usage
|
|
11
|
+
|
|
12
|
+
Pair it with `IABConsentBanner` inside the provider:
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { type ReactNode } from 'react';
|
|
16
|
+
import {
|
|
17
|
+
ConsentManagerProvider,
|
|
18
|
+
IABConsentBanner,
|
|
19
|
+
IABConsentDialog,
|
|
20
|
+
} from '@c15t/nextjs';
|
|
21
|
+
|
|
22
|
+
export default function ConsentManager({ children }: { children: ReactNode }) {
|
|
23
|
+
return (
|
|
24
|
+
<ConsentManagerProvider
|
|
25
|
+
options={{
|
|
26
|
+
mode: 'hosted',
|
|
27
|
+
backendURL: '/api/c15t',
|
|
28
|
+
iab: {
|
|
29
|
+
enabled: true,
|
|
30
|
+
cmpId: 123,
|
|
31
|
+
vendors: [1, 2, 10, 25],
|
|
32
|
+
},
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<IABConsentBanner />
|
|
36
|
+
<IABConsentDialog />
|
|
37
|
+
{children}
|
|
38
|
+
</ConsentManagerProvider>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Tabs
|
|
44
|
+
|
|
45
|
+
The dialog has two tabs:
|
|
46
|
+
|
|
47
|
+
### Purposes Tab
|
|
48
|
+
|
|
49
|
+
Displays all IAB purposes grouped into:
|
|
50
|
+
|
|
51
|
+
* **Standalone purposes** — Purpose 1 (Store and/or access information on a device) is always shown standalone per IAB TCF spec
|
|
52
|
+
* **Stacks** — Groups of related purposes determined by the GVL. Each stack is expandable to show individual purpose toggles
|
|
53
|
+
* **Special features** — Opt-in features like precise geolocation
|
|
54
|
+
* **Essential functions** — Special purposes and features that are locked (no user toggle) because they're required for basic operation
|
|
55
|
+
|
|
56
|
+
Each purpose shows:
|
|
57
|
+
|
|
58
|
+
* Name and description
|
|
59
|
+
* Number of vendors using this purpose
|
|
60
|
+
* Consent toggle (or lock icon for essential functions)
|
|
61
|
+
* Legitimate interest toggle where applicable
|
|
62
|
+
* Expandable vendor list
|
|
63
|
+
|
|
64
|
+
### Vendors Tab
|
|
65
|
+
|
|
66
|
+
Displays all vendors from the GVL plus any custom vendors:
|
|
67
|
+
|
|
68
|
+
* Search and filter vendors
|
|
69
|
+
* Per-vendor consent and legitimate interest toggles
|
|
70
|
+
* Vendor details: privacy policy link, cookie usage, data retention
|
|
71
|
+
* Purpose and feature associations
|
|
72
|
+
|
|
73
|
+
## Controlled State
|
|
74
|
+
|
|
75
|
+
By default, the dialog follows `activeUI === 'dialog'` from the consent store. Use `open` for manual control:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { useState } from 'react';
|
|
79
|
+
import { IABConsentDialog } from '@c15t/nextjs';
|
|
80
|
+
|
|
81
|
+
function SettingsPage() {
|
|
82
|
+
const [open, setOpen] = useState(false);
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<>
|
|
86
|
+
<button onClick={() => setOpen(true)}>TCF Preferences</button>
|
|
87
|
+
<IABConsentDialog open={open} />
|
|
88
|
+
</>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Floating Trigger
|
|
94
|
+
|
|
95
|
+
Add a floating button so users can re-open the dialog after dismissing the banner. IAB TCF requires the preference center to be easily resurfaceable:
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
<IABConsentDialog showTrigger />
|
|
99
|
+
|
|
100
|
+
{/* Custom trigger options */}
|
|
101
|
+
<IABConsentDialog
|
|
102
|
+
showTrigger={{
|
|
103
|
+
icon: 'settings',
|
|
104
|
+
defaultPosition: 'bottom-left',
|
|
105
|
+
showWhen: 'after-consent',
|
|
106
|
+
size: 'sm',
|
|
107
|
+
}}
|
|
108
|
+
/>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Footer Actions
|
|
112
|
+
|
|
113
|
+
The dialog footer provides three buttons:
|
|
114
|
+
|
|
115
|
+
|Button|Action|
|
|
116
|
+
|--|--|
|
|
117
|
+
|**Reject All**|Rejects all purposes and vendors, closes dialog and banner|
|
|
118
|
+
|**Accept All**|Accepts all purposes and vendors, closes dialog and banner|
|
|
119
|
+
|**Save Settings**|Saves current selections, closes dialog and banner|
|
|
120
|
+
|
|
121
|
+
## Props
|
|
122
|
+
|
|
123
|
+
### IABConsentDialogProps
|
|
124
|
+
|
|
125
|
+
|Property|Type|Description|Default|Required|
|
|
126
|
+
|:--|:--|:--|:--|:--:|
|
|
127
|
+
|open|boolean \|undefined|Control the open state. If omitted, follows activeUI === 'dialog' from context.|-|Optional|
|
|
128
|
+
|noStyle|boolean \|undefined|When true, removes all default styling.|false|Optional|
|
|
129
|
+
|disableAnimation|boolean \|undefined|When true, disables entrance/exit animations.|false|Optional|
|
|
130
|
+
|scrollLock|boolean \|undefined|When true, locks page scroll when the dialog is visible.|true|Optional|
|
|
131
|
+
|trapFocus|boolean \|undefined|When true, traps keyboard focus within the dialog.|true|Optional|
|
|
132
|
+
|hideBranding|boolean \|undefined|When true, hides the branding in the footer.|false|Optional|
|
|
133
|
+
|showTrigger|ConsentDialogTriggerProps \|undefined|Show a floating trigger button to resurface the consent dialog. IAB TCF requires the consent dialog to be easily resurfaceable. Options: \`true\` - Show trigger with default settings; \`false\` - Hide trigger (default); \`ConsentDialogTriggerProps\` - Show trigger with custom props|false|Optional|
|
|
134
|
+
|models|Model \|undefined|Which consent models this dialog responds to.|\['iab']|Optional|
|
|
135
|
+
|uiSource|string \|undefined|Override the UI source identifier sent with consent API calls.|'iab\_dialog'|Optional|
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: IAB TCF 2.3
|
|
3
|
+
description: Implement IAB Transparency & Consent Framework 2.3 compliance for programmatic advertising in EU/EEA jurisdictions.
|
|
4
|
+
---
|
|
5
|
+
## What is IAB TCF?
|
|
6
|
+
|
|
7
|
+
The [IAB Transparency & Consent Framework (TCF)](https://iabeurope.eu/tcf-2-0/) is a standardized protocol for communicating user consent choices to ad tech vendors in the programmatic advertising ecosystem. TCF 2.3 is the current version and is widely adopted across the EU/EEA.
|
|
8
|
+
|
|
9
|
+
When your site participates in the IAB ecosystem (ad exchanges, SSPs, DSPs, DMPs), you need to:
|
|
10
|
+
|
|
11
|
+
* Disclose which vendors process user data and for what purposes
|
|
12
|
+
* Collect granular consent for each IAB-defined purpose
|
|
13
|
+
* Generate a **TC String** — a standardized encoding of consent choices that ad tech vendors can read
|
|
14
|
+
* Expose the `__tcfapi` CMP stub for vendor scripts to query consent status
|
|
15
|
+
|
|
16
|
+
## CMP Registration
|
|
17
|
+
|
|
18
|
+
[consent.io](https://consent.io) is pending validation as an IAB Europe-registered CMP for c15t. Once approved, when you use consent.io as your backend, the correct CMP ID will be automatically provided to your client via the `/init` endpoint — no client-side configuration needed.
|
|
19
|
+
|
|
20
|
+
If you self-host the c15t backend and have your own CMP registration with IAB Europe, you can configure your CMP ID on the backend via `advanced.iab.cmpId` or on the client via the `iab.cmpId` option. A valid (non-zero) CMP ID is required for IAB TCF compliance.
|
|
21
|
+
|
|
22
|
+
> ℹ️ **Info:**
|
|
23
|
+
> If you heavily customize or build your own IAB banner or dialog (rather than using the default IABConsentBanner and IABConsentDialog components), you cannot use consent.io's CMP ID. You must register your own CMP with IAB Europe and use your own CMP ID.
|
|
24
|
+
|
|
25
|
+
## How c15t Implements TCF
|
|
26
|
+
|
|
27
|
+
c15t provides a complete IAB TCF 2.3 CMP (Consent Management Platform) implementation:
|
|
28
|
+
|
|
29
|
+
1. **Global Vendor List (GVL)** — Automatically fetched from the c15t backend. Contains the official IAB vendor registry with purposes, features, and stacks.
|
|
30
|
+
2. **IABConsentBanner** — A pre-built banner showing partner count, purpose summaries, and legitimate interest notices.
|
|
31
|
+
3. **IABConsentDialog** — A tabbed preference center for granular purpose and vendor consent management.
|
|
32
|
+
4. **TC String generation** — Consent choices are encoded into the standard TC String format.
|
|
33
|
+
5. **`__tcfapi` stub** — The standard CMP API is exposed on `window` so vendor scripts can query consent.
|
|
34
|
+
|
|
35
|
+
## Quick Setup
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { type ReactNode } from 'react';
|
|
39
|
+
import {
|
|
40
|
+
ConsentManagerProvider,
|
|
41
|
+
IABConsentBanner,
|
|
42
|
+
IABConsentDialog,
|
|
43
|
+
} from '@c15t/nextjs';
|
|
44
|
+
|
|
45
|
+
export default function ConsentManager({ children }: { children: ReactNode }) {
|
|
46
|
+
return (
|
|
47
|
+
<ConsentManagerProvider
|
|
48
|
+
options={{
|
|
49
|
+
mode: 'hosted',
|
|
50
|
+
backendURL: '/api/c15t',
|
|
51
|
+
iab: {
|
|
52
|
+
enabled: true,
|
|
53
|
+
vendors: [1, 2, 10, 25], // IAB vendor IDs you work with
|
|
54
|
+
// cmpId is automatically provided by the backend (consent.io).
|
|
55
|
+
// Only set this if you have your own CMP registration with IAB Europe.
|
|
56
|
+
// cmpId: 123,
|
|
57
|
+
},
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<IABConsentBanner />
|
|
61
|
+
<IABConsentDialog showTrigger />
|
|
62
|
+
{children}
|
|
63
|
+
</ConsentManagerProvider>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## IAB Configuration Options
|
|
69
|
+
|
|
70
|
+
The `iab` option on the provider accepts:
|
|
71
|
+
|
|
72
|
+
|Option|Type|Description|
|
|
73
|
+
|--|--|--|
|
|
74
|
+
|`enabled`|`boolean`|Enable IAB TCF mode|
|
|
75
|
+
|`cmpId`|`number`|CMP ID registered with IAB Europe. Automatically provided by the backend when using consent.io. Only set this if you have your own CMP registration.|
|
|
76
|
+
|`vendors`|`number[]`|IAB vendor IDs that your site works with|
|
|
77
|
+
|`nonIABVendors`|`NonIABVendor[]`|Custom vendors not in the IAB registry|
|
|
78
|
+
|
|
79
|
+
## Key Concepts
|
|
80
|
+
|
|
81
|
+
### Purposes
|
|
82
|
+
|
|
83
|
+
IAB defines 11 standard purposes for data processing (e.g., "Store and/or access information on a device", "Select basic ads", "Measure ad performance"). Each purpose can be consented to individually.
|
|
84
|
+
|
|
85
|
+
### Stacks
|
|
86
|
+
|
|
87
|
+
Purposes are grouped into **stacks** by the GVL for a simplified UI presentation. For example, "Advertising based on limited data" might group purposes 2, 7, and 10 together.
|
|
88
|
+
|
|
89
|
+
### Special Features
|
|
90
|
+
|
|
91
|
+
Features like precise geolocation or device scanning that require explicit opt-in beyond standard consent.
|
|
92
|
+
|
|
93
|
+
### Legitimate Interest
|
|
94
|
+
|
|
95
|
+
Some purposes can be processed under legitimate interest rather than consent. Users can object to legitimate interest processing per-vendor.
|
|
96
|
+
|
|
97
|
+
### Vendors
|
|
98
|
+
|
|
99
|
+
Each vendor in the GVL declares which purposes it uses, whether via consent or legitimate interest. The preference center lets users toggle consent per-vendor.
|
|
100
|
+
|
|
101
|
+
## Standard vs IAB Components
|
|
102
|
+
|
|
103
|
+
|Feature|ConsentBanner / ConsentDialog|IABConsentBanner / IABConsentDialog|
|
|
104
|
+
|--|--|--|
|
|
105
|
+
|Consent model|opt-in / opt-out|IAB TCF 2.3|
|
|
106
|
+
|Granularity|Category-level (measurement, marketing, etc.)|Purpose-level + vendor-level|
|
|
107
|
+
|Vendor management|No|Yes (full GVL integration)|
|
|
108
|
+
|TC String|No|Yes|
|
|
109
|
+
|`__tcfapi`|No|Yes|
|
|
110
|
+
|Legitimate interest|No|Yes|
|
|
111
|
+
|Use when|General GDPR/CCPA compliance|Programmatic advertising in EU/EEA|
|
|
112
|
+
|
|
113
|
+
## Components
|
|
114
|
+
|
|
115
|
+
|Component|Description|
|
|
116
|
+
|--|--|
|
|
117
|
+
|[IABConsentBanner](/docs/frameworks/next/iab/consent-banner)|TCF-compliant banner with partner disclosure|
|
|
118
|
+
|[IABConsentDialog](/docs/frameworks/next/iab/consent-dialog)|Tabbed preference center for purposes and vendors|
|
|
119
|
+
|[useGVLData](/docs/frameworks/next/iab/use-gvl-data)|Hook for building custom IAB UI|
|