@c15t/scripts 2.0.0-rc.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- 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 +144 -0
- 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 +97 -0
- package/dist-types/google-tag.d.ts +96 -0
- package/dist-types/helpers.test.d.ts +1 -0
- package/dist-types/linkedin-insights.d.ts +79 -0
- package/{dist → dist-types}/meta-pixel.d.ts +61 -14
- package/dist-types/microsoft-uet.d.ts +94 -0
- package/dist-types/posthog.d.ts +112 -0
- package/dist-types/resolve.d.ts +9 -0
- package/dist-types/tiktok-pixel.d.ts +91 -0
- package/dist-types/types.d.ts +259 -0
- package/{dist → dist-types}/x-pixel.d.ts +38 -12
- package/package.json +9 -8
- package/dist/databuddy.d.ts +0 -104
- package/dist/databuddy.d.ts.map +0 -1
- package/dist/google-tag-manager.d.ts +0 -63
- package/dist/google-tag-manager.d.ts.map +0 -1
- package/dist/google-tag.d.ts +0 -38
- package/dist/google-tag.d.ts.map +0 -1
- package/dist/linkedin-insights.d.ts +0 -48
- package/dist/linkedin-insights.d.ts.map +0 -1
- package/dist/meta-pixel.d.ts.map +0 -1
- package/dist/microsoft-uet.d.ts +0 -40
- package/dist/microsoft-uet.d.ts.map +0 -1
- package/dist/posthog.d.ts +0 -54
- package/dist/posthog.d.ts.map +0 -1
- package/dist/tiktok-pixel.d.ts +0 -44
- package/dist/tiktok-pixel.d.ts.map +0 -1
- package/dist/x-pixel.d.ts.map +0 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
lintrk: ((...args: unknown[]) => void) & {
|
|
5
|
+
q?: unknown[][];
|
|
6
|
+
};
|
|
7
|
+
_linkedin_partner_id?: string;
|
|
8
|
+
_linkedin_data_partner_ids?: string[];
|
|
9
|
+
ORIBILI?: {
|
|
10
|
+
_DEBUG?: {
|
|
11
|
+
disableScript?: () => void;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
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
|
+
};
|
|
55
|
+
export interface LinkedInInsightsOptions {
|
|
56
|
+
/**
|
|
57
|
+
* Your LinkedIn Insights ID
|
|
58
|
+
* @example `123456789012345`
|
|
59
|
+
*/
|
|
60
|
+
id: string;
|
|
61
|
+
/** LinkedIn Insights loader URL. */
|
|
62
|
+
scriptSrc?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* LinkedIn Insights Script
|
|
66
|
+
*
|
|
67
|
+
* @param options - The options for the LinkedIn Insights script
|
|
68
|
+
* @returns The LinkedIn Insights script configuration
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const linkedinInsightsScript = linkedinInsights({
|
|
73
|
+
* id: '123456789012345',
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @see {@link https://business.linkedin.com/marketing-solutions/ad-libraries/insights} LinkedIn Insights documentation
|
|
78
|
+
*/
|
|
79
|
+
export declare function linkedinInsights({ id, scriptSrc, }: LinkedInInsightsOptions): Script;
|
|
@@ -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.
|
|
@@ -135,4 +183,3 @@ export declare function metaPixel({ pixelId, script }: MetaPixelOptions): Script
|
|
|
135
183
|
*/
|
|
136
184
|
export declare const metaPixelEvent: <TEventName extends StandardEventName>(eventName: TEventName, params?: StandardEventParams[TEventName], eventId?: string) => void;
|
|
137
185
|
export {};
|
|
138
|
-
//# sourceMappingURL=meta-pixel.d.ts.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
uetq: unknown[] | undefined;
|
|
5
|
+
}
|
|
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
|
+
};
|
|
69
|
+
export interface MicrosoftUetOptions {
|
|
70
|
+
/**
|
|
71
|
+
* Your Microsoft UET ID
|
|
72
|
+
* @example `123456789012345`
|
|
73
|
+
*/
|
|
74
|
+
id: string;
|
|
75
|
+
/** Microsoft UET loader URL. */
|
|
76
|
+
scriptSrc?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Microsoft UET Script
|
|
80
|
+
* This script is persistent after consent is revoked because it has built-in functionality to opt into and out of tracking based on consent, which allows us to not need to load the script again when consent is revoked.
|
|
81
|
+
*
|
|
82
|
+
* @param options - The options for the Microsoft UET script
|
|
83
|
+
* @returns The Microsoft UET script configuration
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const microsoftUetScript = microsoftUet({
|
|
88
|
+
* id: '123456789012345',
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @see https://learn.microsoft.com/en-us/advertising/guides/universal-event-tracking?view=bingads-13
|
|
93
|
+
*/
|
|
94
|
+
export declare function microsoftUet({ id, scriptSrc }: MicrosoftUetOptions): Script;
|
|
@@ -0,0 +1,112 @@
|
|
|
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;
|
|
@@ -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;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
ttq: {
|
|
5
|
+
grantConsent: () => void;
|
|
6
|
+
revokeConsent: () => void;
|
|
7
|
+
page: () => void;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
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
|
+
};
|
|
66
|
+
export interface TikTokPixelOptions {
|
|
67
|
+
/**
|
|
68
|
+
* Your TikTok Pixel ID
|
|
69
|
+
* @example `123456789012345`
|
|
70
|
+
*/
|
|
71
|
+
pixelId: string;
|
|
72
|
+
/** TikTok Pixel loader base URL. */
|
|
73
|
+
scriptSrc?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Creates a Tiktok Pixel script.
|
|
77
|
+
* This script is persistent after consent is revoked because it has built-in functionality to opt into and out of tracking based on consent, which allows us to not need to load the script again when consent is revoked.
|
|
78
|
+
*
|
|
79
|
+
* @param options - The options for the TikTok Pixel script
|
|
80
|
+
* @returns The TikTok Pixel script configuration
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const tiktokPixelScript = tiktokPixel({
|
|
85
|
+
* pixelId: '123456789012345',
|
|
86
|
+
* });
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* @see {@link https://ads.tiktok.com/help/article/tiktok-pixel} TikTok Pixel documentation
|
|
90
|
+
*/
|
|
91
|
+
export declare function tiktokPixel({ pixelId, scriptSrc, }: TikTokPixelOptions): Script;
|