@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
|
@@ -3,38 +3,48 @@ title: Mixpanel
|
|
|
3
3
|
description: Load the Mixpanel SDK on every page with the c15t mixpanelAnalytics
|
|
4
4
|
helper, which switches Mixpanel tracking on and off with measurement consent,
|
|
5
5
|
and check it in DevTools.
|
|
6
|
+
seoTitle: Mixpanel cookie consent with c15t
|
|
7
|
+
seoDescription: Opt Mixpanel out without measurement consent, and opt it in with
|
|
8
|
+
consent. Set it up with the c15t mixpanelAnalytics helper.
|
|
6
9
|
icon: mixpanel
|
|
7
10
|
group: integrations
|
|
8
11
|
---
|
|
9
12
|
|
|
13
|
+
The c15t `mixpanelAnalytics` helper loads the Mixpanel SDK on every page, before
|
|
14
|
+
the visitor chooses. The helper uses `alwaysLoad`, but its category is
|
|
15
|
+
`measurement`. After the SDK loads, the helper calls
|
|
16
|
+
`mixpanel.opt_out_tracking()` while `measurement` has no consent. It calls
|
|
17
|
+
`mixpanel.opt_in_tracking()` while `measurement` has consent. If the visitor
|
|
18
|
+
withdraws consent, the helper calls `mixpanel.opt_out_tracking()` again. By
|
|
19
|
+
default, c15t also reloads the page.
|
|
20
|
+
|
|
10
21
|
## Configure Mixpanel
|
|
11
22
|
|
|
12
23
|
Copy the 32-character project token from your Mixpanel installation snippet,
|
|
13
24
|
where it is passed to `mixpanel.init`. Remove that snippet.
|
|
14
25
|
|
|
15
|
-
| Package manager | Command
|
|
16
|
-
| :-------------- |
|
|
17
|
-
| npm | `npm install @c15t/integrations
|
|
18
|
-
| pnpm | `pnpm add @c15t/integrations
|
|
19
|
-
| yarn | `yarn add @c15t/integrations
|
|
20
|
-
| bun | `bun add @c15t/integrations
|
|
26
|
+
| Package manager | Command |
|
|
27
|
+
| :-------------- | :------------------------------- |
|
|
28
|
+
| npm | `npm install @c15t/integrations` |
|
|
29
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
30
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
31
|
+
| bun | `bun add @c15t/integrations` |
|
|
21
32
|
|
|
22
33
|
```ts title="src/consent-scripts.ts"
|
|
23
34
|
import { mixpanelAnalytics } from '@c15t/integrations/mixpanel-analytics';
|
|
24
35
|
|
|
25
36
|
export const scripts = [
|
|
26
|
-
mixpanelAnalytics({
|
|
27
|
-
token: '0123456789abcdef0123456789abcdef',
|
|
28
|
-
initOptions: { opt_out_tracking_by_default: true },
|
|
29
|
-
}),
|
|
37
|
+
mixpanelAnalytics({ token: '0123456789abcdef0123456789abcdef' }),
|
|
30
38
|
];
|
|
31
39
|
```
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
The helper sets `opt_out_tracking_by_default` and
|
|
42
|
+
`opt_out_persistence_by_default` to `true`, so the SDK starts a visitor with no
|
|
43
|
+
stored Mixpanel opt-in as opted out. It then applies the opt-in or opt-out call
|
|
44
|
+
the helper queued before load. A visitor without consent stays opted out:
|
|
45
|
+
nothing is tracked, including `track` calls your code queued before the SDK
|
|
46
|
+
loaded, and no visitor ID is stored. The SDK still writes an empty `mp_*`
|
|
47
|
+
cookie as it starts and removes it during the same page load.
|
|
38
48
|
|
|
39
49
|
## Register the scripts
|
|
40
50
|
|
|
@@ -43,51 +53,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
|
43
53
|
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
44
54
|
|
|
45
55
|
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
46
|
-
quickstart already
|
|
47
|
-
Next.js guide, add the helper to that array instead of creating a
|
|
56
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
57
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
58
|
+
second file.
|
|
48
59
|
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
49
60
|
point for your framework below. These are edits to that provider, not a second
|
|
50
61
|
provider.
|
|
51
62
|
|
|
52
63
|
**Next.js**
|
|
53
64
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
import { ConsentRoot } from 'c15t/next';
|
|
58
|
-
import { scripts } from './consent-scripts';
|
|
59
|
-
```
|
|
65
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
66
|
+
`next.config.ts`:
|
|
60
67
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
```ts title="c15t.config.ts"
|
|
69
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
70
|
+
import { scripts } from './src/consent-scripts';
|
|
64
71
|
|
|
65
|
-
|
|
66
|
-
<ConsentRoot state={state} config={consentConfig} scripts={scripts}>
|
|
67
|
-
{children}
|
|
68
|
-
</ConsentRoot>
|
|
72
|
+
export default defineConsentConfig({ scripts });
|
|
69
73
|
```
|
|
70
74
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
76
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
77
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
78
|
+
read the same file. See
|
|
74
79
|
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
75
80
|
|
|
76
81
|
**TanStack Start**
|
|
77
82
|
|
|
78
83
|
Import the configuration into your root route and pass it to the existing
|
|
79
|
-
`ConsentRoot` as a top-level prop. Keep the loader
|
|
80
|
-
|
|
84
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
85
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
81
86
|
|
|
82
87
|
```tsx title="src/routes/__root.tsx"
|
|
83
88
|
import { scripts } from '../consent-scripts';
|
|
84
89
|
|
|
85
|
-
<ConsentRoot
|
|
86
|
-
state={consent}
|
|
87
|
-
backendURL={backendURL}
|
|
88
|
-
initRoute={false}
|
|
89
|
-
scripts={scripts}
|
|
90
|
-
>
|
|
90
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
Import vendor helpers in the root route module, not in a server function.
|
|
@@ -106,8 +106,8 @@ import { scripts } from './consent-scripts';
|
|
|
106
106
|
<ConsentProvider options={{ mode, scripts }}>
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
`mode` is the `
|
|
110
|
-
|
|
109
|
+
`mode` is the `manifest()` value from the
|
|
110
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
111
111
|
dialog and preferences link inside the provider. See
|
|
112
112
|
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
113
113
|
|
|
@@ -136,15 +136,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
|
136
136
|
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
137
137
|
|
|
138
138
|
```ts title="src/main.ts"
|
|
139
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
139
140
|
import { scripts } from './consent-scripts';
|
|
140
141
|
|
|
141
142
|
app.use(c15tVue, {
|
|
142
|
-
|
|
143
|
+
mode: manifest(),
|
|
143
144
|
scripts,
|
|
144
145
|
});
|
|
145
146
|
```
|
|
146
147
|
|
|
147
|
-
Keep your existing
|
|
148
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
148
149
|
script loader when the app mounts, after it has applied the visitor's stored
|
|
149
150
|
choice. Do not also call `createScriptLoader` from a component. See
|
|
150
151
|
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
@@ -152,12 +153,11 @@ choice. Do not also call `createScriptLoader` from a component. See
|
|
|
152
153
|
**Astro**
|
|
153
154
|
|
|
154
155
|
Add the scripts to the client entrypoint from the
|
|
155
|
-
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart),
|
|
156
|
-
integration
|
|
157
|
-
|
|
158
|
-
already exports scripts, combine the two arrays.
|
|
156
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
157
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
158
|
+
If the module already exports scripts, combine the two arrays.
|
|
159
159
|
|
|
160
|
-
```ts title="src/
|
|
160
|
+
```ts title="src/c15t.client.ts"
|
|
161
161
|
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
162
162
|
import { scripts } from './consent-scripts';
|
|
163
163
|
|
|
@@ -177,15 +177,13 @@ pass them as a top-level prop:
|
|
|
177
177
|
|
|
178
178
|
```svelte title="src/App.svelte"
|
|
179
179
|
<script lang="ts">
|
|
180
|
-
import {
|
|
180
|
+
import { ConsentProvider, manifest } from '@c15t/svelte';
|
|
181
181
|
import { scripts } from './consent-scripts';
|
|
182
|
-
|
|
183
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
184
182
|
</script>
|
|
185
183
|
|
|
186
|
-
<
|
|
184
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
187
185
|
<!-- Keep your application, consent UI and preferences link here. -->
|
|
188
|
-
</
|
|
186
|
+
</ConsentProvider>
|
|
189
187
|
```
|
|
190
188
|
|
|
191
189
|
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
@@ -193,22 +191,21 @@ The provider owns the loader and disposes it on unmount.
|
|
|
193
191
|
|
|
194
192
|
**SvelteKit**
|
|
195
193
|
|
|
196
|
-
Add the scripts to the existing root layout
|
|
197
|
-
and
|
|
194
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
195
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
198
196
|
|
|
199
197
|
```svelte title="src/routes/+layout.svelte"
|
|
200
198
|
<script lang="ts">
|
|
201
|
-
import {
|
|
199
|
+
import { ConsentRoot } from '@c15t/svelte';
|
|
202
200
|
import { scripts } from '../consent-scripts';
|
|
203
201
|
|
|
204
202
|
let { children, data } = $props();
|
|
205
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
206
203
|
</script>
|
|
207
204
|
|
|
208
|
-
<
|
|
205
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
209
206
|
{@render children()}
|
|
210
207
|
<!-- Keep your consent UI and preferences link here. -->
|
|
211
|
-
</
|
|
208
|
+
</ConsentRoot>
|
|
212
209
|
```
|
|
213
210
|
|
|
214
211
|
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
@@ -235,20 +232,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
|
|
|
235
232
|
|
|
236
233
|
**JavaScript**
|
|
237
234
|
|
|
238
|
-
Pass the scripts to `init()` from `@c15t/browser`, next to your
|
|
239
|
-
URL:
|
|
235
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
240
236
|
|
|
241
237
|
```ts
|
|
242
|
-
import { init } from '@c15t/browser';
|
|
238
|
+
import { init, manifest } from '@c15t/browser';
|
|
243
239
|
import { scripts } from './consent-scripts';
|
|
244
240
|
|
|
245
241
|
const consent = init({
|
|
246
|
-
|
|
242
|
+
mode: manifest(),
|
|
247
243
|
scripts,
|
|
248
244
|
});
|
|
249
245
|
```
|
|
250
246
|
|
|
251
|
-
Keep the
|
|
247
|
+
Keep the mode from your quickstart. With
|
|
252
248
|
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
253
249
|
A kernel you create yourself needs a loader from
|
|
254
250
|
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
@@ -256,19 +252,21 @@ A kernel you create yourself needs a loader from
|
|
|
256
252
|
|
|
257
253
|
## Options
|
|
258
254
|
|
|
259
|
-
| Option | Default
|
|
260
|
-
| ------------- |
|
|
261
|
-
| `token` | Required
|
|
262
|
-
| `initOptions` | `{}`
|
|
263
|
-
| `scriptUrl` | `https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js`
|
|
255
|
+
| Option | Default | Behavior |
|
|
256
|
+
| ------------- | ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
257
|
+
| `token` | Required | 32-character hexadecimal project token. Surrounding whitespace is trimmed. Any other value logs an error and the script does not load. |
|
|
258
|
+
| `initOptions` | `{ opt_out_tracking_by_default: true, opt_out_persistence_by_default: true }` | Mixpanel config passed to `init`, merged over the defaults. Use JSON-serializable values only. |
|
|
259
|
+
| `scriptUrl` | `https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js` | Loader URL override. |
|
|
264
260
|
|
|
265
261
|
## Loading and revocation
|
|
266
262
|
|
|
267
263
|
`mixpanelAnalytics` uses the `measurement` category with `alwaysLoad`, so the
|
|
268
|
-
Mixpanel SDK loads on every page, before any choice.
|
|
269
|
-
helper
|
|
270
|
-
`mixpanel.opt_out_tracking()` if not.
|
|
271
|
-
|
|
264
|
+
Mixpanel SDK loads on every page, before any choice. Before the SDK loads, the
|
|
265
|
+
helper queues `mixpanel.opt_in_tracking()` if measurement is allowed and
|
|
266
|
+
`mixpanel.opt_out_tracking()` if not. Mixpanel runs that call during init,
|
|
267
|
+
before any queued `track` calls, so a visitor who already consented keeps
|
|
268
|
+
those events. The helper calls the matching method again on each later consent
|
|
269
|
+
change. The SDK stays on the page after revocation.
|
|
272
270
|
|
|
273
271
|
Before the SDK loads, the helper queues `track`, `identify`, `reset`,
|
|
274
272
|
`register`, `opt_in_tracking` and `opt_out_tracking` on the default instance.
|
|
@@ -3,21 +3,29 @@ title: OneDollarStats
|
|
|
3
3
|
description: Load the OneDollarStats tracker only after measurement consent with
|
|
4
4
|
the c15t oneDollarStats helper, forward its data-attribute settings, and check
|
|
5
5
|
it in DevTools.
|
|
6
|
+
seoTitle: OneDollarStats cookie consent with c15t
|
|
7
|
+
seoDescription: Load the OneDollarStats tracker only with measurement consent.
|
|
8
|
+
Set it up with the c15t oneDollarStats helper and check it in DevTools.
|
|
6
9
|
icon: circle-dollar
|
|
7
10
|
group: integrations
|
|
8
11
|
---
|
|
9
12
|
|
|
13
|
+
The c15t `oneDollarStats` helper keeps the OneDollarStats tracker, `stonks.js`,
|
|
14
|
+
off the page until `measurement` has consent. The helper sends no consent signal
|
|
15
|
+
to OneDollarStats. If the visitor withdraws consent, c15t removes the script
|
|
16
|
+
element. By default, c15t also reloads the page.
|
|
17
|
+
|
|
10
18
|
## Configure OneDollarStats
|
|
11
19
|
|
|
12
20
|
OneDollarStats needs no API key. The helper loads the tracker and forwards
|
|
13
21
|
each setting you pass as a `data-*` attribute.
|
|
14
22
|
|
|
15
|
-
| Package manager | Command
|
|
16
|
-
| :-------------- |
|
|
17
|
-
| npm | `npm install @c15t/integrations
|
|
18
|
-
| pnpm | `pnpm add @c15t/integrations
|
|
19
|
-
| yarn | `yarn add @c15t/integrations
|
|
20
|
-
| bun | `bun add @c15t/integrations
|
|
23
|
+
| Package manager | Command |
|
|
24
|
+
| :-------------- | :------------------------------- |
|
|
25
|
+
| npm | `npm install @c15t/integrations` |
|
|
26
|
+
| pnpm | `pnpm add @c15t/integrations` |
|
|
27
|
+
| yarn | `yarn add @c15t/integrations` |
|
|
28
|
+
| bun | `bun add @c15t/integrations` |
|
|
21
29
|
|
|
22
30
|
```ts title="src/consent-scripts.ts"
|
|
23
31
|
import { oneDollarStats } from '@c15t/integrations/one-dollar-stats';
|
|
@@ -32,51 +40,41 @@ endpoint, policy, styles and consent UI. Remove the vendor's original script,
|
|
|
32
40
|
SDK initializer or tag-manager entry, so the vendor loads only through c15t.
|
|
33
41
|
|
|
34
42
|
The vendor pages put the helper in `src/consent-scripts.ts`. If your framework
|
|
35
|
-
quickstart already
|
|
36
|
-
Next.js guide, add the helper to that array instead of creating a
|
|
43
|
+
quickstart already has a `scripts` array, such as the one in `c15t.config.ts`
|
|
44
|
+
in the Next.js guide, add the helper to that array instead of creating a
|
|
45
|
+
second file.
|
|
37
46
|
The `scripts` export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration
|
|
38
47
|
point for your framework below. These are edits to that provider, not a second
|
|
39
48
|
provider.
|
|
40
49
|
|
|
41
50
|
**Next.js**
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```ts
|
|
46
|
-
import { ConsentRoot } from 'c15t/next';
|
|
47
|
-
import { scripts } from './consent-scripts';
|
|
48
|
-
```
|
|
52
|
+
Add the configuration to `scripts` in `c15t.config.ts`, next to
|
|
53
|
+
`next.config.ts`:
|
|
49
54
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
```ts title="c15t.config.ts"
|
|
56
|
+
import { defineConsentConfig } from 'c15t/next';
|
|
57
|
+
import { scripts } from './src/consent-scripts';
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
<ConsentRoot state={state} config={consentConfig} scripts={scripts}>
|
|
56
|
-
{children}
|
|
57
|
-
</ConsentRoot>
|
|
59
|
+
export default defineConsentConfig({ scripts });
|
|
58
60
|
```
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
Keep the rest of your config, such as `mode` and `routePrefix`, in the
|
|
63
|
+
same call. `ConsentRoot` reads the config in the browser, so the layout
|
|
64
|
+
keeps passing only `state`. App Router, Pages Router and static export all
|
|
65
|
+
read the same file. See
|
|
63
66
|
[Next.js scripts and embeds](https://c15t.com/docs/frameworks/next/scripts).
|
|
64
67
|
|
|
65
68
|
**TanStack Start**
|
|
66
69
|
|
|
67
70
|
Import the configuration into your root route and pass it to the existing
|
|
68
|
-
`ConsentRoot` as a top-level prop. Keep the loader
|
|
69
|
-
|
|
71
|
+
`ConsentRoot` as a top-level prop. Keep the loader from the
|
|
72
|
+
[TanStack Start quickstart](https://c15t.com/docs/frameworks/tanstack-start/quickstart):
|
|
70
73
|
|
|
71
74
|
```tsx title="src/routes/__root.tsx"
|
|
72
75
|
import { scripts } from '../consent-scripts';
|
|
73
76
|
|
|
74
|
-
<ConsentRoot
|
|
75
|
-
state={consent}
|
|
76
|
-
backendURL={backendURL}
|
|
77
|
-
initRoute={false}
|
|
78
|
-
scripts={scripts}
|
|
79
|
-
>
|
|
77
|
+
<ConsentRoot state={consent} scripts={scripts}>
|
|
80
78
|
```
|
|
81
79
|
|
|
82
80
|
Import vendor helpers in the root route module, not in a server function.
|
|
@@ -95,8 +93,8 @@ import { scripts } from './consent-scripts';
|
|
|
95
93
|
<ConsentProvider options={{ mode, scripts }}>
|
|
96
94
|
```
|
|
97
95
|
|
|
98
|
-
`mode` is the `
|
|
99
|
-
|
|
96
|
+
`mode` is the `manifest()` value from the
|
|
97
|
+
[React quickstart](../frameworks/react/quickstart.md). Keep the banner,
|
|
100
98
|
dialog and preferences link inside the provider. See
|
|
101
99
|
[React scripts and embeds](../frameworks/react/scripts.md).
|
|
102
100
|
|
|
@@ -125,15 +123,16 @@ callbacks. Write the vendor IDs into `consent-scripts.ts`. See
|
|
|
125
123
|
Pass the scripts to the existing `c15tVue` plugin call in `src/main.ts`:
|
|
126
124
|
|
|
127
125
|
```ts title="src/main.ts"
|
|
126
|
+
import { c15tVue, manifest } from 'c15t/vue/vue-plugin';
|
|
128
127
|
import { scripts } from './consent-scripts';
|
|
129
128
|
|
|
130
129
|
app.use(c15tVue, {
|
|
131
|
-
|
|
130
|
+
mode: manifest(),
|
|
132
131
|
scripts,
|
|
133
132
|
});
|
|
134
133
|
```
|
|
135
134
|
|
|
136
|
-
Keep your existing
|
|
135
|
+
Keep your existing `mode` and other options. The plugin starts one
|
|
137
136
|
script loader when the app mounts, after it has applied the visitor's stored
|
|
138
137
|
choice. Do not also call `createScriptLoader` from a component. See
|
|
139
138
|
[Vue scripts and embeds](https://c15t.com/docs/frameworks/vue/scripts).
|
|
@@ -141,12 +140,11 @@ choice. Do not also call `createScriptLoader` from a component. See
|
|
|
141
140
|
**Astro**
|
|
142
141
|
|
|
143
142
|
Add the scripts to the client entrypoint from the
|
|
144
|
-
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart),
|
|
145
|
-
integration
|
|
146
|
-
|
|
147
|
-
already exports scripts, combine the two arrays.
|
|
143
|
+
[Astro quickstart](https://c15t.com/docs/frameworks/astro/quickstart), `src/c15t.client.ts`,
|
|
144
|
+
which the integration finds on its own. Keep `astro.config.mjs` as it is.
|
|
145
|
+
If the module already exports scripts, combine the two arrays.
|
|
148
146
|
|
|
149
|
-
```ts title="src/
|
|
147
|
+
```ts title="src/c15t.client.ts"
|
|
150
148
|
import type { C15tClientOptionsExtension } from 'c15t/astro';
|
|
151
149
|
import { scripts } from './consent-scripts';
|
|
152
150
|
|
|
@@ -166,15 +164,13 @@ pass them as a top-level prop:
|
|
|
166
164
|
|
|
167
165
|
```svelte title="src/App.svelte"
|
|
168
166
|
<script lang="ts">
|
|
169
|
-
import {
|
|
167
|
+
import { ConsentProvider, manifest } from '@c15t/svelte';
|
|
170
168
|
import { scripts } from './consent-scripts';
|
|
171
|
-
|
|
172
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
173
169
|
</script>
|
|
174
170
|
|
|
175
|
-
<
|
|
171
|
+
<ConsentProvider mode={manifest()} {scripts}>
|
|
176
172
|
<!-- Keep your application, consent UI and preferences link here. -->
|
|
177
|
-
</
|
|
173
|
+
</ConsentProvider>
|
|
178
174
|
```
|
|
179
175
|
|
|
180
176
|
Retain the styles and consent UI from the [Svelte quickstart](https://c15t.com/docs/frameworks/svelte/quickstart).
|
|
@@ -182,22 +178,21 @@ The provider owns the loader and disposes it on unmount.
|
|
|
182
178
|
|
|
183
179
|
**SvelteKit**
|
|
184
180
|
|
|
185
|
-
Add the scripts to the existing root layout
|
|
186
|
-
and
|
|
181
|
+
Add the scripts to the existing `ConsentRoot` in the root layout. Keep the
|
|
182
|
+
handle and the layout load from the [SvelteKit quickstart](https://c15t.com/docs/frameworks/sveltekit/quickstart).
|
|
187
183
|
|
|
188
184
|
```svelte title="src/routes/+layout.svelte"
|
|
189
185
|
<script lang="ts">
|
|
190
|
-
import {
|
|
186
|
+
import { ConsentRoot } from '@c15t/svelte';
|
|
191
187
|
import { scripts } from '../consent-scripts';
|
|
192
188
|
|
|
193
189
|
let { children, data } = $props();
|
|
194
|
-
const mode = hosted({ url: 'https://your-project.inth.app' });
|
|
195
190
|
</script>
|
|
196
191
|
|
|
197
|
-
<
|
|
192
|
+
<ConsentRoot state={data.consent} {scripts}>
|
|
198
193
|
{@render children()}
|
|
199
194
|
<!-- Keep your consent UI and preferences link here. -->
|
|
200
|
-
</
|
|
195
|
+
</ConsentRoot>
|
|
201
196
|
```
|
|
202
197
|
|
|
203
198
|
Import vendor helpers in the layout component, not in `+layout.server.ts`:
|
|
@@ -224,20 +219,19 @@ to a pasted snippet. See [HTML scripts](https://c15t.com/docs/frameworks/html/sc
|
|
|
224
219
|
|
|
225
220
|
**JavaScript**
|
|
226
221
|
|
|
227
|
-
Pass the scripts to `init()` from `@c15t/browser`, next to your
|
|
228
|
-
URL:
|
|
222
|
+
Pass the scripts to `init()` from `@c15t/browser`, next to your mode:
|
|
229
223
|
|
|
230
224
|
```ts
|
|
231
|
-
import { init } from '@c15t/browser';
|
|
225
|
+
import { init, manifest } from '@c15t/browser';
|
|
232
226
|
import { scripts } from './consent-scripts';
|
|
233
227
|
|
|
234
228
|
const consent = init({
|
|
235
|
-
|
|
229
|
+
mode: manifest(),
|
|
236
230
|
scripts,
|
|
237
231
|
});
|
|
238
232
|
```
|
|
239
233
|
|
|
240
|
-
Keep the
|
|
234
|
+
Keep the mode from your quickstart. With
|
|
241
235
|
`createConsentRuntime` from `c15t/runtime`, pass `scripts` to it instead.
|
|
242
236
|
A kernel you create yourself needs a loader from
|
|
243
237
|
`c15t/modules/script-loader`. Attach one loader per kernel. See
|
|
@@ -299,8 +293,8 @@ permission before each of your own event calls. The reload does not delete
|
|
|
299
293
|
cookies the vendor already set; see
|
|
300
294
|
[clear on revocation for your framework](./overview.md#vendor-switches-and-cookie-cleanup).
|
|
301
295
|
|
|
302
|
-
The helper
|
|
303
|
-
|
|
296
|
+
The helper lists its vendor by name in the preference dialog, so a visitor can
|
|
297
|
+
turn it off inside an allowed category. See
|
|
304
298
|
[vendor consent for your framework](./overview.md#vendor-switches-and-cookie-cleanup). The
|
|
305
299
|
[consent verification guide](../guides/verify-consent.md) covers navigation,
|
|
306
300
|
expiry and hosting checks.
|