@c15t/nextjs 2.1.0 → 2.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.
Files changed (162) hide show
  1. package/AGENTS.md +155 -0
  2. package/README.md +31 -15
  3. package/client/components/integrations.js +3 -0
  4. package/dist/components/integrations/index.cjs +1 -0
  5. package/dist/components/integrations/index.js +1 -0
  6. package/dist/headless.cjs +1 -1
  7. package/dist/index.cjs +1 -1
  8. package/dist/libs/browser-initial-data.cjs +1 -1
  9. package/dist/libs/initial-data.cjs +1 -1
  10. package/dist/styles.tw3.css +1 -1
  11. package/dist/version.cjs +1 -1
  12. package/dist/version.js +1 -1
  13. package/dist-types/components/integrations/index.d.ts +1 -0
  14. package/dist-types/libs/browser-initial-data.d.ts +1 -1
  15. package/dist-types/version.d.ts +1 -1
  16. package/docs/README.md +155 -73
  17. package/docs/{building-headless-components.md → frameworks/next/building-headless-components.md} +3 -1
  18. package/docs/{callbacks.md → frameworks/next/callbacks.md} +3 -1
  19. package/docs/{components → frameworks/next/components}/consent-banner.md +10 -21
  20. package/docs/{components → frameworks/next/components}/consent-dialog-link.md +8 -5
  21. package/docs/frameworks/next/components/consent-dialog-trigger.md +202 -0
  22. package/docs/{components → frameworks/next/components}/consent-dialog.md +7 -15
  23. package/docs/frameworks/next/components/consent-manager-provider.md +327 -0
  24. package/docs/{components → frameworks/next/components}/consent-widget.md +8 -6
  25. package/docs/{components → frameworks/next/components}/dev-tools.md +9 -6
  26. package/docs/{components → frameworks/next/components}/frame.md +8 -9
  27. package/docs/{concepts → frameworks/next/concepts}/client-modes.md +4 -2
  28. package/docs/{concepts → frameworks/next/concepts}/consent-categories.md +1 -0
  29. package/docs/{concepts → frameworks/next/concepts}/consent-models.md +1 -0
  30. package/docs/{concepts → frameworks/next/concepts}/cookie-management.md +3 -3
  31. package/docs/{concepts → frameworks/next/concepts}/glossary.md +1 -0
  32. package/docs/{concepts → frameworks/next/concepts}/initialization-flow.md +1 -0
  33. package/docs/{concepts → frameworks/next/concepts}/policy-packs.md +1 -0
  34. package/docs/{headless.md → frameworks/next/headless.md} +3 -1
  35. package/docs/{hooks → frameworks/next/hooks}/use-color-scheme.md +1 -0
  36. package/docs/{hooks → frameworks/next/hooks}/use-consent-manager/checking-consent.md +3 -1
  37. package/docs/{hooks → frameworks/next/hooks}/use-consent-manager/location-info.md +3 -1
  38. package/docs/frameworks/next/hooks/use-consent-manager/overview.md +185 -0
  39. package/docs/{hooks → frameworks/next/hooks}/use-consent-manager/setting-consent.md +3 -1
  40. package/docs/{hooks → frameworks/next/hooks}/use-draggable.md +3 -1
  41. package/docs/{hooks → frameworks/next/hooks}/use-focus-trap.md +1 -0
  42. package/docs/{hooks → frameworks/next/hooks}/use-reduced-motion.md +3 -1
  43. package/docs/{hooks → frameworks/next/hooks}/use-ssr-status.md +6 -5
  44. package/docs/{hooks → frameworks/next/hooks}/use-text-direction.md +1 -0
  45. package/docs/frameworks/next/hooks/use-translations.md +55 -0
  46. package/docs/{iab → frameworks/next/iab}/consent-banner.md +9 -12
  47. package/docs/{iab → frameworks/next/iab}/consent-dialog.md +9 -14
  48. package/docs/{iab → frameworks/next/iab}/overview.md +4 -2
  49. package/docs/{iab → frameworks/next/iab}/use-gvl-data.md +3 -2
  50. package/docs/{iframe-blocking.md → frameworks/next/iframe-blocking.md} +8 -9
  51. package/docs/{internationalization.md → frameworks/next/internationalization.md} +13 -3
  52. package/docs/{network-blocker.md → frameworks/next/network-blocker.md} +13 -51
  53. package/docs/{optimization.md → frameworks/next/optimization.md} +5 -4
  54. package/docs/{policy-packs.md → frameworks/next/policy-packs.md} +3 -1
  55. package/docs/{quickstart.md → frameworks/next/quickstart.md} +26 -42
  56. package/docs/{script-loader.md → frameworks/next/script-loader.md} +72 -90
  57. package/docs/{server-side.md → frameworks/next/server-side.md} +12 -15
  58. package/docs/{styling → frameworks/next/styling}/classnames.md +3 -1
  59. package/docs/{styling → frameworks/next/styling}/color-scheme.md +3 -1
  60. package/docs/frameworks/next/styling/css-variables.md +53 -0
  61. package/docs/frameworks/next/styling/overview.md +299 -0
  62. package/docs/frameworks/next/styling/slots.md +94 -0
  63. package/docs/{styling → frameworks/next/styling}/tailwind.md +3 -1
  64. package/docs/frameworks/next/styling/tokens.md +156 -0
  65. package/docs/{troubleshooting.md → frameworks/next/troubleshooting.md} +3 -1
  66. package/docs/integrations/adobe-analytics.md +160 -0
  67. package/docs/integrations/ahrefs-analytics.md +15 -82
  68. package/docs/integrations/amplitude.md +230 -0
  69. package/docs/integrations/building-integrations.md +15 -181
  70. package/docs/integrations/clearbit.md +130 -0
  71. package/docs/integrations/cloudflare-web-analytics.md +15 -83
  72. package/docs/integrations/crisp.md +13 -87
  73. package/docs/integrations/databuddy.md +16 -85
  74. package/docs/integrations/fathom-analytics.md +15 -86
  75. package/docs/integrations/google-maps.md +263 -0
  76. package/docs/integrations/google-tag-manager.md +18 -86
  77. package/docs/integrations/google-tag.md +15 -84
  78. package/docs/integrations/heap.md +219 -0
  79. package/docs/integrations/hightouch.md +199 -0
  80. package/docs/integrations/hotjar.md +15 -83
  81. package/docs/integrations/intercom.md +13 -83
  82. package/docs/integrations/linkedin-insights.md +15 -82
  83. package/docs/integrations/logrocket.md +175 -0
  84. package/docs/integrations/matomo-analytics.md +13 -88
  85. package/docs/integrations/meta-pixel.md +33 -316
  86. package/docs/integrations/microsoft-clarity.md +15 -83
  87. package/docs/integrations/microsoft-uet.md +16 -83
  88. package/docs/integrations/mixpanel-analytics.md +15 -83
  89. package/docs/integrations/overview.md +55 -6
  90. package/docs/integrations/pirsch.md +142 -0
  91. package/docs/integrations/plausible-analytics.md +14 -97
  92. package/docs/integrations/posthog.md +26 -98
  93. package/docs/integrations/promptwatch.md +16 -82
  94. package/docs/integrations/reddit-pixel.md +27 -122
  95. package/docs/integrations/rudderstack.md +271 -0
  96. package/docs/integrations/rybbit-analytics.md +15 -94
  97. package/docs/integrations/segment.md +15 -82
  98. package/docs/integrations/snapchat-pixel.md +21 -102
  99. package/docs/integrations/tiktok-pixel.md +13 -81
  100. package/docs/integrations/umami-analytics.md +16 -88
  101. package/docs/integrations/vercel-analytics.md +13 -85
  102. package/docs/integrations/x-pixel.md +27 -102
  103. package/docs/integrations/youtube.md +193 -0
  104. package/docs/shared/concepts/client-modes.md +103 -0
  105. package/docs/shared/concepts/consent-categories.md +41 -0
  106. package/docs/shared/concepts/consent-models.md +72 -0
  107. package/docs/shared/concepts/cookie-management.md +88 -0
  108. package/docs/shared/concepts/glossary.md +24 -0
  109. package/docs/shared/concepts/initialization-flow.md +105 -0
  110. package/docs/shared/concepts/policy-packs.md +225 -0
  111. package/docs/shared/react/components/consent-banner.md +242 -0
  112. package/docs/shared/react/components/consent-dialog-link.md +45 -0
  113. package/docs/shared/react/components/consent-dialog-trigger.md +185 -0
  114. package/docs/shared/react/components/consent-dialog.md +119 -0
  115. package/docs/shared/react/components/consent-manager-provider.md +225 -0
  116. package/docs/shared/react/components/consent-widget.md +121 -0
  117. package/docs/shared/react/components/dev-tools.md +81 -0
  118. package/docs/shared/react/components/frame.md +52 -0
  119. package/docs/shared/react/guides/building-headless-components.md +110 -0
  120. package/docs/shared/react/guides/callbacks.md +89 -0
  121. package/docs/shared/react/guides/headless.md +31 -0
  122. package/docs/shared/react/guides/iframe-blocking.md +65 -0
  123. package/docs/shared/react/guides/internationalization.md +123 -0
  124. package/docs/shared/react/guides/network-blocker.md +72 -0
  125. package/docs/shared/react/guides/optimization.md +44 -0
  126. package/docs/shared/react/guides/policy-packs.md +173 -0
  127. package/docs/shared/react/guides/script-loader.md +311 -0
  128. package/docs/shared/react/hooks/use-color-scheme.md +31 -0
  129. package/docs/shared/react/hooks/use-consent-manager/checking-consent.md +95 -0
  130. package/docs/shared/react/hooks/use-consent-manager/location-info.md +96 -0
  131. package/docs/shared/react/hooks/use-consent-manager/overview.md +74 -0
  132. package/docs/shared/react/hooks/use-consent-manager/setting-consent.md +93 -0
  133. package/docs/shared/react/hooks/use-draggable.md +30 -0
  134. package/docs/shared/react/hooks/use-focus-trap.md +20 -0
  135. package/docs/shared/react/hooks/use-reduced-motion.md +33 -0
  136. package/docs/shared/react/hooks/use-ssr-status.md +16 -0
  137. package/docs/shared/react/hooks/use-text-direction.md +38 -0
  138. package/docs/shared/react/hooks/use-translations.md +15 -0
  139. package/docs/shared/react/iab/consent-banner.md +60 -0
  140. package/docs/shared/react/iab/consent-dialog.md +76 -0
  141. package/docs/shared/react/iab/overview.md +80 -0
  142. package/docs/shared/react/iab/use-gvl-data.md +21 -0
  143. package/docs/shared/react/styling/classnames.md +93 -0
  144. package/docs/shared/react/styling/color-scheme.md +35 -0
  145. package/docs/shared/react/styling/css-variables.md +53 -0
  146. package/docs/shared/react/styling/overview.md +261 -0
  147. package/docs/shared/react/styling/slots.md +93 -0
  148. package/docs/shared/react/styling/stylesheet-entrypoint.md +8 -0
  149. package/docs/shared/react/styling/tailwind.md +88 -0
  150. package/docs/shared/react/styling/tokens.md +155 -0
  151. package/docs/shared/troubleshooting.md +82 -0
  152. package/package.json +19 -10
  153. package/readme.json +14 -8
  154. package/docs/ai-agents.md +0 -111
  155. package/docs/components/consent-dialog-trigger.md +0 -103
  156. package/docs/components/consent-manager-provider.md +0 -425
  157. package/docs/hooks/use-consent-manager/overview.md +0 -420
  158. package/docs/hooks/use-translations.md +0 -118
  159. package/docs/styling/css-variables.md +0 -92
  160. package/docs/styling/overview.md +0 -457
  161. package/docs/styling/slots.md +0 -128
  162. package/docs/styling/tokens.md +0 -216
@@ -1,8 +1,9 @@
1
1
  ---
2
2
  title: GA4 + Google Ads (gtag.js)
3
- description: Send data to Google Analytics 4 and Google Ads with automatic Consent Mode v2 support.
4
- lastModified: 2026-02-10
3
+ description: Send data to Google Analytics 4 and Google Ads with automatic
4
+ Consent Mode v2 support.
5
5
  icon: google-analytics
6
+ group: integrations
6
7
  ---
7
8
  Google Tag (`gtag.js`) is Google's unified tracking script for sending data to Google Analytics 4 (GA4), Google Ads, and Floodlight. It measures user behavior, tracks conversions, and powers Google's advertising ecosystem.
8
9
 
@@ -116,88 +117,18 @@ You do not need to wrap `gtag(...)` calls in a `useConsentManager().has(...)` ch
116
117
 
117
118
  ### GtagOptions
118
119
 
119
- |Property|Type|Description|Default|Required|
120
- |:--|:--|:--|:--|:--:|
121
- |id|string|Your gtag id|-|✅ Required|
122
- |category|AllConsentNames|The consent category to use for the gtag script. This is typically marketing (Ads & Floodlight) or measurement (Analytics)|-|✅ Required|
123
- |consentMapping|Record\<string, string\[]> \|undefined|Custom mapping from c15t consent categories to Google Consent Mode v2 types. Overrides the default mapping when provided.|\`\`\`ts \{ necessary: \['security\_storage'], functionality: \['functionality\_storage'], measurement: \['analytics\_storage'], marketing: \['ad\_storage', 'ad\_user\_data', 'ad\_personalization'], experience: \['personalization\_storage'], } \`\`\`|Optional|
124
- |script|Script \|undefined|Deprecated script-level overrides preserved for backwards compatibility. Prefer manifest-backed options instead of this generic override bag.|-|Optional|
120
+ |Property|Value|
121
+ |:--|:--|
122
+ |Type Name|\`GtagOptions\`|
123
+ |Source Path|\`./packages/scripts/src/vendors/analytics/google-tag.ts\`|
124
+
125
+ \*ExtractedTypeTable: Could not extract "GtagOptions" from "./packages/scripts/src/vendors/analytics/google-tag.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
125
126
 
126
127
  ### Script
127
128
 
128
- |Property|Type|Description|Default|Required|
129
- |:--|:--|:--|:--|:--:|
130
- |id|string|Unique identifier for the script|-|✅ Required|
131
- |src|string \|undefined|URL of the script to load|-|Optional|
132
- |textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
133
- |category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
134
- |callbackOnly|boolean \|undefined|Whether this is a callback-only script that doesn't need to load an external resource. When true, no script tag will be added to the DOM, only callbacks will be executed.|false|Optional|
135
- |persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
136
- |alwaysLoad|boolean \|undefined|Whether the script should always load regardless of consent state. This is useful for scripts like Google Tag Manager or PostHog that manage their own consent state internally. The script will load immediately and never be unloaded based on consent changes. Note: When using this option, you are responsible for ensuring the script itself respects user consent preferences through its own consent management.|false|Optional|
137
- |fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
138
- |attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
139
- |async|boolean \|undefined|Whether to use async loading|-|Optional|
140
- |defer|boolean \|undefined|Whether to defer script loading|-|Optional|
141
- |nonce|string \|undefined|Content Security Policy nonce|-|Optional|
142
- |anonymizeId|boolean \|undefined|Whether to use an anonymized ID for the script element, this helps ensure the script is not blocked by ad blockers|true|Optional|
143
- |target|"head" \|"body" \|undefined|Where to inject the script element in the DOM. Options: \`'head'\`: Scripts are appended to \`\<head>\` (default); \`'body'\`: Scripts are appended to \`\<body>\`|'head'|Optional|
144
- |onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
145
- |onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
146
- |onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
147
- |onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
148
- |vendorId|string \|number \|undefined|IAB TCF vendor ID - links script to a registered vendor. When in IAB mode, the script will only load if this vendor has consent. Takes precedence over \`category\` when in IAB mode. Use custom vendor IDs (string or number) to gate non-IAB vendors too.|-|Optional|
149
- |iabPurposes|number\[] \|undefined|IAB TCF purpose IDs this script requires consent for. When in IAB mode and no vendorId is set, the script will only load if ALL specified purposes have consent.|-|Optional|
150
- |iabLegIntPurposes|number\[] \|undefined|IAB TCF legitimate interest purpose IDs. These purposes can operate under legitimate interest instead of consent. The script loads if all iabPurposes have consent OR all iabLegIntPurposes have legitimate interest established.|-|Optional|
151
- |iabSpecialFeatures|number\[] \|undefined|IAB TCF special feature IDs this script requires. Options: 1: Use precise geolocation data; 2: Actively scan device characteristics for identification|-|Optional|
152
-
153
- #### `onBeforeLoad`
154
-
155
- Callback executed before the script is loaded
156
-
157
- |Property|Type|Description|Default|Required|
158
- |:--|:--|:--|:--|:--:|
159
- |id|string|The original script ID|-|✅ Required|
160
- |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
161
- |hasConsent|boolean|Has consent|-|✅ Required|
162
- |consents|ConsentState|The current consent state|-|✅ Required|
163
- |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
164
- |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
165
-
166
- #### `onLoad`
167
-
168
- Callback executed when the script loads successfully
169
-
170
- |Property|Type|Description|Default|Required|
171
- |:--|:--|:--|:--|:--:|
172
- |id|string|The original script ID|-|✅ Required|
173
- |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
174
- |hasConsent|boolean|Has consent|-|✅ Required|
175
- |consents|ConsentState|The current consent state|-|✅ Required|
176
- |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
177
- |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
178
-
179
- #### `onError`
180
-
181
- Callback executed if the script fails to load
182
-
183
- |Property|Type|Description|Default|Required|
184
- |:--|:--|:--|:--|:--:|
185
- |id|string|The original script ID|-|✅ Required|
186
- |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
187
- |hasConsent|boolean|Has consent|-|✅ Required|
188
- |consents|ConsentState|The current consent state|-|✅ Required|
189
- |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
190
- |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
191
-
192
- #### `onConsentChange`
193
-
194
- Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
195
-
196
- |Property|Type|Description|Default|Required|
197
- |:--|:--|:--|:--|:--:|
198
- |id|string|The original script ID|-|✅ Required|
199
- |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
200
- |hasConsent|boolean|Has consent|-|✅ Required|
201
- |consents|ConsentState|The current consent state|-|✅ Required|
202
- |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
203
- |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
129
+ |Property|Value|
130
+ |:--|:--|
131
+ |Type Name|\`Script\`|
132
+ |Source Path|\`./packages/core/src/libs/script-loader/types.ts\`|
133
+
134
+ \*ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
@@ -0,0 +1,219 @@
1
+ ---
2
+ title: Heap
3
+ description: Load Heap with c15t and gate autocapture product analytics behind
4
+ measurement consent.
5
+ group: integrations
6
+ icon: heap
7
+ ---
8
+ [Heap](https://www.heap.io/) provides product analytics with automatic interaction capture, identity APIs, event properties, and pageview tracking. The `heap()` helper creates Heap's current heap.js v5 callback queue, records your environment ID and optional client configuration, and loads Heap only when `measurement` consent is available.
9
+
10
+ ## Integrate with c15t
11
+
12
+ **React**
13
+
14
+ ```tsx
15
+ import { type ReactNode } from 'react';
16
+ import { ConsentManagerProvider } from '@c15t/react';
17
+ import { heap } from '@c15t/scripts/heap';
18
+
19
+ const scripts = [
20
+ heap({
21
+ envId: 'YOUR_APP_ID',
22
+ clientConfig: {
23
+ disableTextCapture: true,
24
+ },
25
+ }),
26
+ ];
27
+
28
+ export function ConsentProvider({ children }: { children: ReactNode }) {
29
+ return (
30
+ <ConsentManagerProvider
31
+ options={{
32
+ mode: 'hosted',
33
+ backendURL: 'https://your-instance.c15t.dev',
34
+ scripts,
35
+ }}
36
+ >
37
+ {children}
38
+ </ConsentManagerProvider>
39
+ );
40
+ }
41
+ ```
42
+
43
+ **Next.js**
44
+
45
+ ```tsx
46
+ 'use client';
47
+
48
+ import { type ReactNode } from 'react';
49
+ import { ConsentManagerProvider } from '@c15t/nextjs';
50
+ import { heap } from '@c15t/scripts/heap';
51
+
52
+ const scripts = [
53
+ heap({
54
+ envId: 'YOUR_APP_ID',
55
+ clientConfig: {
56
+ disableTextCapture: true,
57
+ },
58
+ }),
59
+ ];
60
+
61
+ export function ConsentProvider({ children }: { children: ReactNode }) {
62
+ return (
63
+ <ConsentManagerProvider
64
+ options={{
65
+ mode: 'hosted',
66
+ backendURL: '/api/c15t',
67
+ scripts,
68
+ }}
69
+ >
70
+ {children}
71
+ </ConsentManagerProvider>
72
+ );
73
+ }
74
+ ```
75
+
76
+ **JavaScript**
77
+
78
+ ```ts
79
+ import { getOrCreateConsentRuntime } from 'c15t';
80
+ import { heap } from '@c15t/scripts/heap';
81
+
82
+ getOrCreateConsentRuntime({
83
+ mode: 'hosted',
84
+ backendURL: 'https://your-instance.c15t.dev',
85
+ scripts: [
86
+ heap({
87
+ envId: 'YOUR_APP_ID',
88
+ clientConfig: {
89
+ disableTextCapture: true,
90
+ },
91
+ }),
92
+ ],
93
+ });
94
+ ```
95
+
96
+ ## How c15t loads it
97
+
98
+ * **Category:** `measurement` (Analytics)
99
+ * **Loads when:** measurement consent is granted
100
+ * **On revocation:** unloaded - c15t removes the script element it created. `window.heap` and `window.heapReadyCb` remain until the next page load (c15t reloads the page on revocation by default), and Heap has no documented browser opt-out API — treat the load gate as the consent boundary.
101
+
102
+ The helper maps Heap's current web installation snippet into the manifest engine:
103
+
104
+ ```ts
105
+ heap({
106
+ envId: 'YOUR_APP_ID',
107
+ clientConfig: {
108
+ disableTextCapture: true,
109
+ },
110
+ });
111
+ ```
112
+
113
+ It creates `window.heapReadyCb` and `window.heap`, records:
114
+
115
+ ```ts
116
+ window.heap.envId = 'YOUR_APP_ID';
117
+ window.heap.appid = 'YOUR_APP_ID';
118
+ window.heap.clientConfig = {
119
+ disableTextCapture: true,
120
+ shouldFetchServerConfig: false,
121
+ };
122
+ ```
123
+
124
+ and loads:
125
+
126
+ ```txt
127
+ https://cdn.us.heap-api.com/config/YOUR_APP_ID/heap_config.js
128
+ ```
129
+
130
+ Heap's config script then chain-loads the versioned heap.js runtime for that environment. The official snippet stores queued calls as `{ name, fn }` records in `window.heapReadyCb`; c15t reproduces that callback queue instead of using tuple queues such as `['track', ...args]`.
131
+
132
+ `envId` is required and must be a non-empty string after trimming. Heap app IDs are commonly numeric strings, but Heap's public install docs describe the value as your app ID, so c15t does not enforce a numeric-only format.
133
+
134
+ ## Configure heap.js
135
+
136
+ Pass `clientConfig` as the second Heap load argument. Values must be JSON-serializable: plain objects, arrays, strings, finite numbers, booleans, and `null`.
137
+
138
+ ```ts
139
+ import { heap } from '@c15t/scripts/heap';
140
+
141
+ heap({
142
+ envId: 'YOUR_APP_ID',
143
+ clientConfig: {
144
+ disableTextCapture: true,
145
+ disableSessionReplay: true,
146
+ metadataStorage: 'localstorage',
147
+ },
148
+ });
149
+ ```
150
+
151
+ c15t always adds `shouldFetchServerConfig: false`, matching Heap's current installation snippet. Do not pass functions, Dates, Maps, Sets, class instances, symbols, `undefined`, `NaN`, or infinite numbers in `clientConfig`.
152
+
153
+ To proxy or self-host the config loader, pass a custom URL:
154
+
155
+ ```ts
156
+ heap({
157
+ envId: 'YOUR_APP_ID',
158
+ scriptUrl: 'https://analytics.example.com/heap_config.js',
159
+ });
160
+ ```
161
+
162
+ ## Consent behavior
163
+
164
+ c15t blocks Heap from loading until `measurement` consent is granted and unloads it on revocation. Heap autocaptures interactions when heap.js runs, and its web installation docs do not document a consent-mode-style runtime opt-out API that c15t can call to make an already-loaded SDK inert after consent is withdrawn.
165
+
166
+ That makes the consent gate on load the consent boundary: no Heap config loader, heap.js runtime, cookies, localStorage, automatic page tracking, or interaction capture should start before the user grants `measurement` consent. See the [RudderStack consent notes](/docs/integrations/rudderstack#consent-behavior) for the broader reasoning behind blocking SDK load when a vendor API cannot guarantee denied-by-default collection semantics.
167
+
168
+ ## Tracking events in your app
169
+
170
+ c15t gates Heap from loading until `measurement` consent is granted. Your application code that calls Heap's runtime API (`window.heap.track`, `identify`, etc.) is **not** automatically gated - `window.heap` does not exist until the script is loaded, so unguarded calls before consent throw.
171
+
172
+ Guard event calls by checking consent state. From React:
173
+
174
+ ```tsx
175
+ import { useCallback } from 'react';
176
+ import { useConsentManager } from '@c15t/react';
177
+
178
+ function SignupExample() {
179
+ const { has } = useConsentManager();
180
+
181
+ const trackSignup = useCallback(() => {
182
+ if (has('measurement')) {
183
+ window.heap?.track('Signup Completed', { plan: 'pro' });
184
+ }
185
+ }, [has]);
186
+ }
187
+ ```
188
+
189
+ From plain JavaScript:
190
+
191
+ ```ts
192
+ import { getOrCreateConsentRuntime } from 'c15t';
193
+
194
+ const { consentStore } = getOrCreateConsentRuntime();
195
+
196
+ if (consentStore.getState().has('measurement')) {
197
+ window.heap?.track('Signup Completed', { plan: 'pro' });
198
+ }
199
+ ```
200
+
201
+ ## Types
202
+
203
+ ### HeapOptions
204
+
205
+ |Property|Value|
206
+ |:--|:--|
207
+ |Type Name|\`HeapOptions\`|
208
+ |Source Path|\`./packages/scripts/src/vendors/analytics/heap.ts\`|
209
+
210
+ \*ExtractedTypeTable: Could not extract "HeapOptions" from "./packages/scripts/src/vendors/analytics/heap.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
211
+
212
+ ### Script
213
+
214
+ |Property|Value|
215
+ |:--|:--|
216
+ |Type Name|\`Script\`|
217
+ |Source Path|\`./packages/core/src/libs/script-loader/types.ts\`|
218
+
219
+ \*ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
@@ -0,0 +1,199 @@
1
+ ---
2
+ title: Hightouch
3
+ description: Load Hightouch Events with c15t and gate the browser SDK behind
4
+ measurement consent.
5
+ group: integrations
6
+ icon: hightouch
7
+ ---
8
+ [Hightouch Events](https://hightouch.com/docs/events/overview) collects customer behavior from websites and sends it into Hightouch for warehouse-backed analytics, activation, and real-time workflows. The `hightouch()` helper creates Hightouch's `window.htevents` queue, records the write key and optional API host for the standalone loader, optionally queues the initial `page()` call, and loads the browser SDK when `measurement` consent is available.
9
+
10
+ ## Integrate with c15t
11
+
12
+ **React**
13
+
14
+ ```tsx
15
+ import { type ReactNode } from 'react';
16
+ import { ConsentManagerProvider } from '@c15t/react';
17
+ import { hightouch } from '@c15t/scripts/hightouch';
18
+
19
+ const scripts = [
20
+ hightouch({
21
+ writeKey: 'WRITE_KEY',
22
+ apiHost: 'us-east-1.hightouch-events.com',
23
+ }),
24
+ ];
25
+
26
+ export function ConsentProvider({ children }: { children: ReactNode }) {
27
+ return (
28
+ <ConsentManagerProvider
29
+ options={{
30
+ mode: 'hosted',
31
+ backendURL: 'https://your-instance.c15t.dev',
32
+ scripts,
33
+ }}
34
+ >
35
+ {children}
36
+ </ConsentManagerProvider>
37
+ );
38
+ }
39
+ ```
40
+
41
+ **Next.js**
42
+
43
+ ```tsx
44
+ 'use client';
45
+
46
+ import { type ReactNode } from 'react';
47
+ import { ConsentManagerProvider } from '@c15t/nextjs';
48
+ import { hightouch } from '@c15t/scripts/hightouch';
49
+
50
+ const scripts = [
51
+ hightouch({
52
+ writeKey: 'WRITE_KEY',
53
+ apiHost: 'us-east-1.hightouch-events.com',
54
+ }),
55
+ ];
56
+
57
+ export function ConsentProvider({ children }: { children: ReactNode }) {
58
+ return (
59
+ <ConsentManagerProvider
60
+ options={{
61
+ mode: 'hosted',
62
+ backendURL: '/api/c15t',
63
+ scripts,
64
+ }}
65
+ >
66
+ {children}
67
+ </ConsentManagerProvider>
68
+ );
69
+ }
70
+ ```
71
+
72
+ **JavaScript**
73
+
74
+ ```ts
75
+ import { getOrCreateConsentRuntime } from 'c15t';
76
+ import { hightouch } from '@c15t/scripts/hightouch';
77
+
78
+ getOrCreateConsentRuntime({
79
+ mode: 'hosted',
80
+ backendURL: 'https://your-instance.c15t.dev',
81
+ scripts: [
82
+ hightouch({
83
+ writeKey: 'WRITE_KEY',
84
+ apiHost: 'us-east-1.hightouch-events.com',
85
+ }),
86
+ ],
87
+ });
88
+ ```
89
+
90
+ ## How c15t loads it
91
+
92
+ * **Category:** `measurement` (Analytics)
93
+ * **Loads when:** measurement consent is granted
94
+ * **On revocation:** unloaded - c15t removes the script element it created. The `window.htevents` runtime object is left in place until the next page load (c15t reloads the page on revocation by default), so treat the load gate as the consent boundary.
95
+
96
+ The helper maps Hightouch's browser snippet into the manifest engine:
97
+
98
+ ```ts
99
+ hightouch({
100
+ writeKey: 'WRITE_KEY',
101
+ apiHost: 'us-east-1.hightouch-events.com',
102
+ });
103
+ ```
104
+
105
+ It creates `window.htevents`, defines the official queue methods, queues:
106
+
107
+ ```ts
108
+ window.htevents.load('WRITE_KEY', {
109
+ apiHost: 'us-east-1.hightouch-events.com',
110
+ });
111
+ window.htevents.page();
112
+ ```
113
+
114
+ and loads:
115
+
116
+ ```txt
117
+ https://cdn.hightouch-events.com/browser/release/v1-latest/events.min.js
118
+ ```
119
+
120
+ `writeKey` is required and must be a non-empty string after trimming. `apiHost` is optional; Hightouch's SDK defaults to `us-east-1.hightouch-events.com`, so pass it only when your Event Source uses another region or a first-party tracking host.
121
+
122
+ ## Configure page tracking
123
+
124
+ By default the helper queues `htevents.page()` before the vendor bundle loads. If you want to handle page views yourself, set `trackPageView` to `false`.
125
+
126
+ ```ts
127
+ import { hightouch } from '@c15t/scripts/hightouch';
128
+
129
+ hightouch({
130
+ writeKey: 'WRITE_KEY',
131
+ trackPageView: false,
132
+ });
133
+ ```
134
+
135
+ To proxy or self-host the loader, pass a custom URL:
136
+
137
+ ```ts
138
+ hightouch({
139
+ writeKey: 'WRITE_KEY',
140
+ scriptUrl: 'https://analytics.example.com/events.min.js',
141
+ });
142
+ ```
143
+
144
+ ## Consent behavior
145
+
146
+ c15t blocks the Hightouch SDK from loading until `measurement` consent is granted and unloads it on revocation. Hightouch does not expose a browser API that prevents collection while loaded — the SDK writes identifiers and delivers events to Hightouch as soon as it runs — so gating the load is the only default that reliably honors missing or denied consent. See the [RudderStack consent notes](/docs/integrations/rudderstack#consent-behavior) for the full reasoning behind this model versus vendor consent-API mapping (as used for Google Tag Manager).
147
+
148
+ ## Tracking events in your app
149
+
150
+ c15t gates the Hightouch browser SDK from loading until `measurement` consent is granted. Your application code that calls Hightouch's runtime API (`window.htevents.track`, `identify`, etc.) is **not** automatically gated - `window.htevents` does not exist until c15t initializes the integration, so unguarded calls made before that (or while consent is denied) throw. Once the integration is initialized with consent, early calls queue normally until the SDK finishes loading.
151
+
152
+ Guard event calls by checking consent state. From React:
153
+
154
+ ```tsx
155
+ import { useCallback } from 'react';
156
+ import { useConsentManager } from '@c15t/react';
157
+
158
+ function SignupExample() {
159
+ const { has } = useConsentManager();
160
+
161
+ const trackSignup = useCallback(() => {
162
+ if (has('measurement')) {
163
+ window.htevents?.track('Signup Completed', { plan: 'pro' });
164
+ }
165
+ }, [has]);
166
+ }
167
+ ```
168
+
169
+ From plain JavaScript:
170
+
171
+ ```ts
172
+ import { getOrCreateConsentRuntime } from 'c15t';
173
+
174
+ const { consentStore } = getOrCreateConsentRuntime();
175
+
176
+ if (consentStore.getState().has('measurement')) {
177
+ window.htevents?.track('Signup Completed', { plan: 'pro' });
178
+ }
179
+ ```
180
+
181
+ ## Types
182
+
183
+ ### HightouchOptions
184
+
185
+ |Property|Value|
186
+ |:--|:--|
187
+ |Type Name|\`HightouchOptions\`|
188
+ |Source Path|\`./packages/scripts/src/vendors/analytics/hightouch.ts\`|
189
+
190
+ \*ExtractedTypeTable: Could not extract "HightouchOptions" from "./packages/scripts/src/vendors/analytics/hightouch.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
191
+
192
+ ### Script
193
+
194
+ |Property|Value|
195
+ |:--|:--|
196
+ |Type Name|\`Script\`|
197
+ |Source Path|\`./packages/core/src/libs/script-loader/types.ts\`|
198
+
199
+ \*ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
@@ -1,7 +1,8 @@
1
1
  ---
2
2
  title: Hotjar
3
- description: Product analytics and behavior insights with a prebuilt helper that seeds Hotjar globals before loading the vendor bundle.
4
- lastModified: 2026-05-10
3
+ description: Product analytics and behavior insights with a prebuilt helper that
4
+ seeds Hotjar globals before loading the vendor bundle.
5
+ group: integrations
5
6
  icon: hotjar
6
7
  ---
7
8
  Hotjar helps you understand behavior with heatmaps, session recordings, and feedback tools. The `hotjar()` helper sets up Hotjar's `_hjSettings` global and `hj` queue stub, then loads the vendor script once `measurement` consent is granted.
@@ -125,87 +126,18 @@ if (consentStore.getState().has('measurement')) {
125
126
 
126
127
  ### HotjarOptions
127
128
 
128
- |Property|Type|Description|Default|Required|
129
- |:--|:--|:--|:--|:--:|
130
- |siteId|string \|number|Your Hotjar site ID.|-|✅ Required|
131
- |version|number \|undefined|Hotjar script version.|6|Optional|
132
- |scriptUrl|string \|undefined|Hotjar loader URL.|-|Optional|
129
+ |Property|Value|
130
+ |:--|:--|
131
+ |Type Name|\`HotjarOptions\`|
132
+ |Source Path|\`./packages/scripts/src/vendors/analytics/hotjar.ts\`|
133
+
134
+ \*ExtractedTypeTable: Could not extract "HotjarOptions" from "./packages/scripts/src/vendors/analytics/hotjar.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
133
135
 
134
136
  ### Script
135
137
 
136
- |Property|Type|Description|Default|Required|
137
- |:--|:--|:--|:--|:--:|
138
- |id|string|Unique identifier for the script|-|✅ Required|
139
- |src|string \|undefined|URL of the script to load|-|Optional|
140
- |textContent|string \|undefined|Inline JavaScript code to execute|-|Optional|
141
- |category|HasCondition\<AllConsentNames>|Consent category or condition required to load this script|-|✅ Required|
142
- |callbackOnly|boolean \|undefined|Whether this is a callback-only script that doesn't need to load an external resource. When true, no script tag will be added to the DOM, only callbacks will be executed.|false|Optional|
143
- |persistAfterConsentRevoked|boolean \|undefined|Whether the script should persist after consent is revoked.|false|Optional|
144
- |alwaysLoad|boolean \|undefined|Whether the script should always load regardless of consent state. This is useful for scripts like Google Tag Manager or PostHog that manage their own consent state internally. The script will load immediately and never be unloaded based on consent changes. Note: When using this option, you are responsible for ensuring the script itself respects user consent preferences through its own consent management.|false|Optional|
145
- |fetchPriority|"high" \|"low" \|"auto" \|undefined|Priority hint for browser resource loading|-|Optional|
146
- |attributes|Record\<string, string> \|undefined|Additional attributes to add to the script element|-|Optional|
147
- |async|boolean \|undefined|Whether to use async loading|-|Optional|
148
- |defer|boolean \|undefined|Whether to defer script loading|-|Optional|
149
- |nonce|string \|undefined|Content Security Policy nonce|-|Optional|
150
- |anonymizeId|boolean \|undefined|Whether to use an anonymized ID for the script element, this helps ensure the script is not blocked by ad blockers|true|Optional|
151
- |target|"head" \|"body" \|undefined|Where to inject the script element in the DOM. Options: \`'head'\`: Scripts are appended to \`\<head>\` (default); \`'body'\`: Scripts are appended to \`\<body>\`|'head'|Optional|
152
- |onBeforeLoad|Object \|undefined|Callback executed before the script is loaded|-|Optional|
153
- |onLoad|Object \|undefined|Callback executed when the script loads successfully|-|Optional|
154
- |onError|Object \|undefined|Callback executed if the script fails to load|-|Optional|
155
- |onConsentChange|Object \|undefined|Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.|-|Optional|
156
- |vendorId|string \|number \|undefined|IAB TCF vendor ID - links script to a registered vendor. When in IAB mode, the script will only load if this vendor has consent. Takes precedence over \`category\` when in IAB mode. Use custom vendor IDs (string or number) to gate non-IAB vendors too.|-|Optional|
157
- |iabPurposes|number\[] \|undefined|IAB TCF purpose IDs this script requires consent for. When in IAB mode and no vendorId is set, the script will only load if ALL specified purposes have consent.|-|Optional|
158
- |iabLegIntPurposes|number\[] \|undefined|IAB TCF legitimate interest purpose IDs. These purposes can operate under legitimate interest instead of consent. The script loads if all iabPurposes have consent OR all iabLegIntPurposes have legitimate interest established.|-|Optional|
159
- |iabSpecialFeatures|number\[] \|undefined|IAB TCF special feature IDs this script requires. Options: 1: Use precise geolocation data; 2: Actively scan device characteristics for identification|-|Optional|
160
-
161
- #### `onBeforeLoad`
162
-
163
- Callback executed before the script is loaded
164
-
165
- |Property|Type|Description|Default|Required|
166
- |:--|:--|:--|:--|:--:|
167
- |id|string|The original script ID|-|✅ Required|
168
- |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
169
- |hasConsent|boolean|Has consent|-|✅ Required|
170
- |consents|ConsentState|The current consent state|-|✅ Required|
171
- |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
172
- |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
173
-
174
- #### `onLoad`
175
-
176
- Callback executed when the script loads successfully
177
-
178
- |Property|Type|Description|Default|Required|
179
- |:--|:--|:--|:--|:--:|
180
- |id|string|The original script ID|-|✅ Required|
181
- |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
182
- |hasConsent|boolean|Has consent|-|✅ Required|
183
- |consents|ConsentState|The current consent state|-|✅ Required|
184
- |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
185
- |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
186
-
187
- #### `onError`
188
-
189
- Callback executed if the script fails to load
190
-
191
- |Property|Type|Description|Default|Required|
192
- |:--|:--|:--|:--|:--:|
193
- |id|string|The original script ID|-|✅ Required|
194
- |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
195
- |hasConsent|boolean|Has consent|-|✅ Required|
196
- |consents|ConsentState|The current consent state|-|✅ Required|
197
- |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
198
- |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
199
-
200
- #### `onConsentChange`
201
-
202
- Callback executed whenever the consent store is changed. This callback only applies to scripts already loaded.
203
-
204
- |Property|Type|Description|Default|Required|
205
- |:--|:--|:--|:--|:--:|
206
- |id|string|The original script ID|-|✅ Required|
207
- |elementId|string|The actual DOM element ID used (anonymized if enabled)|-|✅ Required|
208
- |hasConsent|boolean|Has consent|-|✅ Required|
209
- |consents|ConsentState|The current consent state|-|✅ Required|
210
- |element|HTMLScriptElement \|undefined|The script element (for load/error callbacks) Will be undefined for callback-only scripts|-|Optional|
211
- |error|Error \|undefined|Error information (for error callbacks)|-|Optional|
138
+ |Property|Value|
139
+ |:--|:--|
140
+ |Type Name|\`Script\`|
141
+ |Source Path|\`./packages/core/src/libs/script-loader/types.ts\`|
142
+
143
+ \*ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*