@c15t/browser 3.0.0-alpha.1 → 3.0.0-alpha.2
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/AGENTS.md +2 -0
- package/CHANGELOG.md +10 -0
- package/dist/861.js +1 -1
- package/dist/925.js +20 -13
- package/dist/c15t.css +6 -3
- package/dist/c15t.devtools.js +1 -1
- package/dist/c15t.headless.js +1 -1
- package/dist/c15t.iab.js +4 -4
- package/dist/c15t.js +3 -3
- package/dist-types/auto-init.d.ts +1 -1
- package/dist-types/client.d.ts +1 -1
- package/dist-types/devtools.d.ts +1 -1
- package/dist-types/gated-scripts.d.ts +3 -2
- package/dist-types/global.d.ts +4 -4
- package/dist-types/headless.d.ts +11 -11
- package/dist-types/iab/mount.d.ts +1 -1
- package/dist-types/iab/preferences.d.ts +1 -1
- package/dist-types/iab/surface.d.ts +2 -2
- package/dist-types/iab/vendor-disclosures.d.ts +1 -1
- package/dist-types/iab.d.ts +7 -7
- package/dist-types/index.d.ts +12 -12
- package/dist-types/ui/banner.d.ts +2 -2
- package/dist-types/ui/dialog.d.ts +2 -2
- package/dist-types/ui/mount.d.ts +2 -2
- package/dist-types/ui/surface.d.ts +1 -1
- package/dist-types/ui/trigger.d.ts +2 -2
- package/dist-types/ui/widget.d.ts +1 -1
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +2 -0
- package/docs/frameworks/javascript/script-loader.md +40 -0
- package/docs/integrations/building-integrations.md +5 -0
- package/docs/integrations/cloudflare-zaraz.md +399 -0
- package/docs/integrations/google-maps.md +20 -20
- package/docs/integrations/granular-consent.md +208 -0
- package/docs/integrations/overview.md +5 -4
- package/docs/integrations/youtube.md +26 -21
- package/package.json +7 -7
- package/readme.json +0 -44
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Granular consent
|
|
3
|
+
description: Let visitors grant a category and still turn one vendor off,
|
|
4
|
+
without adopting IAB TCF.
|
|
5
|
+
group: integrations
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Granular consent is choice below the category level: a visitor grants
|
|
9
|
+
marketing and still turns Meta off. The unit of that choice is a vendor, so
|
|
10
|
+
the API names them `vendors`, `vendor` and `data-vendor`, and the hooks
|
|
11
|
+
`useVendorAllowed` and `useVendorDraft`. Everything else stays as it is:
|
|
12
|
+
categories, policies, and the preference center gain vendor rows rather than
|
|
13
|
+
a second consent model.
|
|
14
|
+
|
|
15
|
+
## Declare vendors
|
|
16
|
+
|
|
17
|
+
Add `vendors` to your runtime options. Each vendor sits inside a category
|
|
18
|
+
condition and needs a name and a privacy policy URL so the preference surface
|
|
19
|
+
can list it. The React provider takes the same option once its preference
|
|
20
|
+
center renders vendor rows; scripts, rules and iframes are gated the same way
|
|
21
|
+
whichever place declares it:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { hosted, type Vendor } from 'c15t';
|
|
25
|
+
import { createConsentRuntime } from 'c15t/runtime';
|
|
26
|
+
|
|
27
|
+
const vendors = [
|
|
28
|
+
{
|
|
29
|
+
id: 'meta-pixel',
|
|
30
|
+
name: 'Meta Pixel',
|
|
31
|
+
category: 'marketing',
|
|
32
|
+
privacyPolicyUrl: 'https://www.facebook.com/privacy/policy/',
|
|
33
|
+
description: 'Ad conversion measurement and audiences.',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'google-analytics',
|
|
37
|
+
name: 'Google Analytics',
|
|
38
|
+
category: 'measurement',
|
|
39
|
+
privacyPolicyUrl: 'https://policies.google.com/privacy',
|
|
40
|
+
},
|
|
41
|
+
] satisfies Vendor[];
|
|
42
|
+
|
|
43
|
+
const runtime = createConsentRuntime({
|
|
44
|
+
mode: hosted({ url: '/api/c15t' }),
|
|
45
|
+
vendors,
|
|
46
|
+
scripts: [
|
|
47
|
+
{
|
|
48
|
+
id: 'meta-pixel',
|
|
49
|
+
category: 'marketing',
|
|
50
|
+
vendor: 'meta-pixel',
|
|
51
|
+
src: 'https://connect.facebook.net/en_US/fbevents.js',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Start in the browser after mount. The endpoint must serve your c15t backend.
|
|
57
|
+
runtime.start();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The `id` is a lowercase slug of up to 64 characters. Reuse it as the `vendor`
|
|
61
|
+
field on scripts and network rules and as the `data-vendor` attribute on
|
|
62
|
+
iframes. Integrations from `@c15t/scripts` already set `vendor` to their
|
|
63
|
+
manifest slug, so `gtag()` and `metaPixel()` need no extra wiring.
|
|
64
|
+
|
|
65
|
+
A backend can also declare vendors. Add `vendors` and an optional
|
|
66
|
+
`vendorListVersion` to the manifest configuration; `/init` returns them and the
|
|
67
|
+
client merges them with the vendors declared in code. When both declare the
|
|
68
|
+
same id, the copy declared in code wins, and the backend copy comes back if the
|
|
69
|
+
code declaration is removed later. A slug used by a script, rule or iframe
|
|
70
|
+
but declared nowhere still gates loading. It is hidden from the preference surface, and the
|
|
71
|
+
runtime warns about it outside production.
|
|
72
|
+
|
|
73
|
+
## How a vendor is gated
|
|
74
|
+
|
|
75
|
+
A target loads when its category condition passes and the visitor has not
|
|
76
|
+
turned its vendor off:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
loads = category condition satisfied AND vendor not denied
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The category is evaluated first, so an unknown category still throws as a
|
|
83
|
+
configuration error. A vendor toggle never grants a category on its own: with
|
|
84
|
+
marketing denied, `meta-pixel` stays blocked whatever its own switch says.
|
|
85
|
+
A script with `alwaysLoad` still mounts, as it does for a denied category;
|
|
86
|
+
its callbacks receive the vendor result in `info.vendor.granted` so a
|
|
87
|
+
self-managing SDK can honor it.
|
|
88
|
+
|
|
89
|
+
Under an `iab` policy the `vendor` slug is inert. Vendor consent then comes from
|
|
90
|
+
the TC string through `vendorId`, and the vendor rows are not shown.
|
|
91
|
+
|
|
92
|
+
The same rule applies to the three gates:
|
|
93
|
+
|
|
94
|
+
| Surface | Field |
|
|
95
|
+
| --------------- | ------------------------------- |
|
|
96
|
+
| Script loader | `Script.vendor` |
|
|
97
|
+
| Network blocker | `NetworkBlockerRule.vendor` |
|
|
98
|
+
| Iframe blocker | `data-vendor` on the `<iframe>` |
|
|
99
|
+
|
|
100
|
+
An iframe with `data-vendor` and no `data-category` is gated on the vendor
|
|
101
|
+
alone. An unknown `data-vendor` value is granted rather than thrown: a vendor
|
|
102
|
+
the visitor never saw cannot have been turned off. Such a frame has no
|
|
103
|
+
category to follow, so a denial the visitor recorded earlier holds even while
|
|
104
|
+
nothing declares the slug, for example before the backend's vendor list has
|
|
105
|
+
arrived on a cold start.
|
|
106
|
+
|
|
107
|
+
A script, rule or frame keeps its slug declared for as long as it is
|
|
108
|
+
configured. If a backend list or a provider update drops the entry, the
|
|
109
|
+
loader or blocker puts it back, so a stored denial keeps gating it. A slug
|
|
110
|
+
several modules share stays under every category they name it with, whichever
|
|
111
|
+
module updates last, and drops a category only once no module names it there.
|
|
112
|
+
Disposing a loader or blocker, or removing a gated frame from the page, drops
|
|
113
|
+
what only it named, so a vendor no live module owns stops being toggleable.
|
|
114
|
+
|
|
115
|
+
## Record a vendor choice
|
|
116
|
+
|
|
117
|
+
Vendor grants travel with the save. Stage them and confirm with the next save,
|
|
118
|
+
or pass them next to the categories:
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
// Stage from a toggle handler; nothing changes until save({}) runs. The
|
|
122
|
+
// empty patch confirms no category, so only the staged vendor is recorded;
|
|
123
|
+
// save() with no input would reconfirm every displayed category too.
|
|
124
|
+
runtime.stageVendorConsent('meta-pixel', false);
|
|
125
|
+
await runtime.kernel.commands.save({});
|
|
126
|
+
|
|
127
|
+
// Or confirm categories and vendors in one action.
|
|
128
|
+
await runtime.kernel.commands.save({
|
|
129
|
+
marketing: true,
|
|
130
|
+
measurement: true,
|
|
131
|
+
vendors: { 'meta-pixel': false },
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
`stageVendorConsent` stages a vendor slug for the next save; it is not the
|
|
136
|
+
IAB handle's `setVendorConsent`, which sets a TCF vendor by numeric id and
|
|
137
|
+
takes effect at once. The grants can also travel in the save context as
|
|
138
|
+
`{ vendors }`, which wins when both are given.
|
|
139
|
+
|
|
140
|
+
Only the vendors the visitor turned off are stored. Accept all and reject all
|
|
141
|
+
both clear that list, so vendors follow their category on a bulk action. A bulk
|
|
142
|
+
action narrowed to the displayed categories only lifts the denials of vendors
|
|
143
|
+
those categories decide on their own; a vendor another granted category would
|
|
144
|
+
still load keeps its denial. A
|
|
145
|
+
vendor that is not declared, or is declared with `disabled: true`, is ignored.
|
|
146
|
+
Under an opt-out policy every vendor starts on and the stored list is the
|
|
147
|
+
do-not-sell list.
|
|
148
|
+
|
|
149
|
+
A vendor-only change records without touching category receipts. The kernel
|
|
150
|
+
emits `vendors:recorded` rather than `choice:recorded`, writes the
|
|
151
|
+
`<storageKey>-vendors` cookie and localStorage entry, and sends the complete
|
|
152
|
+
grant map to the backend as `vendorChoice`. Category confirmation times are not
|
|
153
|
+
renewed. The vendor entry also carries the subject id, so a visitor whose first
|
|
154
|
+
act only decided vendors keeps the same subject after a reload even though no
|
|
155
|
+
category record exists yet.
|
|
156
|
+
|
|
157
|
+
Scripts see the vendor result in their callbacks. `ScriptCallbackInfo.vendor`
|
|
158
|
+
carries `{ id, granted }` outside IAB mode. Integrations that send Google
|
|
159
|
+
Consent Mode or RudderStack signals send every category as denied while their
|
|
160
|
+
vendor is off, so the vendor's own consent API cannot re-enable tracking.
|
|
161
|
+
|
|
162
|
+
## Show vendors in the preference center
|
|
163
|
+
|
|
164
|
+
The `ConsentWidget` and `ConsentDialog` in React, Vue and Svelte list vendors
|
|
165
|
+
under their category when the provider declares them. Pass the same `vendors`
|
|
166
|
+
array to `ConsentProvider`, to the `vendors` prop of `ConsentRoot` in
|
|
167
|
+
[Next.js](https://c15t.com/docs/frameworks/next/script-loader#granular-consent) and
|
|
168
|
+
[TanStack Start](https://c15t.com/docs/frameworks/tanstack-start/quickstart#granular-consent),
|
|
169
|
+
to the Nuxt module or Vue plugin config next to `scripts`, or to
|
|
170
|
+
`ConsentManagerProvider` options in Svelte:
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
import { ConsentProvider, hosted } from 'c15t/react';
|
|
174
|
+
|
|
175
|
+
<ConsentProvider options={{ mode: hosted({ url: '/api/c15t' }), vendors }}>
|
|
176
|
+
{children}
|
|
177
|
+
</ConsentProvider>;
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Each category row expands to one card per vendor with its own switch. The
|
|
181
|
+
switches disable while the category is off in the draft, and Save records the
|
|
182
|
+
vendors the visitor moved. A custom control uses `useVendorDraft()` from
|
|
183
|
+
`c15t/react` to read and stage the same grants, with `isStale` and `reset` for
|
|
184
|
+
a draft the policy or vendor list changed under, and `useVendorAllowed(id)` to
|
|
185
|
+
read one vendor's effective result. Copy comes from
|
|
186
|
+
`consentManagerDialog.vendors.{title, privacyPolicy, disabledByCategory,
|
|
187
|
+
switchLabel}` in the translations. In Vue, `useConsentDraft()` returns the
|
|
188
|
+
same `vendors` map and `setVendor`; in Svelte, `getConsentManager()` exposes
|
|
189
|
+
`selectedVendors`, `setSelectedVendor` and `getDisplayedVendors(category)`.
|
|
190
|
+
The three frameworks render the same cards, and the parity suite compares
|
|
191
|
+
their markup, accessibility tree, computed styles and geometry.
|
|
192
|
+
|
|
193
|
+
## What a denial does not do
|
|
194
|
+
|
|
195
|
+
Turning a vendor off blocks future loads and requests. It does not delete the
|
|
196
|
+
cookies that vendor already set, and
|
|
197
|
+
[clear on revocation](./clear-on-revocation.md) does not help here:
|
|
198
|
+
it runs when a category is denied, and the category stays granted when only one
|
|
199
|
+
of its vendors is off. Remove that vendor's cookies yourself from an
|
|
200
|
+
`onConsentChange` callback that checks `info.vendor.granted`.
|
|
201
|
+
|
|
202
|
+
A vendor denial has no expiry and no policy basis. It stays until the visitor
|
|
203
|
+
changes it or a bulk action clears it, including across a policy change that
|
|
204
|
+
requires the category choice again.
|
|
205
|
+
|
|
206
|
+
Adding a vendor to the list does not reopen consent. New vendors default to on
|
|
207
|
+
inside a granted category. Use the policy rule's `copyRevision` when a new
|
|
208
|
+
vendor should prompt the visitor again.
|
|
@@ -34,15 +34,16 @@ behavior before choosing either approach.
|
|
|
34
34
|
| [Google Maps](./google-maps.md) | Framework-specific consent-gated map iframe | Iframe mounts only while the chosen permission is allowed |
|
|
35
35
|
| [YouTube](./youtube.md) | Framework-specific consent-gated video iframe | Iframe mounts only while the chosen permission is allowed |
|
|
36
36
|
|
|
37
|
-
Both guides include all nine framework examples. React and Svelte use `
|
|
37
|
+
Both guides include all nine framework examples. React and Svelte use `ConsentGate`;
|
|
38
38
|
Vue conditionally renders the iframe, and Astro and JavaScript use the existing
|
|
39
39
|
kernel to control its DOM lifecycle. Embeds do not require `@c15t/scripts`.
|
|
40
40
|
|
|
41
41
|
## Tag managers
|
|
42
42
|
|
|
43
|
-
| Integration | Helper | Category | Loading behavior
|
|
44
|
-
| --------------------------------------------- | ------------------ | ----------- |
|
|
45
|
-
| [
|
|
43
|
+
| Integration | Helper | Category | Loading behavior |
|
|
44
|
+
| --------------------------------------------- | ------------------ | ----------- | ------------------------------------------------ |
|
|
45
|
+
| [Cloudflare Zaraz](./cloudflare-zaraz.md) | `cloudflareZaraz` | `necessary` | Synchronizes purposes; Zaraz owns tool execution |
|
|
46
|
+
| [Google Tag Manager](./google-tag-manager.md) | `googleTagManager` | `necessary` | Always loads; signals Google consent |
|
|
46
47
|
|
|
47
48
|
## Analytics
|
|
48
49
|
|
|
@@ -33,12 +33,12 @@ Render this component inside your existing consent boundary or provider.
|
|
|
33
33
|
```tsx title="src/consent-embed.tsx"
|
|
34
34
|
'use client';
|
|
35
35
|
|
|
36
|
-
import {
|
|
36
|
+
import { ConsentGate } from 'c15t/next';
|
|
37
37
|
import { embedCategory, embedURL, embedTitle, embedAspectRatio } from './embed-config';
|
|
38
38
|
|
|
39
39
|
export function ConsentEmbed() {
|
|
40
40
|
return (
|
|
41
|
-
<
|
|
41
|
+
<ConsentGate category={embedCategory}>
|
|
42
42
|
<iframe
|
|
43
43
|
src={embedURL}
|
|
44
44
|
title={embedTitle}
|
|
@@ -46,12 +46,12 @@ export function ConsentEmbed() {
|
|
|
46
46
|
allowFullScreen
|
|
47
47
|
style={{ width: '100%', aspectRatio: embedAspectRatio, minHeight: 200, border: 0 }}
|
|
48
48
|
/>
|
|
49
|
-
</
|
|
49
|
+
</ConsentGate>
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
`
|
|
54
|
+
`ConsentGate` keeps the iframe absent while permission is denied and removes it
|
|
55
55
|
on revocation. Keep your existing consent styles and preferences dialog.
|
|
56
56
|
|
|
57
57
|
**TanStack Start**
|
|
@@ -59,12 +59,12 @@ on revocation. Keep your existing consent styles and preferences dialog.
|
|
|
59
59
|
Render this component inside your existing consent boundary or provider.
|
|
60
60
|
|
|
61
61
|
```tsx title="src/consent-embed.tsx"
|
|
62
|
-
import {
|
|
62
|
+
import { ConsentGate } from 'c15t/tanstack-start';
|
|
63
63
|
import { embedCategory, embedURL, embedTitle, embedAspectRatio } from './embed-config';
|
|
64
64
|
|
|
65
65
|
export function ConsentEmbed() {
|
|
66
66
|
return (
|
|
67
|
-
<
|
|
67
|
+
<ConsentGate category={embedCategory}>
|
|
68
68
|
<iframe
|
|
69
69
|
src={embedURL}
|
|
70
70
|
title={embedTitle}
|
|
@@ -72,12 +72,12 @@ export function ConsentEmbed() {
|
|
|
72
72
|
allowFullScreen
|
|
73
73
|
style={{ width: '100%', aspectRatio: embedAspectRatio, minHeight: 200, border: 0 }}
|
|
74
74
|
/>
|
|
75
|
-
</
|
|
75
|
+
</ConsentGate>
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
`
|
|
80
|
+
`ConsentGate` keeps the iframe absent while permission is denied and removes it
|
|
81
81
|
on revocation. Keep your existing consent styles and preferences dialog.
|
|
82
82
|
|
|
83
83
|
**React**
|
|
@@ -85,12 +85,12 @@ on revocation. Keep your existing consent styles and preferences dialog.
|
|
|
85
85
|
Render this component inside your existing consent boundary or provider.
|
|
86
86
|
|
|
87
87
|
```tsx title="src/consent-embed.tsx"
|
|
88
|
-
import {
|
|
88
|
+
import { ConsentGate } from 'c15t/react';
|
|
89
89
|
import { embedCategory, embedURL, embedTitle, embedAspectRatio } from './embed-config';
|
|
90
90
|
|
|
91
91
|
export function ConsentEmbed() {
|
|
92
92
|
return (
|
|
93
|
-
<
|
|
93
|
+
<ConsentGate category={embedCategory}>
|
|
94
94
|
<iframe
|
|
95
95
|
src={embedURL}
|
|
96
96
|
title={embedTitle}
|
|
@@ -98,12 +98,12 @@ export function ConsentEmbed() {
|
|
|
98
98
|
allowFullScreen
|
|
99
99
|
style={{ width: '100%', aspectRatio: embedAspectRatio, minHeight: 200, border: 0 }}
|
|
100
100
|
/>
|
|
101
|
-
</
|
|
101
|
+
</ConsentGate>
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
`
|
|
106
|
+
`ConsentGate` keeps the iframe absent while permission is denied and removes it
|
|
107
107
|
on revocation. Keep your existing consent styles and preferences dialog.
|
|
108
108
|
|
|
109
109
|
**Nuxt**
|
|
@@ -223,11 +223,11 @@ The provider from your quickstart supplies its consent state.
|
|
|
223
223
|
|
|
224
224
|
```svelte title="src/ConsentEmbed.svelte"
|
|
225
225
|
<script lang="ts">
|
|
226
|
-
import {
|
|
226
|
+
import { ConsentGate } from '@c15t/svelte';
|
|
227
227
|
import { embedCategory, embedURL, embedTitle, embedAspectRatio } from './embed-config';
|
|
228
228
|
</script>
|
|
229
229
|
|
|
230
|
-
<
|
|
230
|
+
<ConsentGate category={embedCategory}>
|
|
231
231
|
<iframe
|
|
232
232
|
src={embedURL}
|
|
233
233
|
title={embedTitle}
|
|
@@ -238,10 +238,10 @@ The provider from your quickstart supplies its consent state.
|
|
|
238
238
|
style:min-height="200px"
|
|
239
239
|
style:border="0"
|
|
240
240
|
></iframe>
|
|
241
|
-
</
|
|
241
|
+
</ConsentGate>
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
-
The Svelte `
|
|
244
|
+
The Svelte `ConsentGate` waits until the browser is mounted and the category is
|
|
245
245
|
allowed. Its default placeholder opens preferences. Revocation removes the
|
|
246
246
|
iframe.
|
|
247
247
|
|
|
@@ -252,11 +252,11 @@ Keep the SvelteKit root provider and its server prefetch unchanged.
|
|
|
252
252
|
|
|
253
253
|
```svelte title="src/lib/ConsentEmbed.svelte"
|
|
254
254
|
<script lang="ts">
|
|
255
|
-
import {
|
|
255
|
+
import { ConsentGate } from '@c15t/svelte';
|
|
256
256
|
import { embedCategory, embedURL, embedTitle, embedAspectRatio } from '../embed-config';
|
|
257
257
|
</script>
|
|
258
258
|
|
|
259
|
-
<
|
|
259
|
+
<ConsentGate category={embedCategory}>
|
|
260
260
|
<iframe
|
|
261
261
|
src={embedURL}
|
|
262
262
|
title={embedTitle}
|
|
@@ -267,10 +267,10 @@ Keep the SvelteKit root provider and its server prefetch unchanged.
|
|
|
267
267
|
style:min-height="200px"
|
|
268
268
|
style:border="0"
|
|
269
269
|
></iframe>
|
|
270
|
-
</
|
|
270
|
+
</ConsentGate>
|
|
271
271
|
```
|
|
272
272
|
|
|
273
|
-
The Svelte `
|
|
273
|
+
The Svelte `ConsentGate` waits until the browser is mounted and the category is
|
|
274
274
|
allowed. Its default placeholder opens preferences. Revocation removes the
|
|
275
275
|
iframe.
|
|
276
276
|
|
|
@@ -380,7 +380,7 @@ Set playback options in the iframe URL. For example, append `start=36` to begin
|
|
|
380
380
|
[YouTube player parameters](https://developers.google.com/youtube/player_parameters)
|
|
381
381
|
and reserve at least a 200-by-200-pixel player area.
|
|
382
382
|
|
|
383
|
-
React and Svelte `
|
|
383
|
+
React and Svelte `ConsentGate` components provide a blocked-state placeholder and
|
|
384
384
|
consent action. Their `placeholder` APIs differ: React takes a node, Svelte
|
|
385
385
|
takes a snippet. Keep a clear way to reopen preferences when customizing them.
|
|
386
386
|
The Vue and browser examples show that action explicitly. `loading="lazy"` delays an
|
|
@@ -388,6 +388,11 @@ allowed iframe for performance; it does not implement consent gating.
|
|
|
388
388
|
|
|
389
389
|
## Consent behavior
|
|
390
390
|
|
|
391
|
+
Add `data-vendor="youtube"` next to `data-category` and declare a `youtube`
|
|
392
|
+
vendor in the runtime's `vendors` option or the backend manifest to let visitors
|
|
393
|
+
turn YouTube off while keeping the rest of the category on. See
|
|
394
|
+
[granular consent](./granular-consent.md).
|
|
395
|
+
|
|
391
396
|
Each example keeps the iframe absent until the category is allowed. After
|
|
392
397
|
permission, the iframe can load. Revoking permission removes the iframe and its
|
|
393
398
|
embedded document. Requests already sent cannot be recalled.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c15t/browser",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.2",
|
|
4
4
|
"description": "Drop-in consent banner and headless consent runtime for sites without a build step: Framer, Webflow, WordPress, Squarespace, and plain HTML.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"c15t",
|
|
@@ -93,12 +93,12 @@
|
|
|
93
93
|
"test:watch": "bun prebuild && vitest"
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
96
|
-
"@c15t/core": "3.0.0-alpha.
|
|
97
|
-
"@c15t/dev-tools": "3.0.0-alpha.
|
|
98
|
-
"@c15t/iab": "3.0.0-alpha.
|
|
99
|
-
"@c15t/schema": "3.0.0-alpha.
|
|
100
|
-
"@c15t/translations": "3.0.0-alpha.
|
|
101
|
-
"@c15t/ui": "3.0.0-alpha.
|
|
96
|
+
"@c15t/core": "3.0.0-alpha.2",
|
|
97
|
+
"@c15t/dev-tools": "3.0.0-alpha.2",
|
|
98
|
+
"@c15t/iab": "3.0.0-alpha.2",
|
|
99
|
+
"@c15t/schema": "3.0.0-alpha.1",
|
|
100
|
+
"@c15t/translations": "3.0.0-alpha.2",
|
|
101
|
+
"@c15t/ui": "3.0.0-alpha.2"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@c15t/conformance": "0.0.1",
|
package/readme.json
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"title": "@c15t/browser: Script-Tag Consent Banner",
|
|
3
|
-
"description": "Cookie banner, preference centre, and consent-gated script loading for sites without a build step: Framer, Webflow, WordPress, Squarespace, and plain HTML.",
|
|
4
|
-
"features": [
|
|
5
|
-
"One script tag from a CDN, configured with data attributes or calls queued on window.c15t",
|
|
6
|
-
"Prebuilt banner and preference centre rendered in a shadow root, immune to theme CSS",
|
|
7
|
-
"Headless build with the same runtime and window.c15t API for custom banners",
|
|
8
|
-
"data-c15t-action buttons and #c15t-preferences links wired for you",
|
|
9
|
-
"Hosted, self-hosted, offline, and manifest modes; an inlined manifest renders a location-independent policy with no request at all",
|
|
10
|
-
"DevTools panel as a second tag (c15t.devtools.js) with a Location tab for trying geo-keyed policies",
|
|
11
|
-
"Consent-gated script loading and Google Consent Mode through @c15t/scripts",
|
|
12
|
-
"ES module entry points for bundler projects without a framework"
|
|
13
|
-
],
|
|
14
|
-
"prerequisites": [
|
|
15
|
-
"A page you can add a <script> tag to",
|
|
16
|
-
"A hosted [c15t instance](https://inth.com) (free sign-up), [self-hosted deployment](https://c15t.com/docs/self-host/quickstart), or offline mode for browser-only storage"
|
|
17
|
-
],
|
|
18
|
-
"manualInstallation": [
|
|
19
|
-
"",
|
|
20
|
-
"Paste before `</head>`:",
|
|
21
|
-
"",
|
|
22
|
-
"```html\n<script\n src=\"https://cdn.jsdelivr.net/npm/@c15t/browser@0.2.0/dist/c15t.js\"\n data-backend-url=\"https://your-instance.c15t.dev\"\n defer\n></script>\n```",
|
|
23
|
-
"",
|
|
24
|
-
"Drop `data-backend-url` for offline mode. Load `dist/c15t.headless.js` instead for the runtime without any UI.",
|
|
25
|
-
"",
|
|
26
|
-
"For bundler projects:",
|
|
27
|
-
"",
|
|
28
|
-
"```bash\npnpm add @c15t/browser\n```"
|
|
29
|
-
],
|
|
30
|
-
"usage": [
|
|
31
|
-
"Add the tag and reload; the banner appears on the first visit",
|
|
32
|
-
"Put `data-c15t-action=\"customize\"` on any button to open the preference centre",
|
|
33
|
-
"Read consent from `window.c15t` in your own code",
|
|
34
|
-
"For the full set of attributes and options, see the [script tag docs](https://c15t.com/docs/frameworks/javascript/script-tag)",
|
|
35
|
-
"```js\nc15t.on('consent', () => {\n if (c15t.has('measurement')) {\n startAnalytics();\n }\n});\n\nawait c15t.ready();\nc15t.openDialog();\n```"
|
|
36
|
-
],
|
|
37
|
-
"docsLink": "https://c15t.com/docs/frameworks/javascript/script-tag",
|
|
38
|
-
"quickStartLink": "https://c15t.com/docs/frameworks/javascript/script-tag",
|
|
39
|
-
"showCLIGeneration": false,
|
|
40
|
-
"customSections": {
|
|
41
|
-
"Deployment Modes": "- **Hosted on inth.com**: Hosted c15t backend for policy storage, audit history, and hosted infrastructure\n- **Self-hosted backend**: Use @c15t/backend when you need full infrastructure control\n- **Manifest mode**: Inline or fetch the backend's cacheable `/manifest` and resolve the policy in the browser\n- **Offline mode**: Browser-only consent storage for portfolios, docs sites, previews, and demos",
|
|
42
|
-
"Optional IAB entry": "Load `c15t.iab.js` instead of `c15t.js`, or import `init` from `@c15t/browser/iab`. Configure `iab` with your registered CMP ID and vendor list. This entry includes the CMP, TC codec, purpose/vendor preferences, and IAB styles. The ordinary and headless entries exclude that implementation. Use `client.saveIAB()` to confirm individual IAB choices. See the [IAB script example](https://c15t.com/docs/frameworks/javascript/script-tag#optional-iab-entry)."
|
|
43
|
-
}
|
|
44
|
-
}
|