@c15t/react 3.2.0-canary.0 → 3.2.1
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 +33 -10
- package/README.md +5 -7
- package/dist/styles.tw3.css +2 -2
- package/dist/version.js +1 -1
- package/dist-types/version.d.ts +1 -1
- package/docs/README.md +33 -10
- package/docs/concepts/choose-your-setup.md +8 -9
- package/docs/concepts/modes.md +5 -3
- package/docs/customization/stylesheets.md +39 -0
- package/docs/frameworks/react/hooks.md +2 -1
- package/docs/frameworks/react/quickstart.md +3 -3
- package/docs/frameworks/react/upgrade-v3.md +2 -2
- package/docs/integrations/activecampaign.md +297 -0
- package/docs/integrations/ada.md +396 -0
- package/docs/integrations/adobe-target.md +460 -0
- package/docs/integrations/adroll.md +336 -0
- package/docs/integrations/amazon-ads.md +424 -0
- package/docs/integrations/appcues.md +368 -0
- package/docs/integrations/attentive.md +313 -0
- package/docs/integrations/building-integrations.md +29 -16
- package/docs/integrations/clearbit.md +1 -1
- package/docs/integrations/customer-io.md +369 -0
- package/docs/integrations/databuddy.md +139 -50
- package/docs/integrations/default-com.md +497 -0
- package/docs/integrations/dynamic-yield.md +373 -0
- package/docs/integrations/fullstory.md +298 -0
- package/docs/integrations/gainsight-px.md +418 -0
- package/docs/integrations/gorgias.md +365 -0
- package/docs/integrations/hubspot.md +529 -0
- package/docs/integrations/insider.md +550 -0
- package/docs/integrations/liveintent.md +327 -0
- package/docs/integrations/lucky-orange.md +336 -0
- package/docs/integrations/marketo.md +309 -0
- package/docs/integrations/optimizely.md +411 -0
- package/docs/integrations/oracle-eloqua.md +301 -0
- package/docs/integrations/overview.md +124 -111
- package/docs/integrations/pendo.md +339 -0
- package/docs/integrations/rb2b.md +363 -0
- package/docs/integrations/salesforce-pardot.md +342 -0
- package/docs/integrations/statable-analytics.md +345 -0
- package/docs/integrations/the-trade-desk.md +328 -0
- package/docs/integrations/vector.md +333 -0
- package/docs/integrations/wisepops.md +416 -0
- package/docs/integrations/zendesk.md +359 -0
- package/package.json +8 -8
- package/docs/integrations/other-ads-and-pixels.md +0 -94
- package/docs/integrations/other-analytics.md +0 -108
- package/docs/integrations/other-chat-and-support.md +0 -112
- package/docs/integrations/other-email-and-sms.md +0 -156
- package/docs/integrations/other-experience.md +0 -222
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Salesforce Account Engagement
|
|
3
|
+
description: Gate Salesforce Account Engagement tracking on marketing consent,
|
|
4
|
+
configure its consent API or classic Pardot snippet, and verify revocation
|
|
5
|
+
with c15t.
|
|
6
|
+
seoTitle: Salesforce Pardot cookie consent with c15t
|
|
7
|
+
seoDescription: Load Account Engagement only after marketing consent. Configure
|
|
8
|
+
Pardot tracking, revoke consent and verify vendor requests with c15t.
|
|
9
|
+
icon: chart-line
|
|
10
|
+
group: integrations
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
Account Engagement, formerly Pardot, tracks visitors and prospects for
|
|
14
|
+
Salesforce B2B marketing. The c15t `pardotTracking` helper waits for
|
|
15
|
+
`marketing` consent before it creates Pardot globals or downloads the tracker.
|
|
16
|
+
The default mode uses Account Engagement's Tracking and Consent API. The
|
|
17
|
+
helper also supports the classic `pd.js` snippet.
|
|
18
|
+
|
|
19
|
+
When the visitor withdraws, consent mode calls `pdt('revokeConsent')`. Classic
|
|
20
|
+
mode has no revoke call. In both modes, c15t reloads the page, and the reload
|
|
21
|
+
stops the running tracker.
|
|
22
|
+
|
|
23
|
+
## Configure Salesforce Account Engagement
|
|
24
|
+
|
|
25
|
+
Turn on the Tracking and Consent API in Account Engagement before you use
|
|
26
|
+
consent mode, and use its verified tracker domain. Copy `piAId` and `piCId`
|
|
27
|
+
from the generated tracking snippet as they are. They already include
|
|
28
|
+
Salesforce's +1000 offset, and the helper doesn't add it again. Then remove
|
|
29
|
+
the original tracking snippet.
|
|
30
|
+
|
|
31
|
+
| Package manager | Command |
|
|
32
|
+
| :-------------- | :------------------------------- |
|
|
33
|
+
| npm | `npm install @c15t/integrations` |
|
|
34
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
35
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
36
|
+
| bun | `bun add @c15t/integrations` |
|
|
37
|
+
|
|
38
|
+
```ts title="src/consent-scripts.ts"
|
|
39
|
+
import { pardotTracking } from '@c15t/integrations/salesforce-pardot';
|
|
40
|
+
|
|
41
|
+
export const scripts = [
|
|
42
|
+
pardotTracking({
|
|
43
|
+
piAId: '123456',
|
|
44
|
+
piCId: '654321',
|
|
45
|
+
piDomain: 'pi.pardot.com',
|
|
46
|
+
}),
|
|
47
|
+
];
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Replace `pi.pardot.com` in the example with your verified tracker domain.
|
|
51
|
+
|
|
52
|
+
## Register the scripts
|
|
53
|
+
|
|
54
|
+
Complete your [framework quickstart](https://c15t.com/docs/frameworks) first. Keep its Inth
|
|
55
|
+
endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
56
|
+
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
57
|
+
|
|
58
|
+
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
59
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
60
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
61
|
+
second file.
|
|
62
|
+
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
63
|
+
point for your framework below. These are edits to that provider, not a second
|
|
64
|
+
provider.
|
|
65
|
+
|
|
66
|
+
**Next.js**
|
|
67
|
+
|
|
68
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
69
|
+
`next.config.ts`:
|
|
70
|
+
|
|
71
|
+
```ts title="c15t.config.ts"
|
|
72
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
73
|
+
import { scripts } from './src/consent-scripts';
|
|
74
|
+
|
|
75
|
+
export default defineConsentConfig({ scripts });
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
79
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
80
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
81
|
+
read the same file. See
|
|
82
|
+
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
83
|
+
|
|
84
|
+
**TanStack Start**
|
|
85
|
+
|
|
86
|
+
Import the configuration into your root route and pass it to the existing
|
|
87
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
88
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
89
|
+
|
|
90
|
+
```tsx title="src/routes/__root.tsx"
|
|
91
|
+
import { scripts } from '../consent-scripts';
|
|
92
|
+
|
|
93
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Import vendor helpers in the root route module, not in a server function.
|
|
97
|
+
A server function's return value must be serializable, and script
|
|
98
|
+
configurations carry callbacks. See
|
|
99
|
+
[TanStack Start scripts](https://c15t.com/docs/frameworks/tanstack-start/scripts).
|
|
100
|
+
|
|
101
|
+
**React**
|
|
102
|
+
|
|
103
|
+
Add the configuration to the existing `ConsentProvider` options, next to
|
|
104
|
+
`mode`:
|
|
105
|
+
|
|
106
|
+
```tsx title="src/consent.tsx"
|
|
107
|
+
import { scripts } from './consent-scripts';
|
|
108
|
+
|
|
109
|
+
<ConsentProvider options={{ mode, scripts }}>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`mode` is the `manifest()` value from the
|
|
113
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
114
|
+
dialog and preferences link inside the provider. See
|
|
115
|
+
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
116
|
+
|
|
117
|
+
**Nuxt**
|
|
118
|
+
|
|
119
|
+
Register the scripts under the `c15t` key in `app/app.config.ts`. Adjust the
|
|
120
|
+
relative import to where you created `consent-scripts.ts`:
|
|
121
|
+
|
|
122
|
+
```ts title="app/app.config.ts"
|
|
123
|
+
import { scripts } from '../src/consent-scripts';
|
|
124
|
+
|
|
125
|
+
export default defineAppConfig({
|
|
126
|
+
c15t: { scripts },
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The Nuxt module merges this over its options in `nuxt.config.ts` and starts
|
|
131
|
+
one script loader in the browser after hydration, once it has applied the
|
|
132
|
+
visitor's stored choice and privacy signals. Keep `scripts` out of
|
|
133
|
+
`nuxt.config.ts`, which reaches the browser as JSON and drops the vendor
|
|
134
|
+
callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
135
|
+
[Nuxt scripts and embeds](https://c15t.com/docs/frameworks/nuxt/scripts).
|
|
136
|
+
|
|
137
|
+
**Vue**
|
|
138
|
+
|
|
139
|
+
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
140
|
+
|
|
141
|
+
```ts title="src/main.ts"
|
|
142
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
143
|
+
import { scripts } from './consent-scripts';
|
|
144
|
+
|
|
145
|
+
app.use(c15tVue, {
|
|
146
|
+
mode: manifest(),
|
|
147
|
+
scripts,
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
152
|
+
script loader when the app mounts, after it has applied the visitor's stored
|
|
153
|
+
choice. Do not also call `createScriptLoader` from a component. See
|
|
154
|
+
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
155
|
+
|
|
156
|
+
**Astro**
|
|
157
|
+
|
|
158
|
+
Add the scripts to the client entrypoint from the
|
|
159
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
160
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
161
|
+
If the module already exports scripts, combine the two arrays.
|
|
162
|
+
|
|
163
|
+
```ts title="src/c15t.client.ts"
|
|
164
|
+
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
165
|
+
import { scripts } from './consent-scripts';
|
|
166
|
+
|
|
167
|
+
export default { scripts } satisfies C15tClientOptionsExtension;
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Vendor helpers contain callbacks, and the integration options in
|
|
171
|
+
`astro.config.mjs` are serialized into the page, so do not put helpers in
|
|
172
|
+
the integration's `scripts` option. The integration passes the client
|
|
173
|
+
entrypoint to the one runtime every page shares, including across
|
|
174
|
+
`ClientRouter` navigation.
|
|
175
|
+
|
|
176
|
+
**Svelte**
|
|
177
|
+
|
|
178
|
+
Import the scripts in the component that owns your existing provider and
|
|
179
|
+
pass them as a top-level prop:
|
|
180
|
+
|
|
181
|
+
```svelte title="src/App.svelte"
|
|
182
|
+
<script lang="ts">
|
|
183
|
+
import { ConsentProvider, manifest } from 'c15t/svelte';
|
|
184
|
+
import { scripts } from './consent-scripts';
|
|
185
|
+
</script>
|
|
186
|
+
|
|
187
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
188
|
+
<!-- Keep your application, consent UI and preferences link here. -->
|
|
189
|
+
</ConsentProvider>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
193
|
+
The provider owns the loader and disposes it on unmount.
|
|
194
|
+
|
|
195
|
+
**SvelteKit**
|
|
196
|
+
|
|
197
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
198
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
199
|
+
|
|
200
|
+
```svelte title="src/routes/+layout.svelte"
|
|
201
|
+
<script lang="ts">
|
|
202
|
+
import { ConsentRoot } from 'c15t/svelte';
|
|
203
|
+
import { scripts } from '../consent-scripts';
|
|
204
|
+
|
|
205
|
+
let { children, data } = $props();
|
|
206
|
+
</script>
|
|
207
|
+
|
|
208
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
209
|
+
{@render children()}
|
|
210
|
+
<!-- Keep your consent UI and preferences link here. -->
|
|
211
|
+
</ConsentRoot>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
215
|
+
a server load cannot send functions to the browser. Prerendered, static and
|
|
216
|
+
SPA-mode pages use the same `scripts` prop. If you pass an externally owned
|
|
217
|
+
`runtime` to the provider, register scripts when creating that runtime instead.
|
|
218
|
+
|
|
219
|
+
**HTML**
|
|
220
|
+
|
|
221
|
+
The helpers in `@c15t/integrations` are ES modules that need a bundler. On a
|
|
222
|
+
page that loads the c15t script tag, paste the vendor's own snippet instead
|
|
223
|
+
and keep it inert until its category is allowed:
|
|
224
|
+
|
|
225
|
+
```html
|
|
226
|
+
<script type="text/plain" data-c15t-category="measurement">
|
|
227
|
+
// The vendor's snippet, unchanged
|
|
228
|
+
</script>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Use the category this guide names for the vendor. c15t runs the snippet
|
|
232
|
+
once that category is allowed, and reloads the page when the visitor
|
|
233
|
+
withdraws it. Helper options on this page, such as `loadMode`, do not apply
|
|
234
|
+
to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/scripts).
|
|
235
|
+
|
|
236
|
+
**JavaScript**
|
|
237
|
+
|
|
238
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
import { init, manifest } from '@c15t/browser';
|
|
242
|
+
import { scripts } from './consent-scripts';
|
|
243
|
+
|
|
244
|
+
const consent = init({
|
|
245
|
+
mode: manifest(),
|
|
246
|
+
scripts,
|
|
247
|
+
});
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Keep the mode from your quickstart. With
|
|
251
|
+
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
252
|
+
A kernel you create yourself needs a loader from
|
|
253
|
+
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
254
|
+
[JavaScript scripts](https://c15t.com/docs/frameworks/javascript/scripts).
|
|
255
|
+
|
|
256
|
+
## Options
|
|
257
|
+
|
|
258
|
+
| Option | Default | Behavior |
|
|
259
|
+
| ------------ | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
260
|
+
| `piAId` | Required | Account ID from the tracking snippet, as a string or number. Must be a positive integer. |
|
|
261
|
+
| `piCId` | Required | Campaign ID from the tracking snippet, as a string or number. Must be a positive integer. |
|
|
262
|
+
| `piDomain` | Required in consent mode | Verified tracker hostname, without a scheme or path. |
|
|
263
|
+
| `mode` | `consent` | `consent` uses the Tracking and Consent API. `classic` loads the older `pd.js` snippet, which has no revoke call. |
|
|
264
|
+
| `piHostname` | `pi.pardot.com` | Tracker hostname in classic mode, set as `window.piHostname`. |
|
|
265
|
+
| `category` | `marketing` | Consent condition for the whole loader. |
|
|
266
|
+
| `scriptUrl` | `https://<piDomain>/pdt.js?aid=<piAId>` | Loader override. Classic mode defaults to `https://pi.pardot.com/pd.js`. Blank overrides use the default. |
|
|
267
|
+
|
|
268
|
+
The helper logs an error and never loads the tracker when a required value is
|
|
269
|
+
missing or blank, when an ID isn't a safe positive integer, when a tracker
|
|
270
|
+
domain isn't a hostname, or when `mode` isn't `consent` or `classic`.
|
|
271
|
+
|
|
272
|
+
## Loading and revocation
|
|
273
|
+
|
|
274
|
+
Consent mode starts after hydration, even when the visitor allowed marketing
|
|
275
|
+
on an earlier visit. It waits for the client loader to confirm the SDK is
|
|
276
|
+
ready before it turns tracking on. Classic mode can start from the
|
|
277
|
+
server-rendered HTML.
|
|
278
|
+
|
|
279
|
+
After consent, the helper creates the `pdt.cq` queue and configures the
|
|
280
|
+
tracker with numeric IDs. It hides Salesforce's own consent banner without
|
|
281
|
+
changing consent, and starts with `setOptIn(false)`. After the SDK loads, it
|
|
282
|
+
calls `setOptIn(true)` and sends one page view. Changes to other categories
|
|
283
|
+
don't send another view. A detached in-flight load can't turn tracking on.
|
|
284
|
+
|
|
285
|
+
On withdrawal, the helper calls `pdt('revokeConsent')`. It doesn't call
|
|
286
|
+
`clearTrackingCookies`, because that also deletes the cookie that records the
|
|
287
|
+
refusal, so later page views could be tracked. On a new grant, the helper
|
|
288
|
+
reuses the tracker configuration and sends a new page view through the loaded
|
|
289
|
+
SDK. The consent-mode loader stays in the DOM, because downloading `pdt.js`
|
|
290
|
+
again replaces its configured dispatcher. If you call `pardotTracking` again
|
|
291
|
+
with the same options, the helper keeps the tracker configuration across the
|
|
292
|
+
new grant. Classic mode can't stop its running SDK through this helper.
|
|
293
|
+
|
|
294
|
+
Keep `reloadOnConsentRevoked` enabled in both modes. Clearing consent makes
|
|
295
|
+
vendor requests, and late in-flight responses can restore cookies. Removing a
|
|
296
|
+
script doesn't stop pending requests. The next page doesn't load Pardot while
|
|
297
|
+
its consent is denied.
|
|
298
|
+
|
|
299
|
+
## Cookies and storage
|
|
300
|
+
|
|
301
|
+
Pardot can set `visitor_id<id>`, `visitor_id<id>-hash`, `pi_opt_in<id>`,
|
|
302
|
+
`lpv<id>` and `pardot` cookies. A cookie suffix can be the account ID minus
|
|
303
|
+
1000\. The reload doesn't erase vendor cookies.
|
|
304
|
+
|
|
305
|
+
## Verify Salesforce Account Engagement
|
|
306
|
+
|
|
307
|
+
Before consent, check that there is no `pdt.js` or `pd.js` request, no `pdt` or
|
|
308
|
+
`piAId` global, and no vendor cookies or browser storage. Allow an unrelated
|
|
309
|
+
category and check again. Allow marketing to load the consent dispatcher, then
|
|
310
|
+
withdraw it. Confirm that the refusal cookie stays until your own cleanup or
|
|
311
|
+
its expiry. Allow marketing again and check for one new page view with your
|
|
312
|
+
own account.
|
|
313
|
+
|
|
314
|
+
Sources: Salesforce's [setup guide](https://developer.salesforce.com/docs/marketing/pardot/guide/tracking-and-consent-getting-started.html),
|
|
315
|
+
[consent functions](https://developer.salesforce.com/docs/marketing/pardot/guide/tracking-and-consent-functions.html)
|
|
316
|
+
and [classic snippet](https://help.salesforce.com/s/articleView?id=000381476\&language=en_US\&type=1).
|
|
317
|
+
|
|
318
|
+
Test in a private window with an opt-in policy. Open DevTools Network, disable
|
|
319
|
+
the cache and filter by the vendor's domain:
|
|
320
|
+
|
|
321
|
+
1. Load the page. No request goes to the vendor before you choose.
|
|
322
|
+
2. Click Reject, then reload. There is still no vendor request.
|
|
323
|
+
3. Open Privacy settings and allow the helper's category. The vendor script
|
|
324
|
+
loads without a page reload.
|
|
325
|
+
4. Turn the category off again and save. c15t reloads the page, and the new
|
|
326
|
+
page makes no vendor request.
|
|
327
|
+
|
|
328
|
+
c15t reloads on revocation because removing a script element does not stop
|
|
329
|
+
code that already ran. The vendor's listeners, timers and queued events stay
|
|
330
|
+
alive until the page unloads. If you set `reloadOnConsentRevoked: false`, stop
|
|
331
|
+
the vendor yourself. Register a callback-only script whose `onConsentChange`
|
|
332
|
+
calls the vendor's opt-out API, as shown in
|
|
333
|
+
[custom integrations](./building-integrations.md), and check the
|
|
334
|
+
permission before each of your own event calls. The reload does not delete
|
|
335
|
+
cookies the vendor already set; see
|
|
336
|
+
[clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
|
|
337
|
+
|
|
338
|
+
The helper lists its vendor by name in the preference dialog, so a visitor can
|
|
339
|
+
turn it off inside an allowed category. See
|
|
340
|
+
[vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
|
|
341
|
+
[consent verification guide](../guides/verify-consent.md) covers navigation,
|
|
342
|
+
expiry and hosting checks.
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Statable
|
|
3
|
+
description: Load Statable analytics after measurement consent with the c15t
|
|
4
|
+
statableAnalytics helper, configure its ingestion endpoint, and verify
|
|
5
|
+
requests and browser storage.
|
|
6
|
+
seoTitle: Statable cookie consent with c15t
|
|
7
|
+
seoDescription: Keep the Statable tracker off your page until measurement
|
|
8
|
+
consent. Configure the site ID, check browser storage, and stop tracking on
|
|
9
|
+
consent withdrawal.
|
|
10
|
+
icon: chart-line
|
|
11
|
+
group: integrations
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
Statable describes its web analytics as cookieless. The c15t
|
|
15
|
+
`statableAnalytics` helper still waits until the `measurement` category is
|
|
16
|
+
allowed before it loads Statable's tracker, so no request reaches Statable
|
|
17
|
+
before then.
|
|
18
|
+
|
|
19
|
+
Statable has no stop API. When the visitor withdraws, c15t reloads the page by
|
|
20
|
+
default, and the reload stops the running tracker.
|
|
21
|
+
|
|
22
|
+
## Configure Statable
|
|
23
|
+
|
|
24
|
+
Copy the numeric site ID from **Site settings > Tracking Code** in Statable,
|
|
25
|
+
and replace `12345` in the example with it. This helper uses the standalone
|
|
26
|
+
`/js/<siteId>/s.js` tracker, which Statable offers on paid plans. The Hobby
|
|
27
|
+
plan bundles tracking inside a widget with a different loader, which this
|
|
28
|
+
helper doesn't support.
|
|
29
|
+
|
|
30
|
+
Delete any existing Statable script tag or tag manager copy, so it can't load
|
|
31
|
+
outside c15t.
|
|
32
|
+
|
|
33
|
+
| Package manager | Command |
|
|
34
|
+
| :-------------- | :------------------------------- |
|
|
35
|
+
| npm | `npm install @c15t/integrations` |
|
|
36
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
37
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
38
|
+
| bun | `bun add @c15t/integrations` |
|
|
39
|
+
|
|
40
|
+
```ts title="src/consent-scripts.ts"
|
|
41
|
+
import { statableAnalytics } from '@c15t/integrations/statable-analytics';
|
|
42
|
+
|
|
43
|
+
export const scripts = [statableAnalytics({ siteId: '12345' })];
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Register the scripts
|
|
47
|
+
|
|
48
|
+
Complete your [framework quickstart](https://c15t.com/docs/frameworks) first. Keep its Inth
|
|
49
|
+
endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
50
|
+
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
51
|
+
|
|
52
|
+
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
53
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
54
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
55
|
+
second file.
|
|
56
|
+
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
57
|
+
point for your framework below. These are edits to that provider, not a second
|
|
58
|
+
provider.
|
|
59
|
+
|
|
60
|
+
**Next.js**
|
|
61
|
+
|
|
62
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
63
|
+
`next.config.ts`:
|
|
64
|
+
|
|
65
|
+
```ts title="c15t.config.ts"
|
|
66
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
67
|
+
import { scripts } from './src/consent-scripts';
|
|
68
|
+
|
|
69
|
+
export default defineConsentConfig({ scripts });
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
73
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
74
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
75
|
+
read the same file. See
|
|
76
|
+
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
77
|
+
|
|
78
|
+
**TanStack Start**
|
|
79
|
+
|
|
80
|
+
Import the configuration into your root route and pass it to the existing
|
|
81
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
82
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
83
|
+
|
|
84
|
+
```tsx title="src/routes/__root.tsx"
|
|
85
|
+
import { scripts } from '../consent-scripts';
|
|
86
|
+
|
|
87
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Import vendor helpers in the root route module, not in a server function.
|
|
91
|
+
A server function's return value must be serializable, and script
|
|
92
|
+
configurations carry callbacks. See
|
|
93
|
+
[TanStack Start scripts](https://c15t.com/docs/frameworks/tanstack-start/scripts).
|
|
94
|
+
|
|
95
|
+
**React**
|
|
96
|
+
|
|
97
|
+
Add the configuration to the existing `ConsentProvider` options, next to
|
|
98
|
+
`mode`:
|
|
99
|
+
|
|
100
|
+
```tsx title="src/consent.tsx"
|
|
101
|
+
import { scripts } from './consent-scripts';
|
|
102
|
+
|
|
103
|
+
<ConsentProvider options={{ mode, scripts }}>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`mode` is the `manifest()` value from the
|
|
107
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
108
|
+
dialog and preferences link inside the provider. See
|
|
109
|
+
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
110
|
+
|
|
111
|
+
**Nuxt**
|
|
112
|
+
|
|
113
|
+
Register the scripts under the `c15t` key in `app/app.config.ts`. Adjust the
|
|
114
|
+
relative import to where you created `consent-scripts.ts`:
|
|
115
|
+
|
|
116
|
+
```ts title="app/app.config.ts"
|
|
117
|
+
import { scripts } from '../src/consent-scripts';
|
|
118
|
+
|
|
119
|
+
export default defineAppConfig({
|
|
120
|
+
c15t: { scripts },
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The Nuxt module merges this over its options in `nuxt.config.ts` and starts
|
|
125
|
+
one script loader in the browser after hydration, once it has applied the
|
|
126
|
+
visitor's stored choice and privacy signals. Keep `scripts` out of
|
|
127
|
+
`nuxt.config.ts`, which reaches the browser as JSON and drops the vendor
|
|
128
|
+
callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
129
|
+
[Nuxt scripts and embeds](https://c15t.com/docs/frameworks/nuxt/scripts).
|
|
130
|
+
|
|
131
|
+
**Vue**
|
|
132
|
+
|
|
133
|
+
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
134
|
+
|
|
135
|
+
```ts title="src/main.ts"
|
|
136
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
137
|
+
import { scripts } from './consent-scripts';
|
|
138
|
+
|
|
139
|
+
app.use(c15tVue, {
|
|
140
|
+
mode: manifest(),
|
|
141
|
+
scripts,
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
146
|
+
script loader when the app mounts, after it has applied the visitor's stored
|
|
147
|
+
choice. Do not also call `createScriptLoader` from a component. See
|
|
148
|
+
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
149
|
+
|
|
150
|
+
**Astro**
|
|
151
|
+
|
|
152
|
+
Add the scripts to the client entrypoint from the
|
|
153
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
154
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
155
|
+
If the module already exports scripts, combine the two arrays.
|
|
156
|
+
|
|
157
|
+
```ts title="src/c15t.client.ts"
|
|
158
|
+
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
159
|
+
import { scripts } from './consent-scripts';
|
|
160
|
+
|
|
161
|
+
export default { scripts } satisfies C15tClientOptionsExtension;
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Vendor helpers contain callbacks, and the integration options in
|
|
165
|
+
`astro.config.mjs` are serialized into the page, so do not put helpers in
|
|
166
|
+
the integration's `scripts` option. The integration passes the client
|
|
167
|
+
entrypoint to the one runtime every page shares, including across
|
|
168
|
+
`ClientRouter` navigation.
|
|
169
|
+
|
|
170
|
+
**Svelte**
|
|
171
|
+
|
|
172
|
+
Import the scripts in the component that owns your existing provider and
|
|
173
|
+
pass them as a top-level prop:
|
|
174
|
+
|
|
175
|
+
```svelte title="src/App.svelte"
|
|
176
|
+
<script lang="ts">
|
|
177
|
+
import { ConsentProvider, manifest } from 'c15t/svelte';
|
|
178
|
+
import { scripts } from './consent-scripts';
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
182
|
+
<!-- Keep your application, consent UI and preferences link here. -->
|
|
183
|
+
</ConsentProvider>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
187
|
+
The provider owns the loader and disposes it on unmount.
|
|
188
|
+
|
|
189
|
+
**SvelteKit**
|
|
190
|
+
|
|
191
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
192
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
193
|
+
|
|
194
|
+
```svelte title="src/routes/+layout.svelte"
|
|
195
|
+
<script lang="ts">
|
|
196
|
+
import { ConsentRoot } from 'c15t/svelte';
|
|
197
|
+
import { scripts } from '../consent-scripts';
|
|
198
|
+
|
|
199
|
+
let { children, data } = $props();
|
|
200
|
+
</script>
|
|
201
|
+
|
|
202
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
203
|
+
{@render children()}
|
|
204
|
+
<!-- Keep your consent UI and preferences link here. -->
|
|
205
|
+
</ConsentRoot>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
209
|
+
a server load cannot send functions to the browser. Prerendered, static and
|
|
210
|
+
SPA-mode pages use the same `scripts` prop. If you pass an externally owned
|
|
211
|
+
`runtime` to the provider, register scripts when creating that runtime instead.
|
|
212
|
+
|
|
213
|
+
**HTML**
|
|
214
|
+
|
|
215
|
+
The helpers in `@c15t/integrations` are ES modules that need a bundler. On a
|
|
216
|
+
page that loads the c15t script tag, paste the vendor's own snippet instead
|
|
217
|
+
and keep it inert until its category is allowed:
|
|
218
|
+
|
|
219
|
+
```html
|
|
220
|
+
<script type="text/plain" data-c15t-category="measurement">
|
|
221
|
+
// The vendor's snippet, unchanged
|
|
222
|
+
</script>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Use the category this guide names for the vendor. c15t runs the snippet
|
|
226
|
+
once that category is allowed, and reloads the page when the visitor
|
|
227
|
+
withdraws it. Helper options on this page, such as `loadMode`, do not apply
|
|
228
|
+
to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/scripts).
|
|
229
|
+
|
|
230
|
+
**JavaScript**
|
|
231
|
+
|
|
232
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
import { init, manifest } from '@c15t/browser';
|
|
236
|
+
import { scripts } from './consent-scripts';
|
|
237
|
+
|
|
238
|
+
const consent = init({
|
|
239
|
+
mode: manifest(),
|
|
240
|
+
scripts,
|
|
241
|
+
});
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Keep the mode from your quickstart. With
|
|
245
|
+
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
246
|
+
A kernel you create yourself needs a loader from
|
|
247
|
+
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
248
|
+
[JavaScript scripts](https://c15t.com/docs/frameworks/javascript/scripts).
|
|
249
|
+
|
|
250
|
+
## Options
|
|
251
|
+
|
|
252
|
+
| Option | Default | Behavior |
|
|
253
|
+
| ------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
254
|
+
| `siteId` | Required | Positive integer as a string or number. Trimmed. If it's missing, blank, fractional, negative, non-decimal or above the safe integer limit, c15t logs an error and never loads the tracker. |
|
|
255
|
+
| `scriptUrl` | `https://statable.com/js/{siteId}/s.js` | Loader URL override. Each `{siteId}` is replaced with the site ID. A blank value uses the default. |
|
|
256
|
+
| `trackingApi` | Loader origin plus `/api/event` | Full ingestion endpoint, set as the `data-tracking-api` attribute. The tracker posts to this URL as you give it. A blank value leaves the attribute off, so Statable uses its default. |
|
|
257
|
+
|
|
258
|
+
If you serve the tracker from your own CDN, and that CDN doesn't serve or proxy
|
|
259
|
+
`/api/event`, set `trackingApi` to the full ingestion URL too. Replace both
|
|
260
|
+
example hosts with your own:
|
|
261
|
+
|
|
262
|
+
```ts title="src/consent-scripts.ts"
|
|
263
|
+
import { statableAnalytics } from '@c15t/integrations/statable-analytics';
|
|
264
|
+
|
|
265
|
+
export const scripts = [
|
|
266
|
+
statableAnalytics({
|
|
267
|
+
scriptUrl: 'https://cdn.example.com/js/{siteId}/s.js',
|
|
268
|
+
siteId: '12345',
|
|
269
|
+
trackingApi: 'https://analytics.example.com/api/event',
|
|
270
|
+
}),
|
|
271
|
+
];
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
A custom `scriptUrl` only changes where the browser fetches the tracker. It
|
|
275
|
+
doesn't proxy event requests. Statable uses the visitor's connection to the
|
|
276
|
+
ingestion server for its reports, so check Statable's guidance before you proxy
|
|
277
|
+
collection.
|
|
278
|
+
|
|
279
|
+
## Loading and revocation
|
|
280
|
+
|
|
281
|
+
When `measurement` is allowed, the helper adds a deferred script with your
|
|
282
|
+
site ID in its path and in the `data-id` attribute. It doesn't create
|
|
283
|
+
`window.statable` or queue events. The tracker sets up `window.statable.t`
|
|
284
|
+
after it loads, and it doesn't replay events sent before then. Check the
|
|
285
|
+
measurement permission and wait for that function before you send an event.
|
|
286
|
+
|
|
287
|
+
The helper calls no Statable consent or stop API. On withdrawal, c15t removes
|
|
288
|
+
the loader element, but the tracker's listeners and timers keep running until
|
|
289
|
+
the page unloads. Keep `reloadOnConsentRevoked` enabled. If you turn it off,
|
|
290
|
+
tracking continues on the current page.
|
|
291
|
+
|
|
292
|
+
## Cookies and storage
|
|
293
|
+
|
|
294
|
+
Statable says it sets no cookies and stores no persistent visitor ID in the
|
|
295
|
+
browser. Its tracker reads the `analytics_ignore` flag in local storage. It
|
|
296
|
+
sends the full page URL to ingestion, including the query and fragment.
|
|
297
|
+
Statable says it strips both when it processes URLs. Keep sensitive data out of
|
|
298
|
+
URLs anyway.
|
|
299
|
+
|
|
300
|
+
For CSP, allow `https://statable.com` in `script-src` and `connect-src`, or
|
|
301
|
+
your custom loader and ingestion hosts.
|
|
302
|
+
|
|
303
|
+
## Verify Statable
|
|
304
|
+
|
|
305
|
+
With measurement denied, filter the DevTools Network panel by `statable.com`
|
|
306
|
+
and check that no loader or event request appears. Check Cookies, Local Storage
|
|
307
|
+
and Session Storage in the Application panel for Statable entries. Allowing
|
|
308
|
+
only marketing must leave Statable blocked too.
|
|
309
|
+
|
|
310
|
+
After you allow measurement, expect one `/js/<siteId>/s.js` script element, and
|
|
311
|
+
`typeof window.statable?.t === 'function'`. With a configured site, events post
|
|
312
|
+
to `/api/event` or to your `trackingApi` URL. Statable suppresses collection
|
|
313
|
+
for automated browsers, Do Not Track, Global Privacy Control and the
|
|
314
|
+
`analytics_ignore` flag. A ready API alone doesn't prove that an event reached
|
|
315
|
+
your dashboard.
|
|
316
|
+
|
|
317
|
+
Sources: [tracking script reference](https://statable.com/docs/developers/tracking-script/),
|
|
318
|
+
[JavaScript API reference](https://statable.com/docs/developers/javascript-api/)
|
|
319
|
+
and [privacy policy](https://statable.com/privacy).
|
|
320
|
+
|
|
321
|
+
Test in a private window with an opt-in policy. Open DevTools Network, disable
|
|
322
|
+
the cache and filter by the vendor's domain:
|
|
323
|
+
|
|
324
|
+
1. Load the page. No request goes to the vendor before you choose.
|
|
325
|
+
2. Click Reject, then reload. There is still no vendor request.
|
|
326
|
+
3. Open Privacy settings and allow the helper's category. The vendor script
|
|
327
|
+
loads without a page reload.
|
|
328
|
+
4. Turn the category off again and save. c15t reloads the page, and the new
|
|
329
|
+
page makes no vendor request.
|
|
330
|
+
|
|
331
|
+
c15t reloads on revocation because removing a script element does not stop
|
|
332
|
+
code that already ran. The vendor's listeners, timers and queued events stay
|
|
333
|
+
alive until the page unloads. If you set `reloadOnConsentRevoked: false`, stop
|
|
334
|
+
the vendor yourself. Register a callback-only script whose `onConsentChange`
|
|
335
|
+
calls the vendor's opt-out API, as shown in
|
|
336
|
+
[custom integrations](./building-integrations.md), and check the
|
|
337
|
+
permission before each of your own event calls. The reload does not delete
|
|
338
|
+
cookies the vendor already set; see
|
|
339
|
+
[clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
|
|
340
|
+
|
|
341
|
+
The helper lists its vendor by name in the preference dialog, so a visitor can
|
|
342
|
+
turn it off inside an allowed category. See
|
|
343
|
+
[vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
|
|
344
|
+
[consent verification guide](../guides/verify-consent.md) covers navigation,
|
|
345
|
+
expiry and hosting checks.
|