@c15t/scripts 1.0.2-rc.0 → 1.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/databuddy.cjs +103 -48
- package/dist/databuddy.js +99 -47
- package/dist/engine/compile.cjs +126 -0
- package/dist/engine/compile.js +89 -0
- package/dist/engine/runtime.cjs +379 -0
- package/dist/engine/runtime.js +345 -0
- package/dist/google-tag-manager.cjs +78 -86
- package/dist/google-tag-manager.js +74 -79
- package/dist/google-tag.cjs +86 -37
- package/dist/google-tag.js +82 -36
- package/dist/linkedin-insights.cjs +51 -33
- package/dist/linkedin-insights.js +46 -31
- package/dist/meta-pixel.cjs +90 -28
- package/dist/meta-pixel.js +86 -27
- package/dist/microsoft-uet.cjs +90 -50
- package/dist/microsoft-uet.js +86 -49
- package/dist/posthog.cjs +100 -51
- package/dist/posthog.js +96 -50
- package/dist/resolve.cjs +67 -0
- package/dist/resolve.js +33 -0
- package/dist/tiktok-pixel.cjs +91 -29
- package/dist/tiktok-pixel.js +86 -27
- package/dist/types.cjs +47 -0
- package/dist/types.js +7 -0
- package/dist/x-pixel.cjs +48 -14
- package/dist/x-pixel.js +43 -12
- package/dist-types/databuddy.d.ts +81 -40
- package/dist-types/engine/compile.d.ts +3 -0
- package/dist-types/engine/runtime.d.ts +3 -0
- package/dist-types/engine.test.d.ts +1 -0
- package/dist-types/google-tag-manager.d.ts +65 -30
- package/dist-types/google-tag.d.ts +68 -9
- package/dist-types/helpers.test.d.ts +1 -0
- package/dist-types/linkedin-insights.d.ts +43 -11
- package/dist-types/meta-pixel.d.ts +62 -14
- package/dist-types/microsoft-uet.d.ts +66 -11
- package/dist-types/posthog.d.ts +78 -19
- package/dist-types/resolve.d.ts +9 -0
- package/dist-types/tiktok-pixel.d.ts +59 -11
- package/dist-types/types.d.ts +259 -0
- package/dist-types/x-pixel.d.ts +39 -12
- package/package.json +3 -3
|
@@ -1,10 +1,56 @@
|
|
|
1
|
-
import type { AllConsentNames, Script } from '
|
|
1
|
+
import type { AllConsentNames, Script } from 'c15t';
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
dataLayer: unknown[];
|
|
5
5
|
gtag: (...args: unknown[]) => void;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Google Tag (gtag.js) vendor manifest.
|
|
10
|
+
*
|
|
11
|
+
* Similar to GTM but for direct Google product integration (Analytics, Ads, Floodlight).
|
|
12
|
+
* Uses the same Consent Mode v2 mapping.
|
|
13
|
+
*/
|
|
14
|
+
export declare const gtagManifest: {
|
|
15
|
+
readonly vendor: "gtag";
|
|
16
|
+
readonly category: "{{category}}";
|
|
17
|
+
readonly alwaysLoad: true;
|
|
18
|
+
readonly persistAfterConsentRevoked: true;
|
|
19
|
+
readonly bootstrap: [{
|
|
20
|
+
readonly type: "setGlobal";
|
|
21
|
+
readonly name: "dataLayer";
|
|
22
|
+
readonly value: readonly [];
|
|
23
|
+
readonly ifUndefined: true;
|
|
24
|
+
}, {
|
|
25
|
+
readonly type: "defineQueueFunction";
|
|
26
|
+
readonly name: "gtag";
|
|
27
|
+
readonly queue: "dataLayer";
|
|
28
|
+
readonly ifUndefined: true;
|
|
29
|
+
}];
|
|
30
|
+
readonly install: [{
|
|
31
|
+
readonly type: "callGlobal";
|
|
32
|
+
readonly global: "gtag";
|
|
33
|
+
readonly args: ["js", "{{loadTime}}"];
|
|
34
|
+
}, {
|
|
35
|
+
readonly type: "callGlobal";
|
|
36
|
+
readonly global: "gtag";
|
|
37
|
+
readonly args: ["config", "{{id}}"];
|
|
38
|
+
}, {
|
|
39
|
+
readonly type: "loadScript";
|
|
40
|
+
readonly src: "https://www.googletagmanager.com/gtag/js?id={{id}}";
|
|
41
|
+
readonly async: true;
|
|
42
|
+
}];
|
|
43
|
+
readonly consentMapping: {
|
|
44
|
+
readonly necessary: ["security_storage"];
|
|
45
|
+
readonly functionality: ["functionality_storage"];
|
|
46
|
+
readonly measurement: ["analytics_storage"];
|
|
47
|
+
readonly marketing: ["ad_storage", "ad_user_data", "ad_personalization"];
|
|
48
|
+
readonly experience: ["personalization_storage"];
|
|
49
|
+
};
|
|
50
|
+
readonly consentSignal: "gtag";
|
|
51
|
+
readonly kind: "c15t.vendor-manifest";
|
|
52
|
+
readonly schemaVersion: 1;
|
|
53
|
+
};
|
|
8
54
|
export interface GtagOptions {
|
|
9
55
|
/**
|
|
10
56
|
* Your gtag id
|
|
@@ -17,15 +63,28 @@ export interface GtagOptions {
|
|
|
17
63
|
*/
|
|
18
64
|
category: AllConsentNames;
|
|
19
65
|
/**
|
|
20
|
-
*
|
|
66
|
+
* Custom mapping from c15t consent categories to Google Consent Mode v2 types.
|
|
67
|
+
* Overrides the default mapping when provided.
|
|
68
|
+
*
|
|
69
|
+
* @default
|
|
70
|
+
* ```ts
|
|
71
|
+
* {
|
|
72
|
+
* necessary: ['security_storage'],
|
|
73
|
+
* functionality: ['functionality_storage'],
|
|
74
|
+
* measurement: ['analytics_storage'],
|
|
75
|
+
* marketing: ['ad_storage', 'ad_user_data', 'ad_personalization'],
|
|
76
|
+
* experience: ['personalization_storage'],
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
consentMapping?: Record<string, string[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Deprecated script-level overrides preserved for backwards compatibility.
|
|
21
83
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* - `src`: `https://www.googletagmanager.com/gtag/js?id=${id}`
|
|
25
|
-
* - `async`: true
|
|
26
|
-
* - `alwaysLoad`: true
|
|
84
|
+
* Prefer manifest-backed options instead of this generic override bag.
|
|
85
|
+
* @deprecated
|
|
27
86
|
*/
|
|
28
|
-
script?: Partial<
|
|
87
|
+
script?: Partial<Script>;
|
|
29
88
|
}
|
|
30
89
|
/**
|
|
31
90
|
* Creates a Google Tag (gtag.js) script.
|
|
@@ -34,4 +93,4 @@ export interface GtagOptions {
|
|
|
34
93
|
* @param options - The options for the gtag script.
|
|
35
94
|
* @returns The Google Tag Manager script.
|
|
36
95
|
*/
|
|
37
|
-
export declare function gtag({ id, script,
|
|
96
|
+
export declare function gtag({ id, category, consentMapping, script, }: GtagOptions): Script;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Script } from '
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
lintrk: ((...args: unknown[]) => void) & {
|
|
@@ -13,21 +13,53 @@ declare global {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* LinkedIn Insights vendor manifest.
|
|
18
|
+
*
|
|
19
|
+
* Sets up the LinkedIn partner ID globals and loads the insights script
|
|
20
|
+
* via structured startup steps.
|
|
21
|
+
*/
|
|
22
|
+
export declare const linkedinInsightsManifest: {
|
|
23
|
+
readonly vendor: "linkedin-insights";
|
|
24
|
+
readonly category: "marketing";
|
|
25
|
+
readonly install: [{
|
|
26
|
+
readonly type: "setGlobal";
|
|
27
|
+
readonly name: "_linkedin_partner_id";
|
|
28
|
+
readonly value: "{{id}}";
|
|
29
|
+
readonly ifUndefined: false;
|
|
30
|
+
}, {
|
|
31
|
+
readonly type: "setGlobal";
|
|
32
|
+
readonly name: "_linkedin_data_partner_ids";
|
|
33
|
+
readonly value: readonly [];
|
|
34
|
+
readonly ifUndefined: true;
|
|
35
|
+
}, {
|
|
36
|
+
readonly type: "pushToQueue";
|
|
37
|
+
readonly queue: "_linkedin_data_partner_ids";
|
|
38
|
+
readonly value: "{{id}}";
|
|
39
|
+
}, {
|
|
40
|
+
readonly type: "defineStubFunction";
|
|
41
|
+
readonly name: "lintrk";
|
|
42
|
+
readonly queue: {
|
|
43
|
+
readonly property: "q";
|
|
44
|
+
};
|
|
45
|
+
readonly queueFormat: "array";
|
|
46
|
+
readonly ifUndefined: true;
|
|
47
|
+
}, {
|
|
48
|
+
readonly type: "loadScript";
|
|
49
|
+
readonly src: "{{scriptSrc}}";
|
|
50
|
+
readonly async: true;
|
|
51
|
+
}];
|
|
52
|
+
readonly kind: "c15t.vendor-manifest";
|
|
53
|
+
readonly schemaVersion: 1;
|
|
54
|
+
};
|
|
16
55
|
export interface LinkedInInsightsOptions {
|
|
17
56
|
/**
|
|
18
57
|
* Your LinkedIn Insights ID
|
|
19
58
|
* @example `123456789012345`
|
|
20
59
|
*/
|
|
21
60
|
id: string;
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
* Default values:
|
|
26
|
-
* - `id`: 'linkedin-insights'
|
|
27
|
-
* - `src`: `https://snap.licdn.com/li.lms-analytics/insight.min.js`
|
|
28
|
-
* - `category`: 'marketing'
|
|
29
|
-
*/
|
|
30
|
-
script?: Partial<Script>;
|
|
61
|
+
/** LinkedIn Insights loader URL. */
|
|
62
|
+
scriptSrc?: string;
|
|
31
63
|
}
|
|
32
64
|
/**
|
|
33
65
|
* LinkedIn Insights Script
|
|
@@ -44,4 +76,4 @@ export interface LinkedInInsightsOptions {
|
|
|
44
76
|
*
|
|
45
77
|
* @see {@link https://business.linkedin.com/marketing-solutions/ad-libraries/insights} LinkedIn Insights documentation
|
|
46
78
|
*/
|
|
47
|
-
export declare function linkedinInsights({ id,
|
|
79
|
+
export declare function linkedinInsights({ id, scriptSrc, }: LinkedInInsightsOptions): Script;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Script } from '
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
2
|
/**
|
|
3
3
|
* Represents the `contents` array object property.
|
|
4
4
|
*/
|
|
@@ -83,27 +83,75 @@ declare global {
|
|
|
83
83
|
_fbq: Window['fbq'];
|
|
84
84
|
}
|
|
85
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
|
+
};
|
|
86
141
|
export interface MetaPixelOptions {
|
|
87
142
|
/**
|
|
88
143
|
* Your Meta Pixel ID
|
|
89
144
|
* @example `123456789012345`
|
|
90
145
|
*/
|
|
91
146
|
pixelId: string;
|
|
92
|
-
/**
|
|
93
|
-
|
|
94
|
-
*
|
|
95
|
-
* Default values:
|
|
96
|
-
* - `id`: 'meta-pixel'
|
|
97
|
-
* - `src`: `https://connect.facebook.net/en_US/fbevents.js`
|
|
98
|
-
* - `category`: 'marketing'
|
|
99
|
-
*/
|
|
100
|
-
script?: Partial<Script>;
|
|
147
|
+
/** Meta Pixel loader URL. */
|
|
148
|
+
scriptSrc?: string;
|
|
101
149
|
}
|
|
102
150
|
/**
|
|
103
|
-
* Creates a Meta Pixel script
|
|
151
|
+
* Creates a Meta Pixel script.
|
|
104
152
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
153
|
+
* The manifest defines a structured `fbq` stub plus the external loader URL,
|
|
154
|
+
* avoiding raw inline vendor snippets in the manifest payload.
|
|
107
155
|
*
|
|
108
156
|
* @param options - The options for the Meta Pixel script
|
|
109
157
|
* @returns The Meta Pixel script configuration
|
|
@@ -117,7 +165,7 @@ export interface MetaPixelOptions {
|
|
|
117
165
|
*
|
|
118
166
|
* @see {@link https://developers.facebook.com/docs/meta-pixel/get-started} Meta Pixel documentation
|
|
119
167
|
*/
|
|
120
|
-
export declare function metaPixel({ pixelId,
|
|
168
|
+
export declare function metaPixel({ pixelId, scriptSrc }: MetaPixelOptions): Script;
|
|
121
169
|
/**
|
|
122
170
|
* Meta Pixel Event
|
|
123
171
|
* This is a wrapper around the `fbq` function that the Meta Pixel script uses.
|
|
@@ -1,24 +1,79 @@
|
|
|
1
|
-
import type { Script } from '
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
uetq: unknown[] | undefined;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Microsoft UET vendor manifest.
|
|
9
|
+
*
|
|
10
|
+
* Uses structured startup steps and manages consent via the UET push API:
|
|
11
|
+
* `window.uetq.push('consent', 'default'|'update', { ad_storage: 'granted'|'denied' })`
|
|
12
|
+
*/
|
|
13
|
+
export declare const microsoftUetManifest: {
|
|
14
|
+
readonly vendor: "microsoft-uet";
|
|
15
|
+
readonly category: "marketing";
|
|
16
|
+
readonly persistAfterConsentRevoked: true;
|
|
17
|
+
readonly bootstrap: [{
|
|
18
|
+
readonly type: "setGlobal";
|
|
19
|
+
readonly name: "uetq";
|
|
20
|
+
readonly value: readonly [];
|
|
21
|
+
readonly ifUndefined: true;
|
|
22
|
+
}];
|
|
23
|
+
readonly install: [{
|
|
24
|
+
readonly type: "loadScript";
|
|
25
|
+
readonly src: "{{scriptSrc}}";
|
|
26
|
+
readonly async: true;
|
|
27
|
+
}];
|
|
28
|
+
readonly afterLoad: [{
|
|
29
|
+
readonly type: "constructGlobal";
|
|
30
|
+
readonly constructor: "UET";
|
|
31
|
+
readonly assignTo: "uetq";
|
|
32
|
+
readonly args: [{
|
|
33
|
+
readonly ti: "{{id}}";
|
|
34
|
+
readonly enableAutoSpaTracking: true;
|
|
35
|
+
}];
|
|
36
|
+
readonly copyAssignedValueToArgProperty: "q";
|
|
37
|
+
}, {
|
|
38
|
+
readonly type: "callGlobal";
|
|
39
|
+
readonly global: "uetq";
|
|
40
|
+
readonly method: "push";
|
|
41
|
+
readonly args: ["pageLoad"];
|
|
42
|
+
}, {
|
|
43
|
+
readonly type: "callGlobal";
|
|
44
|
+
readonly global: "uetq";
|
|
45
|
+
readonly method: "push";
|
|
46
|
+
readonly args: ["consent", "default", {
|
|
47
|
+
readonly ad_storage: "granted";
|
|
48
|
+
}];
|
|
49
|
+
}];
|
|
50
|
+
readonly onConsentGranted: [{
|
|
51
|
+
readonly type: "callGlobal";
|
|
52
|
+
readonly global: "uetq";
|
|
53
|
+
readonly method: "push";
|
|
54
|
+
readonly args: ["consent", "update", {
|
|
55
|
+
readonly ad_storage: "granted";
|
|
56
|
+
}];
|
|
57
|
+
}];
|
|
58
|
+
readonly onConsentDenied: [{
|
|
59
|
+
readonly type: "callGlobal";
|
|
60
|
+
readonly global: "uetq";
|
|
61
|
+
readonly method: "push";
|
|
62
|
+
readonly args: ["consent", "update", {
|
|
63
|
+
readonly ad_storage: "denied";
|
|
64
|
+
}];
|
|
65
|
+
}];
|
|
66
|
+
readonly kind: "c15t.vendor-manifest";
|
|
67
|
+
readonly schemaVersion: 1;
|
|
68
|
+
};
|
|
7
69
|
export interface MicrosoftUetOptions {
|
|
8
70
|
/**
|
|
9
71
|
* Your Microsoft UET ID
|
|
10
72
|
* @example `123456789012345`
|
|
11
73
|
*/
|
|
12
74
|
id: string;
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
*
|
|
16
|
-
* Default values:
|
|
17
|
-
* - `id`: 'microsoft-uet'
|
|
18
|
-
* - `src`: `//bat.bing.com/bat.js`
|
|
19
|
-
* - `category`: 'marketing'
|
|
20
|
-
*/
|
|
21
|
-
script?: Partial<Script>;
|
|
75
|
+
/** Microsoft UET loader URL. */
|
|
76
|
+
scriptSrc?: string;
|
|
22
77
|
}
|
|
23
78
|
/**
|
|
24
79
|
* Microsoft UET Script
|
|
@@ -36,4 +91,4 @@ export interface MicrosoftUetOptions {
|
|
|
36
91
|
*
|
|
37
92
|
* @see https://learn.microsoft.com/en-us/advertising/guides/universal-event-tracking?view=bingads-13
|
|
38
93
|
*/
|
|
39
|
-
export declare function microsoftUet({ id,
|
|
94
|
+
export declare function microsoftUet({ id, scriptSrc }: MicrosoftUetOptions): Script;
|
package/dist-types/posthog.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Script } from '
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
posthog: {
|
|
@@ -14,6 +14,78 @@ declare global {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
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
|
+
};
|
|
17
89
|
export interface PosthogConsentOptions {
|
|
18
90
|
/**
|
|
19
91
|
* Your posthog id, begins with 'phc_'.
|
|
@@ -23,24 +95,11 @@ export interface PosthogConsentOptions {
|
|
|
23
95
|
* Your posthog api host.
|
|
24
96
|
* @default 'https://eu.i.posthog.com'
|
|
25
97
|
*/
|
|
26
|
-
apiHost
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Other optional options for the posthog script.
|
|
33
|
-
* @example { person_profiles: 'identified_only' }
|
|
34
|
-
*/
|
|
35
|
-
options: Record<string, unknown>;
|
|
36
|
-
/**
|
|
37
|
-
* Override or extend the default script values.
|
|
38
|
-
*
|
|
39
|
-
* Default values:
|
|
40
|
-
* - `id`: 'posthog-consent'
|
|
41
|
-
* - `category`: 'measurement'
|
|
42
|
-
*/
|
|
43
|
-
script?: Partial<Script>;
|
|
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>;
|
|
44
103
|
}
|
|
45
104
|
/**
|
|
46
105
|
* Loads the PostHog script and initializes it with the given options.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
import type { VendorManifest } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Compiles a `VendorManifest` + config into a `Script` object.
|
|
5
|
+
*
|
|
6
|
+
* This compatibility wrapper preserves the existing public resolver API while
|
|
7
|
+
* delegating to the new compile and runtime conversion phases internally.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveManifest(manifest: VendorManifest, config?: Record<string, unknown>): Script;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Script } from '
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
ttq: {
|
|
@@ -8,21 +8,69 @@ declare global {
|
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* TikTok Pixel vendor manifest.
|
|
13
|
+
*
|
|
14
|
+
* Uses structured bootstrap steps and provides a consent API
|
|
15
|
+
* via `ttq.grantConsent()` / `ttq.revokeConsent()`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const tiktokPixelManifest: {
|
|
18
|
+
readonly vendor: "tiktok-pixel";
|
|
19
|
+
readonly category: "marketing";
|
|
20
|
+
readonly persistAfterConsentRevoked: true;
|
|
21
|
+
readonly bootstrap: [{
|
|
22
|
+
readonly type: "setGlobal";
|
|
23
|
+
readonly name: "TiktokAnalyticsObject";
|
|
24
|
+
readonly value: "ttq";
|
|
25
|
+
}, {
|
|
26
|
+
readonly type: "setGlobal";
|
|
27
|
+
readonly name: "ttq";
|
|
28
|
+
readonly value: readonly [];
|
|
29
|
+
readonly ifUndefined: true;
|
|
30
|
+
}, {
|
|
31
|
+
readonly type: "defineQueueMethods";
|
|
32
|
+
readonly target: "ttq";
|
|
33
|
+
readonly methods: ["page", "track", "identify", "instances", "debug", "on", "off", "once", "ready", "alias", "group", "enableCookie", "disableCookie", "holdConsent", "revokeConsent", "grantConsent"];
|
|
34
|
+
}];
|
|
35
|
+
readonly install: [{
|
|
36
|
+
readonly type: "callGlobal";
|
|
37
|
+
readonly global: "ttq";
|
|
38
|
+
readonly method: "grantConsent";
|
|
39
|
+
}, {
|
|
40
|
+
readonly type: "callGlobal";
|
|
41
|
+
readonly global: "ttq";
|
|
42
|
+
readonly method: "page";
|
|
43
|
+
}, {
|
|
44
|
+
readonly type: "loadScript";
|
|
45
|
+
readonly src: "{{scriptSrc}}?sdkid={{pixelId}}&lib=ttq";
|
|
46
|
+
readonly async: true;
|
|
47
|
+
}];
|
|
48
|
+
readonly afterLoad: [{
|
|
49
|
+
readonly type: "callGlobal";
|
|
50
|
+
readonly global: "ttq";
|
|
51
|
+
readonly method: "grantConsent";
|
|
52
|
+
}];
|
|
53
|
+
readonly onConsentGranted: [{
|
|
54
|
+
readonly type: "callGlobal";
|
|
55
|
+
readonly global: "ttq";
|
|
56
|
+
readonly method: "grantConsent";
|
|
57
|
+
}];
|
|
58
|
+
readonly onConsentDenied: [{
|
|
59
|
+
readonly type: "callGlobal";
|
|
60
|
+
readonly global: "ttq";
|
|
61
|
+
readonly method: "revokeConsent";
|
|
62
|
+
}];
|
|
63
|
+
readonly kind: "c15t.vendor-manifest";
|
|
64
|
+
readonly schemaVersion: 1;
|
|
65
|
+
};
|
|
11
66
|
export interface TikTokPixelOptions {
|
|
12
67
|
/**
|
|
13
68
|
* Your TikTok Pixel ID
|
|
14
69
|
* @example `123456789012345`
|
|
15
70
|
*/
|
|
16
71
|
pixelId: string;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* Default values:
|
|
21
|
-
* - `id`: 'tiktok-pixel'
|
|
22
|
-
* - `src`: `https://analytics.tiktok.com/i18n/pixel/events.js`
|
|
23
|
-
* - `category`: 'marketing'
|
|
24
|
-
*/
|
|
25
|
-
script?: Partial<Script>;
|
|
72
|
+
/** TikTok Pixel loader base URL. */
|
|
73
|
+
scriptSrc?: string;
|
|
26
74
|
}
|
|
27
75
|
/**
|
|
28
76
|
* Creates a Tiktok Pixel script.
|
|
@@ -40,4 +88,4 @@ export interface TikTokPixelOptions {
|
|
|
40
88
|
*
|
|
41
89
|
* @see {@link https://ads.tiktok.com/help/article/tiktok-pixel} TikTok Pixel documentation
|
|
42
90
|
*/
|
|
43
|
-
export declare function tiktokPixel({ pixelId,
|
|
91
|
+
export declare function tiktokPixel({ pixelId, scriptSrc, }: TikTokPixelOptions): Script;
|