@c15t/scripts 2.1.0 → 2.2.0-canary-20260804162155

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 (140) hide show
  1. package/AGENTS.md +62 -0
  2. package/README.md +32 -20
  3. package/dist/e2e-test-utils.cjs +51 -10
  4. package/dist/e2e-test-utils.js +37 -3
  5. package/dist/engine/compile.cjs +9 -5
  6. package/dist/engine/runtime.cjs +103 -17
  7. package/dist/engine/runtime.js +94 -12
  8. package/dist/registry.cjs +97 -12
  9. package/dist/registry.js +80 -0
  10. package/dist/resolve.cjs +9 -5
  11. package/dist/types.cjs +17 -13
  12. package/dist/vendors/_shared/attributes.cjs +13 -9
  13. package/dist/vendors/_shared/google-consent.cjs +14 -9
  14. package/dist/vendors/_shared/install-builders.cjs +12 -8
  15. package/dist/vendors/_shared/script-url.cjs +16 -12
  16. package/dist/vendors/ads-and-pixels/linkedin-insights.cjs +9 -5
  17. package/dist/vendors/ads-and-pixels/meta-pixel.cjs +13 -9
  18. package/dist/vendors/ads-and-pixels/microsoft-uet.cjs +11 -7
  19. package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +9 -5
  20. package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +11 -7
  21. package/dist/vendors/ads-and-pixels/tiktok-pixel.cjs +9 -5
  22. package/dist/vendors/ads-and-pixels/x-pixel.cjs +9 -5
  23. package/dist/vendors/analytics/adobe-analytics.cjs +90 -0
  24. package/dist/vendors/analytics/adobe-analytics.js +49 -0
  25. package/dist/vendors/analytics/ahrefs-analytics.cjs +11 -7
  26. package/dist/vendors/analytics/amplitude.cjs +193 -0
  27. package/dist/vendors/analytics/amplitude.js +134 -0
  28. package/dist/vendors/analytics/clearbit.cjs +69 -0
  29. package/dist/vendors/analytics/clearbit.js +28 -0
  30. package/dist/vendors/analytics/cloudflare-web-analytics.cjs +11 -7
  31. package/dist/vendors/analytics/databuddy.cjs +11 -7
  32. package/dist/vendors/analytics/fathom-analytics.cjs +11 -7
  33. package/dist/vendors/analytics/google-tag.cjs +11 -7
  34. package/dist/vendors/analytics/heap.cjs +181 -0
  35. package/dist/vendors/analytics/heap.js +134 -0
  36. package/dist/vendors/analytics/hightouch.cjs +153 -0
  37. package/dist/vendors/analytics/hightouch.js +109 -0
  38. package/dist/vendors/analytics/hotjar.cjs +11 -7
  39. package/dist/vendors/analytics/logrocket.cjs +99 -0
  40. package/dist/vendors/analytics/logrocket.js +58 -0
  41. package/dist/vendors/analytics/matomo-analytics.cjs +9 -5
  42. package/dist/vendors/analytics/microsoft-clarity.cjs +75 -47
  43. package/dist/vendors/analytics/microsoft-clarity.js +64 -40
  44. package/dist/vendors/analytics/mixpanel-analytics.cjs +31 -16
  45. package/dist/vendors/analytics/mixpanel-analytics.js +22 -11
  46. package/dist/vendors/analytics/pirsch.cjs +108 -0
  47. package/dist/vendors/analytics/pirsch.js +67 -0
  48. package/dist/vendors/analytics/plausible-analytics.cjs +9 -5
  49. package/dist/vendors/analytics/posthog.cjs +63 -27
  50. package/dist/vendors/analytics/posthog.js +52 -20
  51. package/dist/vendors/analytics/promptwatch.cjs +11 -7
  52. package/dist/vendors/analytics/rudderstack.cjs +227 -0
  53. package/dist/vendors/analytics/rudderstack.js +183 -0
  54. package/dist/vendors/analytics/rybbit-analytics.cjs +9 -5
  55. package/dist/vendors/analytics/segment.cjs +9 -5
  56. package/dist/vendors/analytics/umami-analytics.cjs +9 -5
  57. package/dist/vendors/analytics/vercel-analytics.cjs +11 -7
  58. package/dist/vendors/functional/crisp.cjs +9 -5
  59. package/dist/vendors/functional/intercom.cjs +11 -7
  60. package/dist/vendors/tag-managers/google-tag-manager.cjs +11 -7
  61. package/dist-types/registry.d.ts +313 -241
  62. package/dist-types/types.d.ts +46 -4
  63. package/dist-types/vendors/ads-and-pixels/linkedin-insights.d.ts +18 -18
  64. package/dist-types/vendors/ads-and-pixels/meta-pixel.d.ts +21 -21
  65. package/dist-types/vendors/ads-and-pixels/microsoft-uet.d.ts +32 -32
  66. package/dist-types/vendors/ads-and-pixels/reddit-pixel.d.ts +19 -19
  67. package/dist-types/vendors/ads-and-pixels/snapchat-pixel.d.ts +16 -16
  68. package/dist-types/vendors/ads-and-pixels/tiktok-pixel.d.ts +28 -28
  69. package/dist-types/vendors/ads-and-pixels/x-pixel.d.ts +13 -13
  70. package/dist-types/vendors/analytics/adobe-analytics.d.ts +75 -0
  71. package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +7 -7
  72. package/dist-types/vendors/analytics/amplitude.d.ts +234 -0
  73. package/dist-types/vendors/analytics/clearbit.d.ts +60 -0
  74. package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +7 -7
  75. package/dist-types/vendors/analytics/databuddy.d.ts +25 -25
  76. package/dist-types/vendors/analytics/fathom-analytics.d.ts +11 -11
  77. package/dist-types/vendors/analytics/google-tag.d.ts +17 -17
  78. package/dist-types/vendors/analytics/heap.d.ts +316 -0
  79. package/dist-types/vendors/analytics/hightouch.d.ts +285 -0
  80. package/dist-types/vendors/analytics/hotjar.d.ts +14 -14
  81. package/dist-types/vendors/analytics/logrocket.d.ts +101 -0
  82. package/dist-types/vendors/analytics/microsoft-clarity.d.ts +42 -30
  83. package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +40 -28
  84. package/dist-types/vendors/analytics/pirsch.d.ts +96 -0
  85. package/dist-types/vendors/analytics/plausible-analytics.d.ts +13 -13
  86. package/dist-types/vendors/analytics/posthog.d.ts +63 -45
  87. package/dist-types/vendors/analytics/promptwatch.d.ts +7 -7
  88. package/dist-types/vendors/analytics/rudderstack.d.ts +330 -0
  89. package/dist-types/vendors/analytics/rybbit-analytics.d.ts +18 -18
  90. package/dist-types/vendors/analytics/segment.d.ts +13 -13
  91. package/dist-types/vendors/analytics/umami-analytics.d.ts +12 -12
  92. package/dist-types/vendors/analytics/vercel-analytics.d.ts +16 -16
  93. package/dist-types/vendors/functional/crisp.d.ts +11 -11
  94. package/dist-types/vendors/functional/intercom.d.ts +16 -16
  95. package/dist-types/vendors/tag-managers/google-tag-manager.d.ts +18 -18
  96. package/docs/README.md +62 -0
  97. package/docs/frameworks/javascript/script-loader.md +356 -0
  98. package/docs/frameworks/next/script-loader.md +501 -0
  99. package/docs/frameworks/react/script-loader.md +555 -0
  100. package/docs/integrations/adobe-analytics.md +160 -0
  101. package/docs/integrations/ahrefs-analytics.md +157 -0
  102. package/docs/integrations/amplitude.md +230 -0
  103. package/docs/integrations/building-integrations.md +239 -0
  104. package/docs/integrations/clearbit.md +130 -0
  105. package/docs/integrations/cloudflare-web-analytics.md +126 -0
  106. package/docs/integrations/crisp.md +140 -0
  107. package/docs/integrations/databuddy.md +205 -0
  108. package/docs/integrations/fathom-analytics.md +150 -0
  109. package/docs/integrations/google-maps.md +263 -0
  110. package/docs/integrations/google-tag-manager.md +154 -0
  111. package/docs/integrations/google-tag.md +134 -0
  112. package/docs/integrations/heap.md +219 -0
  113. package/docs/integrations/hightouch.md +199 -0
  114. package/docs/integrations/hotjar.md +143 -0
  115. package/docs/integrations/intercom.md +144 -0
  116. package/docs/integrations/linkedin-insights.md +161 -0
  117. package/docs/integrations/logrocket.md +175 -0
  118. package/docs/integrations/matomo-analytics.md +171 -0
  119. package/docs/integrations/meta-pixel.md +412 -0
  120. package/docs/integrations/microsoft-clarity.md +173 -0
  121. package/docs/integrations/microsoft-uet.md +156 -0
  122. package/docs/integrations/mixpanel-analytics.md +130 -0
  123. package/docs/integrations/overview.md +149 -0
  124. package/docs/integrations/pirsch.md +142 -0
  125. package/docs/integrations/plausible-analytics.md +154 -0
  126. package/docs/integrations/posthog.md +258 -0
  127. package/docs/integrations/promptwatch.md +121 -0
  128. package/docs/integrations/reddit-pixel.md +241 -0
  129. package/docs/integrations/rudderstack.md +271 -0
  130. package/docs/integrations/rybbit-analytics.md +143 -0
  131. package/docs/integrations/segment.md +146 -0
  132. package/docs/integrations/snapchat-pixel.md +163 -0
  133. package/docs/integrations/tiktok-pixel.md +123 -0
  134. package/docs/integrations/umami-analytics.md +148 -0
  135. package/docs/integrations/vercel-analytics.md +141 -0
  136. package/docs/integrations/x-pixel.md +157 -0
  137. package/docs/integrations/youtube.md +193 -0
  138. package/docs/shared/react/guides/script-loader.md +311 -0
  139. package/package.json +61 -7
  140. package/readme.json +8 -4
@@ -0,0 +1,101 @@
1
+ import type { Script } from 'c15t';
2
+ declare global {
3
+ interface Window {
4
+ LogRocket?: {
5
+ init: (appId: string, options?: Record<string, unknown>) => void;
6
+ identify?: (id: string, traits?: Record<string, unknown>) => void;
7
+ track?: (event: string, properties?: Record<string, unknown>) => void;
8
+ getSessionURL?: (callback: (sessionUrl: string) => void) => void;
9
+ start?: () => void;
10
+ startNewSession?: () => void;
11
+ uninstall?: () => void;
12
+ };
13
+ }
14
+ }
15
+ /**
16
+ * LogRocket vendor manifest.
17
+ *
18
+ * Loads the browser SDK and initializes it after the loader fires its `load`
19
+ * event. LogRocket does not document a consent opt-out or stop-recording API
20
+ * for the web SDK, so c15t gates the loader on measurement consent and unloads
21
+ * the script element when that consent is revoked.
22
+ */
23
+ export declare const logRocketManifest: {
24
+ readonly kind: "c15t.vendor-manifest";
25
+ readonly schemaVersion: 1;
26
+ readonly vendor: 'logrocket';
27
+ readonly category: 'measurement';
28
+ readonly install: [{
29
+ readonly type: 'loadScript';
30
+ readonly src: '{{scriptUrl}}';
31
+ readonly attributes: {
32
+ readonly crossorigin: 'anonymous';
33
+ };
34
+ }];
35
+ readonly afterLoad: [{
36
+ readonly type: 'callGlobal';
37
+ readonly global: 'LogRocket';
38
+ readonly method: 'init';
39
+ readonly args: ["{{appId}}", "{{initOptions}}"];
40
+ }];
41
+ };
42
+ export interface LogRocketOptions {
43
+ /**
44
+ * Your LogRocket app ID in `org-slug/app-slug` format.
45
+ */
46
+ appId: string;
47
+ /**
48
+ * LogRocket init options passed as the second `LogRocket.init()` argument.
49
+ *
50
+ * The manifest engine serializes this object as a template variable, so use
51
+ * JSON-serializable values only (no functions, class instances, prototypes,
52
+ * `Map`, `Set`, or other non-JSON types).
53
+ */
54
+ initOptions?: Record<string, unknown>;
55
+ /**
56
+ * Custom LogRocket loader URL.
57
+ * @default 'https://cdn.logrocket.io/LogRocket.min.js'
58
+ */
59
+ scriptUrl?: string;
60
+ /**
61
+ * Proxied URL for LogRocket's asynchronously loaded logger bundle.
62
+ *
63
+ * LogRocket's proxy setup requires `window._lrAsyncScript` in addition to
64
+ * the main `scriptUrl`, because the SDK chain-loads its logger bundle from
65
+ * this location. Only needed when proxying traffic through your own
66
+ * domain.
67
+ *
68
+ * @see https://docs.logrocket.com/docs/proxying-traffic-through-your-own-domain
69
+ */
70
+ asyncScriptUrl?: string;
71
+ }
72
+ /**
73
+ * Creates a LogRocket script.
74
+ *
75
+ * @see https://docs.logrocket.com/reference/init
76
+ *
77
+ * @param options - The options for the LogRocket script.
78
+ * @returns The LogRocket script.
79
+ * @throws {Error} When `appId` is missing, empty, or not in `org/app` format.
80
+ * Provide the app ID from LogRocket Project Setup to prevent this error.
81
+ *
82
+ * @remarks
83
+ * LogRocket records session replay and monitoring data. Configure LogRocket's
84
+ * privacy and sanitization options before deployment so sensitive DOM, input,
85
+ * network, or application state data is excluded from recordings.
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * import { logRocket } from '@c15t/scripts/logrocket';
90
+ *
91
+ * logRocket({
92
+ * appId: 'org-slug/app-slug',
93
+ * initOptions: {
94
+ * dom: {
95
+ * inputSanitizer: true,
96
+ * },
97
+ * },
98
+ * });
99
+ * ```
100
+ */
101
+ export declare function logRocket(options: LogRocketOptions): Script;
@@ -1,7 +1,32 @@
1
1
  import type { Script } from 'c15t';
2
- export type ClarityConsentValue = boolean | Record<string, string>;
2
+ /**
3
+ * Microsoft Clarity Consent V2 storage state.
4
+ *
5
+ * Clarity accepts string consent values instead of booleans for its granular
6
+ * `ad_Storage` and `analytics_Storage` channels.
7
+ */
8
+ export type ClarityConsentState = 'granted' | 'denied';
9
+ /**
10
+ * Consent V2 payload sent to Microsoft Clarity.
11
+ *
12
+ * c15t maps `marketing` consent to `ad_Storage` and `measurement` consent to
13
+ * `analytics_Storage`.
14
+ */
15
+ export interface ClarityConsentV2Payload {
16
+ ad_Storage: ClarityConsentState;
17
+ analytics_Storage: ClarityConsentState;
18
+ }
19
+ /**
20
+ * Optional boot-time consent override accepted by the Clarity helper.
21
+ *
22
+ * Booleans apply the same value to both Clarity Consent V2 channels. Object
23
+ * values may use Clarity keys or c15t category aliases and are merged over the
24
+ * current c15t consent state.
25
+ */
26
+ export type ClarityConsentValue = boolean | Partial<Record<keyof ClarityConsentV2Payload | 'ad_storage' | 'analytics_storage' | 'marketing' | 'measurement' | 'analytics', ClarityConsentState | boolean>>;
3
27
  type ClarityFunction = {
4
- (command: 'consent', value?: ClarityConsentValue): void;
28
+ (command: 'consent', value?: boolean): void;
29
+ (command: 'consentv2', value: ClarityConsentV2Payload): void;
5
30
  (command: 'event', value: string): void;
6
31
  (command: 'identify', id: string, session?: string, page?: string): unknown;
7
32
  (command: 'set', key: string, value: string | string[]): void;
@@ -13,7 +38,6 @@ declare global {
13
38
  interface Window {
14
39
  clarity?: ClarityFunction & {
15
40
  q?: unknown[][];
16
- v?: string;
17
41
  };
18
42
  }
19
43
  }
@@ -21,41 +45,28 @@ declare global {
21
45
  * Microsoft Clarity vendor manifest.
22
46
  *
23
47
  * Seeds the global queue stub before loading the vendor bundle and uses
24
- * Clarity's consent API for simple granted and denied transitions.
48
+ * Clarity's Consent V2 API for granular analytics and ad storage transitions.
25
49
  */
26
50
  export declare const clarityManifest: {
27
- readonly vendor: "microsoft-clarity";
28
- readonly category: "measurement";
51
+ readonly kind: "c15t.vendor-manifest";
52
+ readonly schemaVersion: 1;
53
+ readonly vendor: 'microsoft-clarity';
54
+ readonly category: 'measurement';
29
55
  readonly persistAfterConsentRevoked: true;
30
56
  readonly bootstrap: [{
31
- readonly type: "defineStubFunction";
32
- readonly name: "clarity";
57
+ readonly type: 'defineStubFunction';
58
+ readonly name: 'clarity';
33
59
  readonly queue: {
34
- readonly property: "q";
35
- };
36
- readonly queueFormat: "array";
37
- readonly properties: {
38
- readonly v: "0.7.0";
60
+ readonly property: 'q';
39
61
  };
62
+ readonly queueFormat: 'array';
40
63
  readonly ifUndefined: true;
41
64
  }];
42
65
  readonly install: [{
43
- readonly type: "loadScript";
44
- readonly src: "{{scriptUrl}}";
66
+ readonly type: 'loadScript';
67
+ readonly src: '{{scriptUrl}}';
45
68
  readonly async: true;
46
69
  }];
47
- readonly onConsentGranted: [{
48
- readonly type: "callGlobal";
49
- readonly global: "clarity";
50
- readonly args: ["consent", true];
51
- }];
52
- readonly onConsentDenied: [{
53
- readonly type: "callGlobal";
54
- readonly global: "clarity";
55
- readonly args: ["consent", false];
56
- }];
57
- readonly kind: "c15t.vendor-manifest";
58
- readonly schemaVersion: 1;
59
70
  };
60
71
  export interface ClarityOptions {
61
72
  /**
@@ -64,10 +75,11 @@ export interface ClarityOptions {
64
75
  */
65
76
  id: string;
66
77
  /**
67
- * Optional initial consent value queued before the script loads.
78
+ * Optional initial Consent V2 value queued before the script loads.
68
79
  *
69
- * Object-shaped advanced consent vectors are supported only for this initial
70
- * boot-time value. Later c15t consent changes are mapped to simple booleans.
80
+ * By default, c15t maps `measurement` to `analytics_Storage` and `marketing`
81
+ * to `ad_Storage`. Pass this only when boot-time consent must override the
82
+ * current c15t consent state.
71
83
  */
72
84
  defaultConsent?: ClarityConsentValue;
73
85
  /** Clarity loader URL. */
@@ -9,61 +9,73 @@ declare global {
9
9
  register: (properties: Record<string, unknown>) => void;
10
10
  opt_in_tracking: () => void;
11
11
  opt_out_tracking: () => void;
12
+ /** Snippet version marker consumed by `init_from_snippet`. */
13
+ __SV?: number;
14
+ /** Pending `[token, config, instanceName]` init tuples consumed at SDK load. */
15
+ _i?: unknown[][];
12
16
  };
13
17
  }
14
18
  }
15
19
  /**
16
20
  * Mixpanel vendor manifest.
17
21
  *
22
+ * Implements the official snippet contract: the stub array carries the
23
+ * snippet version marker (`__SV`) and the pending `[token, config, 'mixpanel']`
24
+ * init tuple in `_i`, which `mixpanel-2-latest.min.js` consumes at load time via
25
+ * `init_from_snippet`. Without `__SV` the SDK logs "Mixpanel error: Version
26
+ * mismatch" and never initializes, silently dropping queued calls.
27
+ *
18
28
  * Mixpanel can stay loaded across consent changes and toggle tracking with its
19
29
  * own opt-in and opt-out APIs.
20
30
  */
21
31
  export declare const mixpanelAnalyticsManifest: {
22
- readonly vendor: "mixpanel-analytics";
23
- readonly category: "measurement";
32
+ readonly kind: "c15t.vendor-manifest";
33
+ readonly schemaVersion: 1;
34
+ readonly vendor: 'mixpanel-analytics';
35
+ readonly category: 'measurement';
24
36
  readonly alwaysLoad: true;
25
37
  readonly install: [{
26
- readonly type: "setGlobal";
27
- readonly name: "mixpanel";
38
+ readonly type: 'setGlobal';
39
+ readonly name: 'mixpanel';
28
40
  readonly value: readonly [];
29
41
  readonly ifUndefined: true;
30
42
  }, {
31
- readonly type: "defineQueueMethods";
32
- readonly target: "mixpanel";
43
+ readonly type: 'setGlobalPath';
44
+ readonly path: ["mixpanel", "__SV"];
45
+ readonly value: 1.2;
46
+ }, {
47
+ readonly type: 'setGlobalPath';
48
+ readonly path: ["mixpanel", "_i"];
49
+ readonly value: readonly [readonly ["{{token}}", "{{initOptions}}", "mixpanel"]];
50
+ }, {
51
+ readonly type: 'defineQueueMethods';
52
+ readonly target: 'mixpanel';
33
53
  readonly methods: ["track", "identify", "reset", "register", "opt_in_tracking", "opt_out_tracking"];
34
54
  }, {
35
- readonly type: "loadScript";
36
- readonly src: "{{scriptUrl}}";
55
+ readonly type: 'loadScript';
56
+ readonly src: '{{scriptUrl}}';
37
57
  readonly async: true;
38
58
  }];
39
- readonly afterLoad: [{
40
- readonly type: "callGlobal";
41
- readonly global: "mixpanel";
42
- readonly method: "init";
43
- readonly args: ["{{token}}", "{{initOptions}}"];
44
- }];
45
59
  readonly onLoadGranted: [{
46
- readonly type: "callGlobal";
47
- readonly global: "mixpanel";
48
- readonly method: "opt_in_tracking";
60
+ readonly type: 'callGlobal';
61
+ readonly global: 'mixpanel';
62
+ readonly method: 'opt_in_tracking';
49
63
  }];
50
64
  readonly onLoadDenied: [{
51
- readonly type: "callGlobal";
52
- readonly global: "mixpanel";
53
- readonly method: "opt_out_tracking";
65
+ readonly type: 'callGlobal';
66
+ readonly global: 'mixpanel';
67
+ readonly method: 'opt_out_tracking';
54
68
  }];
55
69
  readonly onConsentGranted: [{
56
- readonly type: "callGlobal";
57
- readonly global: "mixpanel";
58
- readonly method: "opt_in_tracking";
70
+ readonly type: 'callGlobal';
71
+ readonly global: 'mixpanel';
72
+ readonly method: 'opt_in_tracking';
59
73
  }];
60
74
  readonly onConsentDenied: [{
61
- readonly type: "callGlobal";
62
- readonly global: "mixpanel";
63
- readonly method: "opt_out_tracking";
75
+ readonly type: 'callGlobal';
76
+ readonly global: 'mixpanel';
77
+ readonly method: 'opt_out_tracking';
64
78
  }];
65
- readonly kind: "c15t.vendor-manifest";
66
- readonly schemaVersion: 1;
67
79
  };
68
80
  export interface MixpanelAnalyticsOptions {
69
81
  /** Your Mixpanel project token. */
@@ -0,0 +1,96 @@
1
+ import type { Script } from 'c15t';
2
+ declare global {
3
+ interface Window {
4
+ pirsch?: (eventName: string, options?: {
5
+ duration?: number;
6
+ meta?: Record<string, unknown>;
7
+ non_interactive?: boolean;
8
+ }) => Promise<null | undefined>;
9
+ pirschClearSession?: () => void;
10
+ pirschInit?: () => void;
11
+ pirschNotFound?: () => void;
12
+ }
13
+ }
14
+ /**
15
+ * Pirsch vendor manifest.
16
+ *
17
+ * Configures Pirsch through script attributes. Pirsch finds the script element
18
+ * by a fixed element id, so the `id` attribute is part of the loader contract.
19
+ */
20
+ export declare const pirschManifest: {
21
+ readonly kind: "c15t.vendor-manifest";
22
+ readonly schemaVersion: 1;
23
+ readonly vendor: 'pirsch';
24
+ readonly category: 'measurement';
25
+ readonly install: [{
26
+ readonly type: 'loadScript';
27
+ readonly src: '{{scriptUrl}}';
28
+ readonly defer: true;
29
+ readonly attributes: {
30
+ readonly id: '{{scriptElementId}}';
31
+ readonly 'data-code': '{{identificationCode}}';
32
+ readonly 'data-domain': '{{domain}}';
33
+ readonly 'data-dev': '{{dev}}';
34
+ readonly 'data-hit-endpoint': '{{hitEndpoint}}';
35
+ readonly 'data-event-endpoint': '{{eventEndpoint}}';
36
+ readonly 'data-disable-page-views': '{{disablePageViews}}';
37
+ };
38
+ }];
39
+ };
40
+ export interface PirschOptions {
41
+ /**
42
+ * Your Pirsch identification code.
43
+ */
44
+ identificationCode: string;
45
+ /**
46
+ * Additional dashboard domains, optionally including per-domain codes.
47
+ *
48
+ * Arrays are serialized as Pirsch's comma-separated `data-domain` value.
49
+ */
50
+ domain?: string | string[];
51
+ /**
52
+ * Enable localhost testing by rewriting the tracked hostname.
53
+ */
54
+ dev?: string;
55
+ /**
56
+ * Custom pageview endpoint.
57
+ */
58
+ hitEndpoint?: string;
59
+ /**
60
+ * Custom event endpoint.
61
+ */
62
+ eventEndpoint?: string;
63
+ /**
64
+ * Disable automatic pageview tracking.
65
+ */
66
+ disablePageViews?: boolean;
67
+ /**
68
+ * Load Pirsch's extended script variant.
69
+ */
70
+ extended?: boolean;
71
+ /**
72
+ * Custom loader URL.
73
+ */
74
+ scriptUrl?: string;
75
+ }
76
+ /**
77
+ * Creates a Pirsch Analytics script.
78
+ *
79
+ * @see https://docs.pirsch.io/get-started/frontend-integration
80
+ *
81
+ * @param options - The options for the Pirsch script.
82
+ * @returns The Pirsch script.
83
+ * @throws {Error} When `identificationCode` is missing, empty, or invalid.
84
+ * Provide a valid non-empty `identificationCode` string to prevent this error.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * import { pirsch } from '@c15t/scripts/pirsch';
89
+ *
90
+ * pirsch({
91
+ * identificationCode: 'YOUR_IDENTIFICATION_CODE',
92
+ * domain: 'rollup.example.com:ROLLUP_CODE',
93
+ * });
94
+ * ```
95
+ */
96
+ export declare function pirsch(options: PirschOptions): Script;
@@ -27,31 +27,31 @@ declare global {
27
27
  * unloaded when consent is revoked.
28
28
  */
29
29
  export declare const plausibleAnalyticsManifest: {
30
- readonly vendor: "plausible-analytics";
31
- readonly category: "measurement";
30
+ readonly kind: "c15t.vendor-manifest";
31
+ readonly schemaVersion: 1;
32
+ readonly vendor: 'plausible-analytics';
33
+ readonly category: 'measurement';
32
34
  readonly bootstrap: [{
33
- readonly type: "defineStubFunction";
34
- readonly name: "plausible";
35
+ readonly type: 'defineStubFunction';
36
+ readonly name: 'plausible';
35
37
  readonly queue: {
36
- readonly property: "q";
38
+ readonly property: 'q';
37
39
  };
38
- readonly queueFormat: "array";
40
+ readonly queueFormat: 'array';
39
41
  readonly properties: {
40
- readonly o: "{{initOptions}}";
42
+ readonly o: '{{initOptions}}';
41
43
  };
42
44
  readonly ifUndefined: true;
43
45
  }];
44
46
  readonly install: [{
45
- readonly type: "loadScript";
46
- readonly src: "{{scriptUrl}}";
47
+ readonly type: 'loadScript';
48
+ readonly src: '{{scriptUrl}}';
47
49
  readonly defer: true;
48
50
  readonly attributes: {
49
- readonly 'data-domain': "{{domain}}";
50
- readonly 'data-api': "{{apiAttribute}}";
51
+ readonly 'data-domain': '{{domain}}';
52
+ readonly 'data-api': '{{apiAttribute}}';
51
53
  };
52
54
  }];
53
- readonly kind: "c15t.vendor-manifest";
54
- readonly schemaVersion: 1;
55
55
  };
56
56
  export interface PlausibleAnalyticsOptions {
57
57
  /**
@@ -12,6 +12,12 @@ declare global {
12
12
  opt_out_capturing: () => void;
13
13
  get_explicit_consent_status: () => string;
14
14
  capture: (event: string, properties?: Record<string, unknown>) => void;
15
+ /**
16
+ * Pending `[token, config, instanceName]` init tuples, as seeded by
17
+ * the official PostHog snippet. `array.js` only installs its runtime
18
+ * over an existing `window.posthog` when this is an array.
19
+ */
20
+ _i?: unknown[][];
15
21
  };
16
22
  }
17
23
  }
@@ -25,73 +31,85 @@ export type PosthogLoadMode = 'always' | 'after-consent' | 'disabled';
25
31
  * measurement consent is granted.
26
32
  */
27
33
  export declare const posthogManifest: {
28
- readonly vendor: "posthog";
29
- readonly category: "measurement";
34
+ readonly kind: "c15t.vendor-manifest";
35
+ readonly schemaVersion: 1;
36
+ readonly vendor: 'posthog';
37
+ readonly category: 'measurement';
30
38
  readonly alwaysLoad: true;
31
39
  readonly bootstrap: [{
32
- readonly type: "setGlobal";
33
- readonly name: "posthog";
34
- readonly value: {};
40
+ readonly type: 'setGlobal';
41
+ readonly name: 'posthog';
42
+ readonly value: readonly [];
35
43
  readonly ifUndefined: true;
36
44
  }, {
37
- readonly type: "defineGlobalMethods";
38
- readonly target: "posthog";
45
+ readonly type: 'setGlobalPath';
46
+ readonly path: ["posthog", "_i"];
47
+ readonly value: readonly [readonly ["{{id}}", "{{initOptions}}", "posthog"]];
48
+ readonly ifGlobalIsQueue: true;
49
+ }, {
50
+ readonly type: 'setGlobalPath';
51
+ readonly path: ["posthog", "people"];
52
+ readonly value: readonly [];
53
+ readonly ifGlobalIsQueue: true;
54
+ }, {
55
+ readonly type: 'defineQueueMethods';
56
+ readonly target: 'posthog';
57
+ readonly methods: ["capture", "opt_in_capturing", "opt_out_capturing"];
58
+ }, {
59
+ readonly type: 'defineGlobalMethods';
60
+ readonly target: 'posthog';
61
+ readonly ifGlobalIsQueue: true;
39
62
  readonly methods: [{
40
- readonly name: "init";
41
- readonly behavior: "noop";
42
- }, {
43
- readonly name: "capture";
44
- readonly behavior: "noop";
63
+ readonly name: 'init';
64
+ readonly behavior: 'noop';
45
65
  }, {
46
- readonly name: "opt_in_capturing";
47
- readonly behavior: "noop";
48
- }, {
49
- readonly name: "opt_out_capturing";
50
- readonly behavior: "noop";
51
- }, {
52
- readonly name: "get_explicit_consent_status";
53
- readonly behavior: "return";
54
- readonly value: "pending";
66
+ readonly name: 'get_explicit_consent_status';
67
+ readonly behavior: 'return';
68
+ readonly value: 'pending';
55
69
  }];
56
70
  }];
57
71
  readonly install: [{
58
- readonly type: "loadScript";
59
- readonly src: "{{scriptUrl}}";
72
+ readonly type: 'loadScript';
73
+ readonly src: '{{scriptUrl}}';
60
74
  readonly async: true;
61
75
  readonly attributes: {
62
- readonly crossorigin: "anonymous";
63
- readonly 'data-api-host': "{{apiHost}}";
64
- readonly 'data-ui-host': "{{uiHost}}";
76
+ readonly crossorigin: 'anonymous';
77
+ readonly 'data-api-host': '{{apiHost}}';
78
+ readonly 'data-ui-host': '{{uiHost}}';
65
79
  };
66
80
  }];
67
- readonly afterLoad: [{
68
- readonly type: "callGlobal";
69
- readonly global: "posthog";
70
- readonly method: "init";
71
- readonly args: ["{{id}}", "{{initOptions}}"];
81
+ readonly onBeforeLoadGranted: [{
82
+ readonly type: 'pushToQueue';
83
+ readonly queue: 'posthog';
84
+ readonly value: readonly ["opt_in_capturing", {
85
+ readonly captureEventName: null;
86
+ }];
87
+ }];
88
+ readonly onBeforeLoadDenied: [{
89
+ readonly type: 'pushToQueue';
90
+ readonly queue: 'posthog';
91
+ readonly value: readonly ["opt_out_capturing"];
72
92
  }];
73
93
  readonly onLoadGranted: [{
74
- readonly type: "callGlobal";
75
- readonly global: "posthog";
76
- readonly method: "opt_in_capturing";
94
+ readonly type: 'callGlobal';
95
+ readonly global: 'posthog';
96
+ readonly method: 'opt_in_capturing';
77
97
  }];
78
98
  readonly onLoadDenied: [{
79
- readonly type: "callGlobal";
80
- readonly global: "posthog";
81
- readonly method: "opt_out_capturing";
99
+ readonly type: 'callGlobal';
100
+ readonly global: 'posthog';
101
+ readonly method: 'opt_out_capturing';
82
102
  }];
83
103
  readonly onConsentGranted: [{
84
- readonly type: "callGlobal";
85
- readonly global: "posthog";
86
- readonly method: "opt_in_capturing";
104
+ readonly type: 'callGlobal';
105
+ readonly global: 'posthog';
106
+ readonly method: 'opt_in_capturing';
87
107
  }];
88
108
  readonly onConsentDenied: [{
89
- readonly type: "callGlobal";
90
- readonly global: "posthog";
91
- readonly method: "opt_out_capturing";
109
+ readonly type: 'callGlobal';
110
+ readonly global: 'posthog';
111
+ readonly method: 'opt_out_capturing';
92
112
  }];
93
- readonly kind: "c15t.vendor-manifest";
94
- readonly schemaVersion: 1;
95
113
  };
96
114
  export interface PosthogConsentOptions {
97
115
  /**
@@ -5,18 +5,18 @@ import type { Script } from 'c15t';
5
5
  * Loads the Promptwatch client with your project id on the script element.
6
6
  */
7
7
  export declare const promptwatchManifest: {
8
- readonly vendor: "promptwatch";
9
- readonly category: "measurement";
8
+ readonly kind: "c15t.vendor-manifest";
9
+ readonly schemaVersion: 1;
10
+ readonly vendor: 'promptwatch';
11
+ readonly category: 'measurement';
10
12
  readonly install: [{
11
- readonly type: "loadScript";
12
- readonly src: "{{scriptUrl}}";
13
+ readonly type: 'loadScript';
14
+ readonly src: '{{scriptUrl}}';
13
15
  readonly async: true;
14
16
  readonly attributes: {
15
- readonly 'data-project-id': "{{projectId}}";
17
+ readonly 'data-project-id': '{{projectId}}';
16
18
  };
17
19
  }];
18
- readonly kind: "c15t.vendor-manifest";
19
- readonly schemaVersion: 1;
20
20
  };
21
21
  export interface PromptwatchOptions {
22
22
  /** Your Promptwatch project id (UUID from the Promptwatch dashboard). */