@c15t/react 3.0.0-alpha.8 → 3.0.0
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 +10 -12
- package/README.md +41 -70
- package/SKILL.md +1 -1
- package/dist/aggregate-components.js +1 -1
- package/dist/components/consent-gate/atoms.js +1 -1
- package/dist/components/consent-gate/frame.js +2 -0
- package/dist/components/consent-gate/index.js +1 -1
- package/dist/components/iab-panel/atoms/root.js +1 -1
- package/dist/components/iab-panel/iab-panel.js +1 -1
- package/dist/components/iab-prompt/atoms/root.js +1 -1
- package/dist/components/iab-prompt/iab-prompt.js +1 -1
- package/dist/components/panel/atoms/root.js +1 -1
- package/dist/components/panel-trigger/atoms/root.js +1 -1
- package/dist/components/panel-trigger/panel-trigger.js +1 -1
- package/dist/components/panel-trigger/toolbar-loader.js +2 -0
- package/dist/components/preferences/atoms/root.js +1 -1
- package/dist/components/prompt/atoms/early-tap-script.js +2 -0
- package/dist/components/prompt/atoms/root.js +1 -1
- package/dist/components/prompt/prompt.js +1 -1
- package/dist/components/shared/dialog-sheets.js +1 -0
- package/dist/components/shared/first-paint-sheets.js +1 -0
- package/dist/components/shared/iab-dialog-sheets.js +1 -0
- package/dist/components/shared/iab-first-paint-sheets.js +1 -0
- package/dist/components/shared/primitives/button.js +1 -1
- package/dist/components/shared/surface-styles.js +2 -0
- package/dist/consent-gate.js +1 -1
- package/dist/context/index.js +1 -1
- package/dist/devtools.js +1 -1
- package/dist/hooks/use-iab-policy-guard.js +1 -0
- package/dist/iab/styles.tw3.css +2 -2
- package/dist/iab-context.js +1 -1
- package/dist/iab-dialog-deferred.js +2 -0
- package/dist/iab.js +1 -1
- package/dist/index-parts/consent-gate.js +1 -1
- package/dist/index-parts/core.js +1 -1
- package/dist/index-parts/frame.js +1 -0
- package/dist/index-parts/hosted.js +1 -0
- package/dist/index-parts/offline.js +1 -0
- package/dist/index-parts/presets.js +1 -0
- package/dist/index.js +1 -1
- package/dist/modes.js +1 -0
- package/dist/panel-link.js +1 -1
- package/dist/panel-trigger.js +1 -1
- package/dist/provider.js +1 -1
- package/dist/styles.tw3.css +2 -2
- package/dist/transports/hosted.js +1 -0
- package/dist/transports/manifest.js +1 -0
- package/dist/utils/deferred-module.js +1 -1
- package/dist/version.js +1 -1
- package/dist-types/chunk-warming.d.ts +7 -6
- package/dist-types/components/consent-gate/frame.d.ts +19 -0
- package/dist-types/components/consent-gate/index.d.ts +3 -19
- package/dist-types/components/iab-prompt/iab-prompt.d.ts +1 -1
- package/dist-types/components/panel/index.d.ts +1 -1
- package/dist-types/components/panel-trigger/toolbar-loader.d.ts +34 -0
- package/dist-types/components/preferences/index.d.ts +1 -1
- package/dist-types/components/prompt/atoms/early-tap-script.d.ts +17 -0
- package/dist-types/components/prompt/index.d.ts +1 -1
- package/dist-types/components/shared/dialog-sheets.d.ts +9 -0
- package/dist-types/components/shared/first-paint-sheets.d.ts +8 -0
- package/dist-types/components/shared/iab-dialog-sheets.d.ts +3 -0
- package/dist-types/components/shared/iab-first-paint-sheets.d.ts +3 -0
- package/dist-types/components/shared/surface-styles.d.ts +60 -0
- package/dist-types/consent-gate.d.ts +1 -1
- package/dist-types/context/index.d.ts +3 -3
- package/dist-types/context.d.ts +2 -0
- package/dist-types/gpp.d.ts +1 -1
- package/dist-types/hooks/use-iab-policy-guard.d.ts +35 -0
- package/dist-types/iab-dialog-deferred.d.ts +36 -0
- package/dist-types/iab.d.ts +3 -2
- package/dist-types/index-parts/consent-gate.d.ts +1 -1
- package/dist-types/index-parts/core.d.ts +1 -2
- package/dist-types/index-parts/frame.d.ts +7 -0
- package/dist-types/index-parts/hosted.d.ts +7 -0
- package/dist-types/index-parts/offline.d.ts +7 -0
- package/dist-types/index-parts/presets.d.ts +7 -0
- package/dist-types/index.d.ts +5 -1
- package/dist-types/modes.d.ts +26 -0
- package/dist-types/panel-link.d.ts +1 -1
- package/dist-types/panel-trigger.d.ts +1 -1
- package/dist-types/provider.d.ts +22 -4
- package/dist-types/transports/hosted.d.ts +36 -0
- package/dist-types/transports/manifest.d.ts +48 -0
- package/dist-types/ui-config-context.d.ts +4 -0
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +10 -12
- package/docs/concepts/choose-your-setup.md +45 -8
- package/docs/concepts/consent-categories.md +1 -1
- package/docs/concepts/consent-state.md +5 -2
- package/docs/concepts/data-fetching.md +100 -40
- package/docs/concepts/modes.md +281 -0
- package/docs/customization/dark-mode.md +1 -1
- package/docs/customization/motion.md +2 -2
- package/docs/customization/overview.md +3 -2
- package/docs/customization/recipes.md +4 -4
- package/docs/customization/slots.md +25 -25
- package/docs/customization/stylesheets.md +161 -50
- package/docs/customization/tailwind.md +71 -50
- package/docs/customization/tokens.md +42 -13
- package/docs/frameworks/react/components/consent-banner.md +14 -12
- package/docs/frameworks/react/components/consent-dialog.md +15 -13
- package/docs/frameworks/react/components/consent-provider.md +51 -46
- package/docs/frameworks/react/components.md +16 -13
- package/docs/frameworks/react/compose.md +3 -3
- package/docs/frameworks/react/content-security-policy.md +35 -12
- package/docs/frameworks/react/customize.md +21 -13
- package/docs/frameworks/react/hooks.md +2 -2
- package/docs/frameworks/react/iab.md +56 -6
- package/docs/frameworks/react/quickstart.md +65 -99
- package/docs/frameworks/react/rendering.md +170 -94
- package/docs/frameworks/react/scripts.md +19 -30
- package/docs/frameworks/react/troubleshooting.md +100 -32
- package/docs/frameworks/react/upgrade-v3.md +133 -79
- package/docs/frameworks/react/vendor-consent.md +19 -7
- package/docs/guides/banner-experiments.md +21 -8
- package/docs/guides/troubleshooting.md +90 -26
- package/docs/guides/verify-consent.md +23 -8
- package/docs/integrations/adobe-analytics.md +60 -64
- package/docs/integrations/ahrefs-analytics.md +58 -63
- package/docs/integrations/amplitude.md +60 -64
- package/docs/integrations/clearbit.md +59 -63
- package/docs/integrations/cloudflare-web-analytics.md +56 -60
- package/docs/integrations/cloudflare-zaraz.md +55 -57
- package/docs/integrations/crisp.md +64 -69
- package/docs/integrations/databuddy.md +62 -64
- package/docs/integrations/fathom-analytics.md +56 -60
- package/docs/integrations/front-chat.md +56 -60
- package/docs/integrations/google-maps.md +25 -13
- package/docs/integrations/google-tag-manager.md +153 -77
- package/docs/integrations/google-tag.md +134 -78
- package/docs/integrations/heap.md +56 -60
- package/docs/integrations/hightouch.md +55 -60
- package/docs/integrations/hotjar.md +60 -64
- package/docs/integrations/intercom.md +55 -60
- package/docs/integrations/klaviyo.md +65 -66
- package/docs/integrations/linkedin-insights.md +58 -63
- package/docs/integrations/logrocket.md +55 -60
- package/docs/integrations/matomo-analytics.md +58 -60
- package/docs/integrations/meta-pixel.md +56 -60
- package/docs/integrations/microsoft-clarity.md +57 -60
- package/docs/integrations/microsoft-uet.md +58 -61
- package/docs/integrations/mixpanel-analytics.md +73 -75
- package/docs/integrations/one-dollar-stats.md +53 -59
- package/docs/integrations/openai-pixel.md +58 -60
- package/docs/integrations/overview.md +59 -42
- package/docs/integrations/pinterest-tag.md +56 -60
- package/docs/integrations/pirsch.md +54 -60
- package/docs/integrations/plausible-analytics.md +55 -60
- package/docs/integrations/posthog.md +56 -60
- package/docs/integrations/promptwatch.md +57 -63
- package/docs/integrations/reddit-pixel.md +57 -60
- package/docs/integrations/rudderstack.md +65 -67
- package/docs/integrations/rybbit-analytics.md +70 -75
- package/docs/integrations/segment.md +56 -60
- package/docs/integrations/sentry.md +65 -60
- package/docs/integrations/snapchat-pixel.md +54 -60
- package/docs/integrations/tiktok-pixel.md +59 -63
- package/docs/integrations/umami-analytics.md +54 -60
- package/docs/integrations/vercel-analytics.md +53 -59
- package/docs/integrations/vercel-speed-insights.md +317 -0
- package/docs/integrations/x-pixel.md +57 -63
- package/docs/integrations/youtube.md +25 -13
- package/package.json +18 -8
- package/docs/upgrade-v3.md +0 -429
|
@@ -2,21 +2,29 @@
|
|
|
2
2
|
title: Promptwatch
|
|
3
3
|
description: Load the Promptwatch attribution client only after measurement
|
|
4
4
|
consent with the c15t promptwatch helper, and check it in DevTools.
|
|
5
|
+
seoTitle: Promptwatch cookie consent with c15t
|
|
6
|
+
seoDescription: Load the Promptwatch client only with measurement consent. Set
|
|
7
|
+
it up with the c15t promptwatch helper and check it in DevTools.
|
|
5
8
|
icon: promptwatch
|
|
6
9
|
group: integrations
|
|
7
10
|
---
|
|
8
11
|
|
|
12
|
+
The c15t `promptwatch` helper keeps the Promptwatch client script off the page
|
|
13
|
+
until `measurement` has consent. The helper sends no consent signal to
|
|
14
|
+
Promptwatch. If the visitor withdraws consent, c15t removes the script element.
|
|
15
|
+
By default, c15t also reloads the page.
|
|
16
|
+
|
|
9
17
|
## Configure Promptwatch
|
|
10
18
|
|
|
11
19
|
Copy the project ID from your Promptwatch dashboard. The helper passes it to
|
|
12
20
|
the client script as `data-project-id`.
|
|
13
21
|
|
|
14
|
-
| Package manager | Command
|
|
15
|
-
| :-------------- |
|
|
16
|
-
| npm | `npm install @c15t/integrations
|
|
17
|
-
| pnpm | `pnpm add @c15t/integrations
|
|
18
|
-
| yarn | `yarn add @c15t/integrations
|
|
19
|
-
| bun | `bun add @c15t/integrations
|
|
22
|
+
| Package manager | Command |
|
|
23
|
+
| :-------------- | :------------------------------- |
|
|
24
|
+
| npm | `npm install @c15t/integrations` |
|
|
25
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
26
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
27
|
+
| bun | `bun add @c15t/integrations` |
|
|
20
28
|
|
|
21
29
|
```ts title="src/consent-scripts.ts"
|
|
22
30
|
import { promptwatch } from '@c15t/integrations/promptwatch';
|
|
@@ -31,51 +39,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
|
31
39
|
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
32
40
|
|
|
33
41
|
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
34
|
-
quickstart already
|
|
35
|
-
Next.js guide, add the helper to that array instead of creating a
|
|
42
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
43
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
44
|
+
second file.
|
|
36
45
|
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
37
46
|
point for your framework below. These are edits to that provider, not a second
|
|
38
47
|
provider.
|
|
39
48
|
|
|
40
49
|
**Next.js**
|
|
41
50
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
import { ConsentRoot } from 'c15t/next';
|
|
46
|
-
import { scripts } from './consent-scripts';
|
|
47
|
-
```
|
|
51
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
52
|
+
`next.config.ts`:
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
```ts title="c15t.config.ts"
|
|
55
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
56
|
+
import { scripts } from './src/consent-scripts';
|
|
52
57
|
|
|
53
|
-
|
|
54
|
-
<ConsentRoot state={state} config={consentConfig} scripts={scripts}>
|
|
55
|
-
{children}
|
|
56
|
-
</ConsentRoot>
|
|
58
|
+
export default defineConsentConfig({ scripts });
|
|
57
59
|
```
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
62
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
63
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
64
|
+
read the same file. See
|
|
62
65
|
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
63
66
|
|
|
64
67
|
**TanStack Start**
|
|
65
68
|
|
|
66
69
|
Import the configuration into your root route and pass it to the existing
|
|
67
|
-
`ConsentRoot` as a top-level prop. Keep the loader
|
|
68
|
-
|
|
70
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
71
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
69
72
|
|
|
70
73
|
```tsx title="src/routes/__root.tsx"
|
|
71
74
|
import { scripts } from '../consent-scripts';
|
|
72
75
|
|
|
73
|
-
<ConsentRoot
|
|
74
|
-
state={consent}
|
|
75
|
-
backendURL={backendURL}
|
|
76
|
-
initRoute={false}
|
|
77
|
-
scripts={scripts}
|
|
78
|
-
>
|
|
76
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
79
77
|
```
|
|
80
78
|
|
|
81
79
|
Import vendor helpers in the root route module, not in a server function.
|
|
@@ -94,8 +92,8 @@ import { scripts } from './consent-scripts';
|
|
|
94
92
|
<ConsentProvider options={{ mode, scripts }}>
|
|
95
93
|
```
|
|
96
94
|
|
|
97
|
-
`mode` is the `
|
|
98
|
-
|
|
95
|
+
`mode` is the `manifest()` value from the
|
|
96
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
99
97
|
dialog and preferences link inside the provider. See
|
|
100
98
|
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
101
99
|
|
|
@@ -124,15 +122,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
|
124
122
|
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
125
123
|
|
|
126
124
|
```ts title="src/main.ts"
|
|
125
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
127
126
|
import { scripts } from './consent-scripts';
|
|
128
127
|
|
|
129
128
|
app.use(c15tVue, {
|
|
130
|
-
|
|
129
|
+
mode: manifest(),
|
|
131
130
|
scripts,
|
|
132
131
|
});
|
|
133
132
|
```
|
|
134
133
|
|
|
135
|
-
Keep your existing
|
|
134
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
136
135
|
script loader when the app mounts, after it has applied the visitor's stored
|
|
137
136
|
choice. Do not also call `createScriptLoader` from a component. See
|
|
138
137
|
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
@@ -140,12 +139,11 @@ choice. Do not also call `createScriptLoader` from a component. See
|
|
|
140
139
|
**Astro**
|
|
141
140
|
|
|
142
141
|
Add the scripts to the client entrypoint from the
|
|
143
|
-
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart),
|
|
144
|
-
integration
|
|
145
|
-
|
|
146
|
-
already exports scripts, combine the two arrays.
|
|
142
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
143
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
144
|
+
If the module already exports scripts, combine the two arrays.
|
|
147
145
|
|
|
148
|
-
```ts title="src/
|
|
146
|
+
```ts title="src/c15t.client.ts"
|
|
149
147
|
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
150
148
|
import { scripts } from './consent-scripts';
|
|
151
149
|
|
|
@@ -165,15 +163,13 @@ pass them as a top-level prop:
|
|
|
165
163
|
|
|
166
164
|
```svelte title="src/App.svelte"
|
|
167
165
|
<script lang="ts">
|
|
168
|
-
import {
|
|
166
|
+
import { ConsentProvider, manifest } from '@c15t/svelte';
|
|
169
167
|
import { scripts } from './consent-scripts';
|
|
170
|
-
|
|
171
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
172
168
|
</script>
|
|
173
169
|
|
|
174
|
-
<
|
|
170
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
175
171
|
<!-- Keep your application, consent UI and preferences link here. -->
|
|
176
|
-
</
|
|
172
|
+
</ConsentProvider>
|
|
177
173
|
```
|
|
178
174
|
|
|
179
175
|
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
@@ -181,22 +177,21 @@ The provider owns the loader and disposes it on unmount.
|
|
|
181
177
|
|
|
182
178
|
**SvelteKit**
|
|
183
179
|
|
|
184
|
-
Add the scripts to the existing root layout
|
|
185
|
-
and
|
|
180
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
181
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
186
182
|
|
|
187
183
|
```svelte title="src/routes/+layout.svelte"
|
|
188
184
|
<script lang="ts">
|
|
189
|
-
import {
|
|
185
|
+
import { ConsentRoot } from '@c15t/svelte';
|
|
190
186
|
import { scripts } from '../consent-scripts';
|
|
191
187
|
|
|
192
188
|
let { children, data } = $props();
|
|
193
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
194
189
|
</script>
|
|
195
190
|
|
|
196
|
-
<
|
|
191
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
197
192
|
{@render children()}
|
|
198
193
|
<!-- Keep your consent UI and preferences link here. -->
|
|
199
|
-
</
|
|
194
|
+
</ConsentRoot>
|
|
200
195
|
```
|
|
201
196
|
|
|
202
197
|
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
@@ -223,20 +218,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
|
|
|
223
218
|
|
|
224
219
|
**JavaScript**
|
|
225
220
|
|
|
226
|
-
Pass the scripts to `init()` from `@c15t/browser`, next to your
|
|
227
|
-
URL:
|
|
221
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
228
222
|
|
|
229
223
|
```ts
|
|
230
|
-
import { init } from '@c15t/browser';
|
|
224
|
+
import { init, manifest } from '@c15t/browser';
|
|
231
225
|
import { scripts } from './consent-scripts';
|
|
232
226
|
|
|
233
227
|
const consent = init({
|
|
234
|
-
|
|
228
|
+
mode: manifest(),
|
|
235
229
|
scripts,
|
|
236
230
|
});
|
|
237
231
|
```
|
|
238
232
|
|
|
239
|
-
Keep the
|
|
233
|
+
Keep the mode from your quickstart. With
|
|
240
234
|
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
241
235
|
A kernel you create yourself needs a loader from
|
|
242
236
|
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
@@ -244,10 +238,10 @@ A kernel you create yourself needs a loader from
|
|
|
244
238
|
|
|
245
239
|
## Options
|
|
246
240
|
|
|
247
|
-
| Option | Default | Behavior
|
|
248
|
-
| ----------- | ------------------------------------------------- |
|
|
249
|
-
| `projectId` | Required | Project ID from the Promptwatch dashboard. Empty or whitespace-only values
|
|
250
|
-
| `scriptUrl` | `https://ingest.promptwatch.com/js/client.min.js` | Loader URL override. Blank values fall back to the default.
|
|
241
|
+
| Option | Default | Behavior |
|
|
242
|
+
| ----------- | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
243
|
+
| `projectId` | Required | Project ID from the Promptwatch dashboard. Empty or whitespace-only values log an error and the script does not load. |
|
|
244
|
+
| `scriptUrl` | `https://ingest.promptwatch.com/js/client.min.js` | Loader URL override. Blank values fall back to the default. |
|
|
251
245
|
|
|
252
246
|
## Loading and revocation
|
|
253
247
|
|
|
@@ -284,8 +278,8 @@ permission before each of your own event calls. The reload does not delete
|
|
|
284
278
|
cookies the vendor already set; see
|
|
285
279
|
[clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
|
|
286
280
|
|
|
287
|
-
The helper
|
|
288
|
-
|
|
281
|
+
The helper lists its vendor by name in the preference dialog, so a visitor can
|
|
282
|
+
turn it off inside an allowed category. See
|
|
289
283
|
[vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
|
|
290
284
|
[consent verification guide](../guides/verify-consent.md) covers navigation,
|
|
291
285
|
expiry and hosting checks.
|
|
@@ -2,20 +2,31 @@
|
|
|
2
2
|
title: Reddit Pixel
|
|
3
3
|
description: Load the Reddit Pixel only after marketing consent with the c15t
|
|
4
4
|
redditPixel helper, guard rdt conversion calls, and check it in DevTools.
|
|
5
|
+
seoTitle: Reddit Pixel cookie consent with c15t
|
|
6
|
+
seoDescription: Load the Reddit Pixel only with marketing consent. The c15t
|
|
7
|
+
redditPixel helper turns off first-party cookies when a visitor withdraws
|
|
8
|
+
consent.
|
|
5
9
|
icon: reddit
|
|
6
10
|
group: integrations
|
|
7
11
|
---
|
|
8
12
|
|
|
13
|
+
The c15t `redditPixel` helper keeps the Reddit Pixel off the page until
|
|
14
|
+
`marketing` has consent. Until then, c15t does not define `rdt`. The helper
|
|
15
|
+
sends no consent signal to Reddit. If the visitor withdraws consent, the helper
|
|
16
|
+
calls `rdt('disableFirstPartyCookies')`. The pixel stays on the page. By
|
|
17
|
+
default, c15t also reloads the page. If `marketing` has consent again, the
|
|
18
|
+
helper calls `rdt('enableFirstPartyCookies')`.
|
|
19
|
+
|
|
9
20
|
## Configure the Reddit Pixel
|
|
10
21
|
|
|
11
22
|
Copy your Reddit Pixel ID. The helper passes it to `rdt('init', ...)`.
|
|
12
23
|
|
|
13
|
-
| Package manager | Command
|
|
14
|
-
| :-------------- |
|
|
15
|
-
| npm | `npm install @c15t/integrations
|
|
16
|
-
| pnpm | `pnpm add @c15t/integrations
|
|
17
|
-
| yarn | `yarn add @c15t/integrations
|
|
18
|
-
| bun | `bun add @c15t/integrations
|
|
24
|
+
| Package manager | Command |
|
|
25
|
+
| :-------------- | :------------------------------- |
|
|
26
|
+
| npm | `npm install @c15t/integrations` |
|
|
27
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
28
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
29
|
+
| bun | `bun add @c15t/integrations` |
|
|
19
30
|
|
|
20
31
|
```ts title="src/consent-scripts.ts"
|
|
21
32
|
import { redditPixel } from '@c15t/integrations/reddit-pixel';
|
|
@@ -30,51 +41,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
|
30
41
|
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
31
42
|
|
|
32
43
|
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
33
|
-
quickstart already
|
|
34
|
-
Next.js guide, add the helper to that array instead of creating a
|
|
44
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
45
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
46
|
+
second file.
|
|
35
47
|
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
36
48
|
point for your framework below. These are edits to that provider, not a second
|
|
37
49
|
provider.
|
|
38
50
|
|
|
39
51
|
**Next.js**
|
|
40
52
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
import { ConsentRoot } from 'c15t/next';
|
|
45
|
-
import { scripts } from './consent-scripts';
|
|
46
|
-
```
|
|
53
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
54
|
+
`next.config.ts`:
|
|
47
55
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
```ts title="c15t.config.ts"
|
|
57
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
58
|
+
import { scripts } from './src/consent-scripts';
|
|
51
59
|
|
|
52
|
-
|
|
53
|
-
<ConsentRoot state={state} config={consentConfig} scripts={scripts}>
|
|
54
|
-
{children}
|
|
55
|
-
</ConsentRoot>
|
|
60
|
+
export default defineConsentConfig({ scripts });
|
|
56
61
|
```
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
64
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
65
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
66
|
+
read the same file. See
|
|
61
67
|
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
62
68
|
|
|
63
69
|
**TanStack Start**
|
|
64
70
|
|
|
65
71
|
Import the configuration into your root route and pass it to the existing
|
|
66
|
-
`ConsentRoot` as a top-level prop. Keep the loader
|
|
67
|
-
|
|
72
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
73
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
68
74
|
|
|
69
75
|
```tsx title="src/routes/__root.tsx"
|
|
70
76
|
import { scripts } from '../consent-scripts';
|
|
71
77
|
|
|
72
|
-
<ConsentRoot
|
|
73
|
-
state={consent}
|
|
74
|
-
backendURL={backendURL}
|
|
75
|
-
initRoute={false}
|
|
76
|
-
scripts={scripts}
|
|
77
|
-
>
|
|
78
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
78
79
|
```
|
|
79
80
|
|
|
80
81
|
Import vendor helpers in the root route module, not in a server function.
|
|
@@ -93,8 +94,8 @@ import { scripts } from './consent-scripts';
|
|
|
93
94
|
<ConsentProvider options={{ mode, scripts }}>
|
|
94
95
|
```
|
|
95
96
|
|
|
96
|
-
`mode` is the `
|
|
97
|
-
|
|
97
|
+
`mode` is the `manifest()` value from the
|
|
98
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
98
99
|
dialog and preferences link inside the provider. See
|
|
99
100
|
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
100
101
|
|
|
@@ -123,15 +124,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
|
123
124
|
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
124
125
|
|
|
125
126
|
```ts title="src/main.ts"
|
|
127
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
126
128
|
import { scripts } from './consent-scripts';
|
|
127
129
|
|
|
128
130
|
app.use(c15tVue, {
|
|
129
|
-
|
|
131
|
+
mode: manifest(),
|
|
130
132
|
scripts,
|
|
131
133
|
});
|
|
132
134
|
```
|
|
133
135
|
|
|
134
|
-
Keep your existing
|
|
136
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
135
137
|
script loader when the app mounts, after it has applied the visitor's stored
|
|
136
138
|
choice. Do not also call `createScriptLoader` from a component. See
|
|
137
139
|
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
@@ -139,12 +141,11 @@ choice. Do not also call `createScriptLoader` from a component. See
|
|
|
139
141
|
**Astro**
|
|
140
142
|
|
|
141
143
|
Add the scripts to the client entrypoint from the
|
|
142
|
-
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart),
|
|
143
|
-
integration
|
|
144
|
-
|
|
145
|
-
already exports scripts, combine the two arrays.
|
|
144
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
145
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
146
|
+
If the module already exports scripts, combine the two arrays.
|
|
146
147
|
|
|
147
|
-
```ts title="src/
|
|
148
|
+
```ts title="src/c15t.client.ts"
|
|
148
149
|
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
149
150
|
import { scripts } from './consent-scripts';
|
|
150
151
|
|
|
@@ -164,15 +165,13 @@ pass them as a top-level prop:
|
|
|
164
165
|
|
|
165
166
|
```svelte title="src/App.svelte"
|
|
166
167
|
<script lang="ts">
|
|
167
|
-
import {
|
|
168
|
+
import { ConsentProvider, manifest } from '@c15t/svelte';
|
|
168
169
|
import { scripts } from './consent-scripts';
|
|
169
|
-
|
|
170
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
171
170
|
</script>
|
|
172
171
|
|
|
173
|
-
<
|
|
172
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
174
173
|
<!-- Keep your application, consent UI and preferences link here. -->
|
|
175
|
-
</
|
|
174
|
+
</ConsentProvider>
|
|
176
175
|
```
|
|
177
176
|
|
|
178
177
|
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
@@ -180,22 +179,21 @@ The provider owns the loader and disposes it on unmount.
|
|
|
180
179
|
|
|
181
180
|
**SvelteKit**
|
|
182
181
|
|
|
183
|
-
Add the scripts to the existing root layout
|
|
184
|
-
and
|
|
182
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
183
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
185
184
|
|
|
186
185
|
```svelte title="src/routes/+layout.svelte"
|
|
187
186
|
<script lang="ts">
|
|
188
|
-
import {
|
|
187
|
+
import { ConsentRoot } from '@c15t/svelte';
|
|
189
188
|
import { scripts } from '../consent-scripts';
|
|
190
189
|
|
|
191
190
|
let { children, data } = $props();
|
|
192
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
193
191
|
</script>
|
|
194
192
|
|
|
195
|
-
<
|
|
193
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
196
194
|
{@render children()}
|
|
197
195
|
<!-- Keep your consent UI and preferences link here. -->
|
|
198
|
-
</
|
|
196
|
+
</ConsentRoot>
|
|
199
197
|
```
|
|
200
198
|
|
|
201
199
|
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
@@ -222,20 +220,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
|
|
|
222
220
|
|
|
223
221
|
**JavaScript**
|
|
224
222
|
|
|
225
|
-
Pass the scripts to `init()` from `@c15t/browser`, next to your
|
|
226
|
-
URL:
|
|
223
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
227
224
|
|
|
228
225
|
```ts
|
|
229
|
-
import { init } from '@c15t/browser';
|
|
226
|
+
import { init, manifest } from '@c15t/browser';
|
|
230
227
|
import { scripts } from './consent-scripts';
|
|
231
228
|
|
|
232
229
|
const consent = init({
|
|
233
|
-
|
|
230
|
+
mode: manifest(),
|
|
234
231
|
scripts,
|
|
235
232
|
});
|
|
236
233
|
```
|
|
237
234
|
|
|
238
|
-
Keep the
|
|
235
|
+
Keep the mode from your quickstart. With
|
|
239
236
|
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
240
237
|
A kernel you create yourself needs a loader from
|
|
241
238
|
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
@@ -245,7 +242,7 @@ A kernel you create yourself needs a loader from
|
|
|
245
242
|
|
|
246
243
|
| Option | Default | Behavior |
|
|
247
244
|
| -------------------------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
248
|
-
| `pixelId` | Required | Pixel ID passed to `rdt('init', ...)`. The helper trims it. Empty or whitespace-only values
|
|
245
|
+
| `pixelId` | Required | Pixel ID passed to `rdt('init', ...)`. The helper trims it. Empty or whitespace-only values log an error and the script does not load. |
|
|
249
246
|
| `trackPageVisit` | `true` | Queues `rdt('track', 'PageVisit')` after `init`. Set `false` to send page visits yourself. |
|
|
250
247
|
| `initOptions` | None | Object passed as the third argument to `rdt('init', ...)`. It accepts Reddit's matching fields, such as `email` and `externalId`, `aam` for automatic advanced matching, `optOut`, and the Limited Data Use fields `dpm`, `dpcc` and `dprc`. |
|
|
251
248
|
| `disableFirstPartyCookies` | None | When set, overrides `initOptions.disableFirstPartyCookies`. |
|
|
@@ -315,8 +312,8 @@ permission before each of your own event calls. The reload does not delete
|
|
|
315
312
|
cookies the vendor already set; see
|
|
316
313
|
[clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
|
|
317
314
|
|
|
318
|
-
The helper
|
|
319
|
-
|
|
315
|
+
The helper lists its vendor by name in the preference dialog, so a visitor can
|
|
316
|
+
turn it off inside an allowed category. See
|
|
320
317
|
[vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
|
|
321
318
|
[consent verification guide](../guides/verify-consent.md) covers navigation,
|
|
322
319
|
expiry and hosting checks.
|