@c15t/scripts 2.0.1 → 2.2.0-canary-20260727202135
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 +62 -0
- package/README.md +41 -29
- package/dist/e2e-test-utils.cjs +51 -10
- package/dist/e2e-test-utils.js +37 -3
- package/dist/engine/compile.cjs +9 -5
- package/dist/engine/runtime.cjs +111 -17
- package/dist/engine/runtime.js +102 -12
- package/dist/registry.cjs +423 -0
- package/dist/registry.js +372 -0
- package/dist/resolve.cjs +9 -5
- package/dist/types.cjs +32 -10
- package/dist/types.js +10 -1
- package/dist/vendors/_shared/attributes.cjs +55 -0
- package/dist/vendors/_shared/attributes.js +14 -0
- package/dist/vendors/_shared/google-consent.cjs +69 -0
- package/dist/vendors/_shared/google-consent.js +27 -0
- package/dist/vendors/_shared/install-builders.cjs +59 -0
- package/dist/vendors/_shared/install-builders.js +21 -0
- package/dist/vendors/_shared/script-url.cjs +78 -0
- package/dist/vendors/_shared/script-url.js +28 -0
- package/dist/{linkedin-insights.cjs → vendors/ads-and-pixels/linkedin-insights.cjs} +11 -7
- package/dist/{linkedin-insights.js → vendors/ads-and-pixels/linkedin-insights.js} +2 -2
- package/dist/vendors/ads-and-pixels/meta-pixel.cjs +206 -0
- package/dist/vendors/ads-and-pixels/meta-pixel.js +153 -0
- package/dist/{microsoft-uet.cjs → vendors/ads-and-pixels/microsoft-uet.cjs} +42 -21
- package/dist/{microsoft-uet.js → vendors/ads-and-pixels/microsoft-uet.js} +31 -14
- package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +151 -0
- package/dist/vendors/ads-and-pixels/reddit-pixel.js +107 -0
- package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +131 -0
- package/dist/vendors/ads-and-pixels/snapchat-pixel.js +87 -0
- package/dist/{tiktok-pixel.cjs → vendors/ads-and-pixels/tiktok-pixel.cjs} +11 -7
- package/dist/{tiktok-pixel.js → vendors/ads-and-pixels/tiktok-pixel.js} +2 -2
- package/dist/{x-pixel.cjs → vendors/ads-and-pixels/x-pixel.cjs} +15 -8
- package/dist/{x-pixel.js → vendors/ads-and-pixels/x-pixel.js} +6 -3
- package/dist/vendors/analytics/adobe-analytics.cjs +90 -0
- package/dist/vendors/analytics/adobe-analytics.js +49 -0
- package/dist/vendors/analytics/ahrefs-analytics.cjs +68 -0
- package/dist/vendors/analytics/ahrefs-analytics.js +27 -0
- package/dist/vendors/analytics/amplitude.cjs +193 -0
- package/dist/vendors/analytics/amplitude.js +134 -0
- package/dist/vendors/analytics/clearbit.cjs +69 -0
- package/dist/vendors/analytics/clearbit.js +28 -0
- package/dist/vendors/analytics/cloudflare-web-analytics.cjs +73 -0
- package/dist/vendors/analytics/cloudflare-web-analytics.js +32 -0
- package/dist/{databuddy.cjs → vendors/analytics/databuddy.cjs} +14 -10
- package/dist/{databuddy.js → vendors/analytics/databuddy.js} +3 -3
- package/dist/vendors/analytics/fathom-analytics.cjs +76 -0
- package/dist/vendors/analytics/fathom-analytics.js +35 -0
- package/dist/{google-tag.cjs → vendors/analytics/google-tag.cjs} +18 -35
- package/dist/{google-tag.js → vendors/analytics/google-tag.js} +7 -28
- package/dist/vendors/analytics/heap.cjs +181 -0
- package/dist/vendors/analytics/heap.js +134 -0
- package/dist/vendors/analytics/hightouch.cjs +153 -0
- package/dist/vendors/analytics/hightouch.js +109 -0
- package/dist/vendors/analytics/hotjar.cjs +85 -0
- package/dist/vendors/analytics/hotjar.js +44 -0
- package/dist/vendors/analytics/logrocket.cjs +99 -0
- package/dist/vendors/analytics/logrocket.js +58 -0
- package/dist/vendors/analytics/matomo-analytics.cjs +232 -0
- package/dist/vendors/analytics/matomo-analytics.js +191 -0
- package/dist/vendors/analytics/microsoft-clarity.cjs +138 -0
- package/dist/vendors/analytics/microsoft-clarity.js +97 -0
- package/dist/vendors/analytics/mixpanel-analytics.cjs +134 -0
- package/dist/vendors/analytics/mixpanel-analytics.js +93 -0
- package/dist/vendors/analytics/pirsch.cjs +108 -0
- package/dist/vendors/analytics/pirsch.js +67 -0
- package/dist/vendors/analytics/plausible-analytics.cjs +122 -0
- package/dist/vendors/analytics/plausible-analytics.js +81 -0
- package/dist/vendors/analytics/posthog.cjs +204 -0
- package/dist/vendors/analytics/posthog.js +163 -0
- package/dist/vendors/analytics/promptwatch.cjs +70 -0
- package/dist/vendors/analytics/promptwatch.js +29 -0
- package/dist/vendors/analytics/rudderstack.cjs +227 -0
- package/dist/vendors/analytics/rudderstack.js +183 -0
- package/dist/vendors/analytics/rybbit-analytics.cjs +104 -0
- package/dist/vendors/analytics/rybbit-analytics.js +63 -0
- package/dist/vendors/analytics/segment.cjs +97 -0
- package/dist/vendors/analytics/segment.js +56 -0
- package/dist/vendors/analytics/umami-analytics.cjs +80 -0
- package/dist/vendors/analytics/umami-analytics.js +39 -0
- package/dist/vendors/analytics/vercel-analytics.cjs +94 -0
- package/dist/vendors/analytics/vercel-analytics.js +53 -0
- package/dist/vendors/functional/crisp.cjs +143 -0
- package/dist/vendors/functional/crisp.js +102 -0
- package/dist/vendors/functional/intercom.cjs +89 -0
- package/dist/vendors/functional/intercom.js +45 -0
- package/dist/{google-tag-manager.cjs → vendors/tag-managers/google-tag-manager.cjs} +17 -34
- package/dist/{google-tag-manager.js → vendors/tag-managers/google-tag-manager.js} +6 -27
- package/dist-types/__tests__/helpers.d.ts +141 -0
- package/dist-types/engine/runtime.d.ts +1 -1
- package/dist-types/registry.d.ts +440 -0
- package/dist-types/types.d.ts +53 -2
- package/dist-types/vendors/_shared/attributes.d.ts +35 -0
- package/dist-types/vendors/_shared/google-consent.d.ts +47 -0
- package/dist-types/vendors/_shared/install-builders.d.ts +30 -0
- package/dist-types/vendors/_shared/script-url.d.ts +75 -0
- package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +92 -0
- package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +289 -0
- package/dist-types/{microsoft-uet.d.ts → vendors/ads-and-pixels/microsoft-uet.d.ts} +45 -34
- package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +211 -0
- package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +171 -0
- package/dist-types/{tiktok-pixel.d.ts → vendors/ads-and-pixels/tiktok-pixel.d.ts} +48 -33
- package/dist-types/{x-pixel.d.ts → vendors/ads-and-pixels/x-pixel.d.ts} +34 -17
- package/dist-types/vendors/analytics/adobe-analytics.d.ts +75 -0
- package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +62 -0
- package/dist-types/vendors/analytics/amplitude.d.ts +234 -0
- package/dist-types/vendors/analytics/clearbit.d.ts +60 -0
- package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +67 -0
- package/dist-types/{databuddy.d.ts → vendors/analytics/databuddy.d.ts} +25 -25
- package/dist-types/vendors/analytics/fathom-analytics.d.ts +90 -0
- package/dist-types/{google-tag.d.ts → vendors/analytics/google-tag.d.ts} +21 -24
- package/dist-types/vendors/analytics/heap.d.ts +316 -0
- package/dist-types/vendors/analytics/hightouch.d.ts +285 -0
- package/dist-types/vendors/analytics/hotjar.d.ts +73 -0
- package/dist-types/vendors/analytics/logrocket.d.ts +101 -0
- package/dist-types/vendors/analytics/matomo-analytics.d.ts +41 -0
- package/dist-types/vendors/analytics/microsoft-clarity.d.ts +98 -0
- package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +113 -0
- package/dist-types/vendors/analytics/pirsch.d.ts +96 -0
- package/dist-types/vendors/analytics/plausible-analytics.d.ts +122 -0
- package/dist-types/vendors/analytics/posthog.d.ts +154 -0
- package/dist-types/vendors/analytics/promptwatch.d.ts +36 -0
- package/dist-types/vendors/analytics/rudderstack.d.ts +330 -0
- package/dist-types/vendors/analytics/rybbit-analytics.d.ts +82 -0
- package/dist-types/vendors/analytics/segment.d.ts +158 -0
- package/dist-types/vendors/analytics/umami-analytics.d.ts +93 -0
- package/dist-types/vendors/analytics/vercel-analytics.d.ts +66 -0
- package/dist-types/vendors/functional/crisp.d.ts +78 -0
- package/dist-types/vendors/functional/intercom.d.ts +135 -0
- package/dist-types/{google-tag-manager.d.ts → vendors/tag-managers/google-tag-manager.d.ts} +22 -25
- package/docs/README.md +62 -0
- package/docs/frameworks/javascript/script-loader.md +354 -0
- package/docs/frameworks/next/script-loader.md +499 -0
- package/docs/frameworks/react/script-loader.md +553 -0
- package/docs/integrations/adobe-analytics.md +160 -0
- package/docs/integrations/ahrefs-analytics.md +157 -0
- package/docs/integrations/amplitude.md +230 -0
- package/docs/integrations/building-integrations.md +239 -0
- package/docs/integrations/clearbit.md +130 -0
- package/docs/integrations/cloudflare-web-analytics.md +126 -0
- package/docs/integrations/crisp.md +140 -0
- package/docs/integrations/databuddy.md +205 -0
- package/docs/integrations/fathom-analytics.md +150 -0
- package/docs/integrations/google-maps.md +263 -0
- package/docs/integrations/google-tag-manager.md +154 -0
- package/docs/integrations/google-tag.md +134 -0
- package/docs/integrations/heap.md +219 -0
- package/docs/integrations/hightouch.md +199 -0
- package/docs/integrations/hotjar.md +143 -0
- package/docs/integrations/intercom.md +144 -0
- package/docs/integrations/linkedin-insights.md +161 -0
- package/docs/integrations/logrocket.md +175 -0
- package/docs/integrations/matomo-analytics.md +171 -0
- package/docs/integrations/meta-pixel.md +412 -0
- package/docs/integrations/microsoft-clarity.md +173 -0
- package/docs/integrations/microsoft-uet.md +156 -0
- package/docs/integrations/mixpanel-analytics.md +130 -0
- package/docs/integrations/overview.md +149 -0
- package/docs/integrations/pirsch.md +142 -0
- package/docs/integrations/plausible-analytics.md +154 -0
- package/docs/integrations/posthog.md +258 -0
- package/docs/integrations/promptwatch.md +121 -0
- package/docs/integrations/reddit-pixel.md +241 -0
- package/docs/integrations/rudderstack.md +271 -0
- package/docs/integrations/rybbit-analytics.md +143 -0
- package/docs/integrations/segment.md +146 -0
- package/docs/integrations/snapchat-pixel.md +163 -0
- package/docs/integrations/tiktok-pixel.md +123 -0
- package/docs/integrations/umami-analytics.md +148 -0
- package/docs/integrations/vercel-analytics.md +141 -0
- package/docs/integrations/x-pixel.md +157 -0
- package/docs/integrations/youtube.md +193 -0
- package/docs/shared/react/guides/script-loader.md +309 -0
- package/package.json +223 -8
- package/readme.json +8 -4
- package/dist/meta-pixel.cjs +0 -129
- package/dist/meta-pixel.js +0 -89
- package/dist/posthog.cjs +0 -137
- package/dist/posthog.js +0 -100
- package/dist-types/linkedin-insights.d.ts +0 -79
- package/dist-types/meta-pixel.d.ts +0 -185
- package/dist-types/posthog.d.ts +0 -112
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import type { Script } from 'c15t';
|
|
2
|
-
/**
|
|
3
|
-
* Represents the `contents` array object property.
|
|
4
|
-
*/
|
|
5
|
-
export interface FbqContent {
|
|
6
|
-
id: string | number;
|
|
7
|
-
quantity: number;
|
|
8
|
-
[key: string]: unknown;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Base interface for all possible event parameters.
|
|
12
|
-
* All properties are optional here; specific event types will make them required.
|
|
13
|
-
*/
|
|
14
|
-
export interface FbqBaseEventParams {
|
|
15
|
-
content_category?: string;
|
|
16
|
-
content_ids?: (string | number)[];
|
|
17
|
-
content_name?: string;
|
|
18
|
-
content_type?: 'product' | 'product_group';
|
|
19
|
-
contents?: FbqContent[];
|
|
20
|
-
currency?: string;
|
|
21
|
-
num_items?: number;
|
|
22
|
-
predicted_ltv?: number;
|
|
23
|
-
search_string?: string;
|
|
24
|
-
status?: boolean;
|
|
25
|
-
value?: number;
|
|
26
|
-
}
|
|
27
|
-
type AddPaymentInfoParams = Pick<FbqBaseEventParams, 'content_ids' | 'contents' | 'currency' | 'value'>;
|
|
28
|
-
type AddToCartParams = Pick<FbqBaseEventParams, 'content_ids' | 'content_type' | 'contents' | 'currency' | 'value'>;
|
|
29
|
-
type AddToWishlistParams = Pick<FbqBaseEventParams, 'content_ids' | 'contents' | 'currency' | 'value'>;
|
|
30
|
-
type CompleteRegistrationParams = Pick<FbqBaseEventParams, 'currency' | 'value' | 'status'>;
|
|
31
|
-
type InitiateCheckoutParams = Pick<FbqBaseEventParams, 'content_ids' | 'contents' | 'currency' | 'num_items' | 'value'>;
|
|
32
|
-
type LeadParams = Pick<FbqBaseEventParams, 'currency' | 'value'>;
|
|
33
|
-
type SearchParams = Pick<FbqBaseEventParams, 'content_ids' | 'content_type' | 'contents' | 'currency' | 'search_string' | 'value'>;
|
|
34
|
-
type StartTrialParams = Pick<FbqBaseEventParams, 'currency' | 'predicted_ltv' | 'value'>;
|
|
35
|
-
type SubscribeParams = Pick<FbqBaseEventParams, 'currency' | 'predicted_ltv' | 'value'>;
|
|
36
|
-
type ViewContentParams = Pick<FbqBaseEventParams, 'content_ids' | 'content_type' | 'contents' | 'currency' | 'value'>;
|
|
37
|
-
/**
|
|
38
|
-
* The 'Purchase' event has required properties.
|
|
39
|
-
* We use TypeScript's utility types to enforce this.
|
|
40
|
-
*/
|
|
41
|
-
type PurchaseParams = Pick<FbqBaseEventParams, 'content_ids' | 'content_type' | 'contents' | 'num_items'> & Required<Pick<FbqBaseEventParams, 'currency' | 'value'>>;
|
|
42
|
-
/**
|
|
43
|
-
* Events with no specific properties listed can accept any of the base parameters.
|
|
44
|
-
*/
|
|
45
|
-
type ContactParams = FbqBaseEventParams;
|
|
46
|
-
type CustomizeProductParams = FbqBaseEventParams;
|
|
47
|
-
type DonateParams = FbqBaseEventParams;
|
|
48
|
-
type FindLocationParams = FbqBaseEventParams;
|
|
49
|
-
type ScheduleParams = FbqBaseEventParams;
|
|
50
|
-
type SubmitApplicationParams = FbqBaseEventParams;
|
|
51
|
-
/**
|
|
52
|
-
* A mapping of Standard Event names to their corresponding parameter types.
|
|
53
|
-
* This is the core of our type-safety mechanism.
|
|
54
|
-
*/
|
|
55
|
-
export interface StandardEventParams {
|
|
56
|
-
AddPaymentInfo: AddPaymentInfoParams;
|
|
57
|
-
AddToCart: AddToCartParams;
|
|
58
|
-
AddToWishlist: AddToWishlistParams;
|
|
59
|
-
CompleteRegistration: CompleteRegistrationParams;
|
|
60
|
-
Contact: ContactParams;
|
|
61
|
-
CustomizeProduct: CustomizeProductParams;
|
|
62
|
-
Donate: DonateParams;
|
|
63
|
-
FindLocation: FindLocationParams;
|
|
64
|
-
InitiateCheckout: InitiateCheckoutParams;
|
|
65
|
-
Lead: LeadParams;
|
|
66
|
-
Purchase: PurchaseParams;
|
|
67
|
-
Schedule: ScheduleParams;
|
|
68
|
-
Search: SearchParams;
|
|
69
|
-
StartTrial: StartTrialParams;
|
|
70
|
-
SubmitApplication: SubmitApplicationParams;
|
|
71
|
-
Subscribe: SubscribeParams;
|
|
72
|
-
ViewContent: ViewContentParams;
|
|
73
|
-
}
|
|
74
|
-
export type StandardEventName = keyof StandardEventParams;
|
|
75
|
-
declare global {
|
|
76
|
-
interface Window {
|
|
77
|
-
fbq: {
|
|
78
|
-
(command: 'init', pixelId: string): void;
|
|
79
|
-
(command: 'track', eventName: StandardEventName, params?: StandardEventParams[StandardEventName], eventId?: string): void;
|
|
80
|
-
(command: 'consent', action: 'grant' | 'revoke'): void;
|
|
81
|
-
(...args: unknown[]): void;
|
|
82
|
-
};
|
|
83
|
-
_fbq: Window['fbq'];
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Meta Pixel vendor manifest.
|
|
88
|
-
*
|
|
89
|
-
* The Meta Pixel uses structured bootstrap steps to define the standard `fbq`
|
|
90
|
-
* stub and provides a consent API via `fbq('consent', 'grant'|'revoke')`.
|
|
91
|
-
*/
|
|
92
|
-
export declare const metaPixelManifest: {
|
|
93
|
-
readonly vendor: "meta-pixel";
|
|
94
|
-
readonly category: "marketing";
|
|
95
|
-
readonly persistAfterConsentRevoked: true;
|
|
96
|
-
readonly bootstrap: [{
|
|
97
|
-
readonly type: "defineStubFunction";
|
|
98
|
-
readonly name: "fbq";
|
|
99
|
-
readonly queue: {
|
|
100
|
-
readonly property: "queue";
|
|
101
|
-
};
|
|
102
|
-
readonly dispatchProperty: "callMethod";
|
|
103
|
-
readonly selfReferences: ["push"];
|
|
104
|
-
readonly aliases: ["_fbq"];
|
|
105
|
-
readonly properties: {
|
|
106
|
-
readonly loaded: true;
|
|
107
|
-
readonly version: "2.0";
|
|
108
|
-
};
|
|
109
|
-
readonly ifUndefined: true;
|
|
110
|
-
}];
|
|
111
|
-
readonly install: [{
|
|
112
|
-
readonly type: "callGlobal";
|
|
113
|
-
readonly global: "fbq";
|
|
114
|
-
readonly args: ["consent", "grant"];
|
|
115
|
-
}, {
|
|
116
|
-
readonly type: "callGlobal";
|
|
117
|
-
readonly global: "fbq";
|
|
118
|
-
readonly args: ["init", "{{pixelId}}"];
|
|
119
|
-
}, {
|
|
120
|
-
readonly type: "callGlobal";
|
|
121
|
-
readonly global: "fbq";
|
|
122
|
-
readonly args: ["track", "PageView"];
|
|
123
|
-
}, {
|
|
124
|
-
readonly type: "loadScript";
|
|
125
|
-
readonly src: "{{scriptSrc}}";
|
|
126
|
-
readonly async: true;
|
|
127
|
-
}];
|
|
128
|
-
readonly onConsentGranted: [{
|
|
129
|
-
readonly type: "callGlobal";
|
|
130
|
-
readonly global: "fbq";
|
|
131
|
-
readonly args: ["consent", "grant"];
|
|
132
|
-
}];
|
|
133
|
-
readonly onConsentDenied: [{
|
|
134
|
-
readonly type: "callGlobal";
|
|
135
|
-
readonly global: "fbq";
|
|
136
|
-
readonly args: ["consent", "revoke"];
|
|
137
|
-
}];
|
|
138
|
-
readonly kind: "c15t.vendor-manifest";
|
|
139
|
-
readonly schemaVersion: 1;
|
|
140
|
-
};
|
|
141
|
-
export interface MetaPixelOptions {
|
|
142
|
-
/**
|
|
143
|
-
* Your Meta Pixel ID
|
|
144
|
-
* @example `123456789012345`
|
|
145
|
-
*/
|
|
146
|
-
pixelId: string;
|
|
147
|
-
/** Meta Pixel loader URL. */
|
|
148
|
-
scriptSrc?: string;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Creates a Meta Pixel script.
|
|
152
|
-
*
|
|
153
|
-
* The manifest defines a structured `fbq` stub plus the external loader URL,
|
|
154
|
-
* avoiding raw inline vendor snippets in the manifest payload.
|
|
155
|
-
*
|
|
156
|
-
* @param options - The options for the Meta Pixel script
|
|
157
|
-
* @returns The Meta Pixel script configuration
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* ```ts
|
|
161
|
-
* const metaPixelScript = metaPixel({
|
|
162
|
-
* pixelId: '123456789012345',
|
|
163
|
-
* });
|
|
164
|
-
* ```
|
|
165
|
-
*
|
|
166
|
-
* @see {@link https://developers.facebook.com/docs/meta-pixel/get-started} Meta Pixel documentation
|
|
167
|
-
*/
|
|
168
|
-
export declare function metaPixel({ pixelId, scriptSrc }: MetaPixelOptions): Script;
|
|
169
|
-
/**
|
|
170
|
-
* Meta Pixel Event
|
|
171
|
-
* This is a wrapper around the `fbq` function that the Meta Pixel script uses.
|
|
172
|
-
*
|
|
173
|
-
* @param eventName - The event name to track
|
|
174
|
-
* @param params - Optional parameters to track
|
|
175
|
-
* @param eventId - Optional event ID to track (If using Conversion API)
|
|
176
|
-
*
|
|
177
|
-
* @usage
|
|
178
|
-
* ```ts
|
|
179
|
-
* metaPixelEvent('Purchase', { value: 10.0, currency: 'USD' });
|
|
180
|
-
* ```
|
|
181
|
-
*
|
|
182
|
-
* @see {@link https://developers.facebook.com/docs/meta-pixel/reference} Meta Pixel documentation
|
|
183
|
-
*/
|
|
184
|
-
export declare const metaPixelEvent: <TEventName extends StandardEventName>(eventName: TEventName, params?: StandardEventParams[TEventName], eventId?: string) => void;
|
|
185
|
-
export {};
|
package/dist-types/posthog.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import type { Script } from 'c15t';
|
|
2
|
-
declare global {
|
|
3
|
-
interface Window {
|
|
4
|
-
posthog: {
|
|
5
|
-
init: (token: string, options: {
|
|
6
|
-
api_host: string;
|
|
7
|
-
ui_host?: string;
|
|
8
|
-
autocapture?: boolean;
|
|
9
|
-
[key: string]: unknown;
|
|
10
|
-
}) => void;
|
|
11
|
-
opt_in_capturing: () => void;
|
|
12
|
-
opt_out_capturing: () => void;
|
|
13
|
-
get_explicit_consent_status: () => string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* PostHog vendor manifest.
|
|
19
|
-
*
|
|
20
|
-
* PostHog manages its own consent internally via opt_in/opt_out capturing.
|
|
21
|
-
* The script always loads, and consent is toggled via the PostHog API.
|
|
22
|
-
*/
|
|
23
|
-
export declare const posthogManifest: {
|
|
24
|
-
readonly vendor: "posthog";
|
|
25
|
-
readonly category: "measurement";
|
|
26
|
-
readonly alwaysLoad: true;
|
|
27
|
-
readonly bootstrap: [{
|
|
28
|
-
readonly type: "setGlobal";
|
|
29
|
-
readonly name: "posthog";
|
|
30
|
-
readonly value: {};
|
|
31
|
-
readonly ifUndefined: true;
|
|
32
|
-
}, {
|
|
33
|
-
readonly type: "defineGlobalMethods";
|
|
34
|
-
readonly target: "posthog";
|
|
35
|
-
readonly methods: [{
|
|
36
|
-
readonly name: "init";
|
|
37
|
-
readonly behavior: "noop";
|
|
38
|
-
}, {
|
|
39
|
-
readonly name: "opt_in_capturing";
|
|
40
|
-
readonly behavior: "noop";
|
|
41
|
-
}, {
|
|
42
|
-
readonly name: "opt_out_capturing";
|
|
43
|
-
readonly behavior: "noop";
|
|
44
|
-
}, {
|
|
45
|
-
readonly name: "get_explicit_consent_status";
|
|
46
|
-
readonly behavior: "return";
|
|
47
|
-
readonly value: "pending";
|
|
48
|
-
}];
|
|
49
|
-
}];
|
|
50
|
-
readonly install: [{
|
|
51
|
-
readonly type: "loadScript";
|
|
52
|
-
readonly src: "{{scriptUrl}}";
|
|
53
|
-
readonly async: true;
|
|
54
|
-
readonly attributes: {
|
|
55
|
-
readonly crossorigin: "anonymous";
|
|
56
|
-
readonly 'data-api-host': "{{apiHost}}";
|
|
57
|
-
readonly 'data-ui-host': "{{apiHost}}";
|
|
58
|
-
};
|
|
59
|
-
}];
|
|
60
|
-
readonly afterLoad: [{
|
|
61
|
-
readonly type: "callGlobal";
|
|
62
|
-
readonly global: "posthog";
|
|
63
|
-
readonly method: "init";
|
|
64
|
-
readonly args: ["{{id}}", "{{initOptions}}"];
|
|
65
|
-
}];
|
|
66
|
-
readonly onLoadGranted: [{
|
|
67
|
-
readonly type: "callGlobal";
|
|
68
|
-
readonly global: "posthog";
|
|
69
|
-
readonly method: "opt_in_capturing";
|
|
70
|
-
}];
|
|
71
|
-
readonly onLoadDenied: [{
|
|
72
|
-
readonly type: "callGlobal";
|
|
73
|
-
readonly global: "posthog";
|
|
74
|
-
readonly method: "opt_out_capturing";
|
|
75
|
-
}];
|
|
76
|
-
readonly onConsentGranted: [{
|
|
77
|
-
readonly type: "callGlobal";
|
|
78
|
-
readonly global: "posthog";
|
|
79
|
-
readonly method: "opt_in_capturing";
|
|
80
|
-
}];
|
|
81
|
-
readonly onConsentDenied: [{
|
|
82
|
-
readonly type: "callGlobal";
|
|
83
|
-
readonly global: "posthog";
|
|
84
|
-
readonly method: "opt_out_capturing";
|
|
85
|
-
}];
|
|
86
|
-
readonly kind: "c15t.vendor-manifest";
|
|
87
|
-
readonly schemaVersion: 1;
|
|
88
|
-
};
|
|
89
|
-
export interface PosthogConsentOptions {
|
|
90
|
-
/**
|
|
91
|
-
* Your posthog id, begins with 'phc_'.
|
|
92
|
-
*/
|
|
93
|
-
id: string;
|
|
94
|
-
/**
|
|
95
|
-
* Your posthog api host.
|
|
96
|
-
* @default 'https://eu.i.posthog.com'
|
|
97
|
-
*/
|
|
98
|
-
apiHost?: string;
|
|
99
|
-
/** The PostHog array loader URL. */
|
|
100
|
-
scriptUrl?: string;
|
|
101
|
-
/** PostHog init options passed to `posthog.init(...)`. */
|
|
102
|
-
initOptions?: Record<string, unknown>;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Loads the PostHog script and initializes it with the given options.
|
|
106
|
-
* This uses posthog.opt_in_capturing() to opt in to capturing. And posthog.opt_out_capturing() to opt out of capturing.
|
|
107
|
-
* @see https://posthog.com/docs/libraries/js#opt-in-capturing
|
|
108
|
-
*
|
|
109
|
-
* @param options - Optional configuration for the PostHog consent script
|
|
110
|
-
* @returns The Posthog script
|
|
111
|
-
*/
|
|
112
|
-
export declare function posthog(options: PosthogConsentOptions): Script;
|