@c15t/scripts 2.0.1 → 2.1.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 +9 -9
- package/dist/engine/runtime.cjs +11 -0
- package/dist/engine/runtime.js +11 -0
- package/dist/registry.cjs +338 -0
- package/dist/registry.js +292 -0
- package/dist/types.cjs +18 -0
- package/dist/types.js +10 -1
- package/dist/vendors/_shared/attributes.cjs +51 -0
- package/dist/vendors/_shared/attributes.js +14 -0
- package/dist/vendors/_shared/google-consent.cjs +64 -0
- package/dist/vendors/_shared/google-consent.js +27 -0
- package/dist/vendors/_shared/install-builders.cjs +55 -0
- package/dist/vendors/_shared/install-builders.js +21 -0
- package/dist/vendors/_shared/script-url.cjs +74 -0
- package/dist/vendors/_shared/script-url.js +28 -0
- package/dist/{linkedin-insights.cjs → vendors/ads-and-pixels/linkedin-insights.cjs} +2 -2
- package/dist/{linkedin-insights.js → vendors/ads-and-pixels/linkedin-insights.js} +2 -2
- package/dist/vendors/ads-and-pixels/meta-pixel.cjs +202 -0
- package/dist/vendors/ads-and-pixels/meta-pixel.js +153 -0
- package/dist/{microsoft-uet.cjs → vendors/ads-and-pixels/microsoft-uet.cjs} +31 -14
- package/dist/{microsoft-uet.js → vendors/ads-and-pixels/microsoft-uet.js} +31 -14
- package/dist/vendors/ads-and-pixels/reddit-pixel.cjs +147 -0
- package/dist/vendors/ads-and-pixels/reddit-pixel.js +107 -0
- package/dist/vendors/ads-and-pixels/snapchat-pixel.cjs +127 -0
- package/dist/vendors/ads-and-pixels/snapchat-pixel.js +87 -0
- package/dist/{tiktok-pixel.cjs → vendors/ads-and-pixels/tiktok-pixel.cjs} +2 -2
- 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} +6 -3
- package/dist/{x-pixel.js → vendors/ads-and-pixels/x-pixel.js} +6 -3
- package/dist/vendors/analytics/ahrefs-analytics.cjs +64 -0
- package/dist/vendors/analytics/ahrefs-analytics.js +27 -0
- package/dist/vendors/analytics/cloudflare-web-analytics.cjs +69 -0
- package/dist/vendors/analytics/cloudflare-web-analytics.js +32 -0
- package/dist/{databuddy.cjs → vendors/analytics/databuddy.cjs} +3 -3
- package/dist/{databuddy.js → vendors/analytics/databuddy.js} +3 -3
- package/dist/vendors/analytics/fathom-analytics.cjs +72 -0
- package/dist/vendors/analytics/fathom-analytics.js +35 -0
- package/dist/{google-tag.cjs → vendors/analytics/google-tag.cjs} +7 -28
- package/dist/{google-tag.js → vendors/analytics/google-tag.js} +7 -28
- package/dist/vendors/analytics/hotjar.cjs +81 -0
- package/dist/vendors/analytics/hotjar.js +44 -0
- package/dist/vendors/analytics/matomo-analytics.cjs +228 -0
- package/dist/vendors/analytics/matomo-analytics.js +191 -0
- package/dist/vendors/analytics/microsoft-clarity.cjs +110 -0
- package/dist/vendors/analytics/microsoft-clarity.js +73 -0
- package/dist/vendors/analytics/mixpanel-analytics.cjs +119 -0
- package/dist/vendors/analytics/mixpanel-analytics.js +82 -0
- package/dist/vendors/analytics/plausible-analytics.cjs +118 -0
- package/dist/vendors/analytics/plausible-analytics.js +81 -0
- package/dist/{posthog.cjs → vendors/analytics/posthog.cjs} +69 -6
- package/dist/vendors/analytics/posthog.js +163 -0
- package/dist/vendors/analytics/promptwatch.cjs +66 -0
- package/dist/vendors/analytics/promptwatch.js +29 -0
- package/dist/vendors/analytics/rybbit-analytics.cjs +100 -0
- package/dist/vendors/analytics/rybbit-analytics.js +63 -0
- package/dist/vendors/analytics/segment.cjs +93 -0
- package/dist/vendors/analytics/segment.js +56 -0
- package/dist/vendors/analytics/umami-analytics.cjs +76 -0
- package/dist/vendors/analytics/umami-analytics.js +39 -0
- package/dist/vendors/analytics/vercel-analytics.cjs +90 -0
- package/dist/vendors/analytics/vercel-analytics.js +53 -0
- package/dist/vendors/functional/crisp.cjs +139 -0
- package/dist/vendors/functional/crisp.js +102 -0
- package/dist/vendors/functional/intercom.cjs +85 -0
- package/dist/vendors/functional/intercom.js +45 -0
- package/dist/{google-tag-manager.cjs → vendors/tag-managers/google-tag-manager.cjs} +6 -27
- 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 +368 -0
- package/dist-types/types.d.ts +13 -0
- 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/{linkedin-insights.d.ts → vendors/ads-and-pixels/linkedin-insights.d.ts} +22 -9
- 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} +21 -10
- 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} +20 -5
- package/dist-types/{x-pixel.d.ts → vendors/ads-and-pixels/x-pixel.d.ts} +21 -4
- package/dist-types/vendors/analytics/ahrefs-analytics.d.ts +62 -0
- package/dist-types/vendors/analytics/cloudflare-web-analytics.d.ts +67 -0
- package/dist-types/vendors/analytics/fathom-analytics.d.ts +90 -0
- package/dist-types/{google-tag.d.ts → vendors/analytics/google-tag.d.ts} +5 -8
- package/dist-types/vendors/analytics/hotjar.d.ts +73 -0
- package/dist-types/vendors/analytics/matomo-analytics.d.ts +41 -0
- package/dist-types/vendors/analytics/microsoft-clarity.d.ts +86 -0
- package/dist-types/vendors/analytics/mixpanel-analytics.d.ts +101 -0
- package/dist-types/vendors/analytics/plausible-analytics.d.ts +122 -0
- package/dist-types/{posthog.d.ts → vendors/analytics/posthog.d.ts} +47 -5
- package/dist-types/vendors/analytics/promptwatch.d.ts +36 -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} +5 -8
- package/package.json +165 -4
- package/dist/meta-pixel.cjs +0 -129
- package/dist/meta-pixel.js +0 -89
- package/dist/posthog.js +0 -100
- package/dist-types/meta-pixel.d.ts +0 -185
- /package/dist-types/{databuddy.d.ts → vendors/analytics/databuddy.d.ts} +0 -0
package/dist/meta-pixel.cjs
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
metaPixelManifest: ()=>metaPixelManifest,
|
|
28
|
-
metaPixel: ()=>metaPixel,
|
|
29
|
-
metaPixelEvent: ()=>metaPixelEvent
|
|
30
|
-
});
|
|
31
|
-
const external_resolve_cjs_namespaceObject = require("./resolve.cjs");
|
|
32
|
-
const external_types_cjs_namespaceObject = require("./types.cjs");
|
|
33
|
-
const metaPixelManifest = {
|
|
34
|
-
...external_types_cjs_namespaceObject.vendorManifestContract,
|
|
35
|
-
vendor: 'meta-pixel',
|
|
36
|
-
category: 'marketing',
|
|
37
|
-
persistAfterConsentRevoked: true,
|
|
38
|
-
bootstrap: [
|
|
39
|
-
{
|
|
40
|
-
type: 'defineStubFunction',
|
|
41
|
-
name: 'fbq',
|
|
42
|
-
queue: {
|
|
43
|
-
property: 'queue'
|
|
44
|
-
},
|
|
45
|
-
dispatchProperty: 'callMethod',
|
|
46
|
-
selfReferences: [
|
|
47
|
-
'push'
|
|
48
|
-
],
|
|
49
|
-
aliases: [
|
|
50
|
-
'_fbq'
|
|
51
|
-
],
|
|
52
|
-
properties: {
|
|
53
|
-
loaded: true,
|
|
54
|
-
version: '2.0'
|
|
55
|
-
},
|
|
56
|
-
ifUndefined: true
|
|
57
|
-
}
|
|
58
|
-
],
|
|
59
|
-
install: [
|
|
60
|
-
{
|
|
61
|
-
type: 'callGlobal',
|
|
62
|
-
global: 'fbq',
|
|
63
|
-
args: [
|
|
64
|
-
'consent',
|
|
65
|
-
'grant'
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
type: 'callGlobal',
|
|
70
|
-
global: 'fbq',
|
|
71
|
-
args: [
|
|
72
|
-
'init',
|
|
73
|
-
'{{pixelId}}'
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
type: 'callGlobal',
|
|
78
|
-
global: 'fbq',
|
|
79
|
-
args: [
|
|
80
|
-
'track',
|
|
81
|
-
'PageView'
|
|
82
|
-
]
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
type: 'loadScript',
|
|
86
|
-
src: "{{scriptSrc}}",
|
|
87
|
-
async: true
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
|
-
onConsentGranted: [
|
|
91
|
-
{
|
|
92
|
-
type: 'callGlobal',
|
|
93
|
-
global: 'fbq',
|
|
94
|
-
args: [
|
|
95
|
-
'consent',
|
|
96
|
-
'grant'
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
],
|
|
100
|
-
onConsentDenied: [
|
|
101
|
-
{
|
|
102
|
-
type: 'callGlobal',
|
|
103
|
-
global: 'fbq',
|
|
104
|
-
args: [
|
|
105
|
-
'consent',
|
|
106
|
-
'revoke'
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
};
|
|
111
|
-
function metaPixel({ pixelId, scriptSrc }) {
|
|
112
|
-
const resolved = (0, external_resolve_cjs_namespaceObject.resolveManifest)(metaPixelManifest, {
|
|
113
|
-
pixelId,
|
|
114
|
-
scriptSrc: scriptSrc ?? 'https://connect.facebook.net/en_US/fbevents.js'
|
|
115
|
-
});
|
|
116
|
-
return resolved;
|
|
117
|
-
}
|
|
118
|
-
const metaPixelEvent = (eventName, params, eventId)=>window.fbq('track', eventName, params, eventId);
|
|
119
|
-
exports.metaPixel = __webpack_exports__.metaPixel;
|
|
120
|
-
exports.metaPixelEvent = __webpack_exports__.metaPixelEvent;
|
|
121
|
-
exports.metaPixelManifest = __webpack_exports__.metaPixelManifest;
|
|
122
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
123
|
-
"metaPixel",
|
|
124
|
-
"metaPixelEvent",
|
|
125
|
-
"metaPixelManifest"
|
|
126
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
127
|
-
Object.defineProperty(exports, '__esModule', {
|
|
128
|
-
value: true
|
|
129
|
-
});
|
package/dist/meta-pixel.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { resolveManifest } from "./resolve.js";
|
|
2
|
-
import { vendorManifestContract } from "./types.js";
|
|
3
|
-
const metaPixelManifest = {
|
|
4
|
-
...vendorManifestContract,
|
|
5
|
-
vendor: 'meta-pixel',
|
|
6
|
-
category: 'marketing',
|
|
7
|
-
persistAfterConsentRevoked: true,
|
|
8
|
-
bootstrap: [
|
|
9
|
-
{
|
|
10
|
-
type: 'defineStubFunction',
|
|
11
|
-
name: 'fbq',
|
|
12
|
-
queue: {
|
|
13
|
-
property: 'queue'
|
|
14
|
-
},
|
|
15
|
-
dispatchProperty: 'callMethod',
|
|
16
|
-
selfReferences: [
|
|
17
|
-
'push'
|
|
18
|
-
],
|
|
19
|
-
aliases: [
|
|
20
|
-
'_fbq'
|
|
21
|
-
],
|
|
22
|
-
properties: {
|
|
23
|
-
loaded: true,
|
|
24
|
-
version: '2.0'
|
|
25
|
-
},
|
|
26
|
-
ifUndefined: true
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
install: [
|
|
30
|
-
{
|
|
31
|
-
type: 'callGlobal',
|
|
32
|
-
global: 'fbq',
|
|
33
|
-
args: [
|
|
34
|
-
'consent',
|
|
35
|
-
'grant'
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
type: 'callGlobal',
|
|
40
|
-
global: 'fbq',
|
|
41
|
-
args: [
|
|
42
|
-
'init',
|
|
43
|
-
'{{pixelId}}'
|
|
44
|
-
]
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
type: 'callGlobal',
|
|
48
|
-
global: 'fbq',
|
|
49
|
-
args: [
|
|
50
|
-
'track',
|
|
51
|
-
'PageView'
|
|
52
|
-
]
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
type: 'loadScript',
|
|
56
|
-
src: "{{scriptSrc}}",
|
|
57
|
-
async: true
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
onConsentGranted: [
|
|
61
|
-
{
|
|
62
|
-
type: 'callGlobal',
|
|
63
|
-
global: 'fbq',
|
|
64
|
-
args: [
|
|
65
|
-
'consent',
|
|
66
|
-
'grant'
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
onConsentDenied: [
|
|
71
|
-
{
|
|
72
|
-
type: 'callGlobal',
|
|
73
|
-
global: 'fbq',
|
|
74
|
-
args: [
|
|
75
|
-
'consent',
|
|
76
|
-
'revoke'
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
]
|
|
80
|
-
};
|
|
81
|
-
function metaPixel({ pixelId, scriptSrc }) {
|
|
82
|
-
const resolved = resolveManifest(metaPixelManifest, {
|
|
83
|
-
pixelId,
|
|
84
|
-
scriptSrc: scriptSrc ?? 'https://connect.facebook.net/en_US/fbevents.js'
|
|
85
|
-
});
|
|
86
|
-
return resolved;
|
|
87
|
-
}
|
|
88
|
-
const metaPixelEvent = (eventName, params, eventId)=>window.fbq('track', eventName, params, eventId);
|
|
89
|
-
export { metaPixel, metaPixelEvent, metaPixelManifest };
|
package/dist/posthog.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { resolveManifest } from "./resolve.js";
|
|
2
|
-
import { vendorManifestContract } from "./types.js";
|
|
3
|
-
const posthogManifest = {
|
|
4
|
-
...vendorManifestContract,
|
|
5
|
-
vendor: 'posthog',
|
|
6
|
-
category: 'measurement',
|
|
7
|
-
alwaysLoad: true,
|
|
8
|
-
bootstrap: [
|
|
9
|
-
{
|
|
10
|
-
type: 'setGlobal',
|
|
11
|
-
name: 'posthog',
|
|
12
|
-
value: {},
|
|
13
|
-
ifUndefined: true
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
type: 'defineGlobalMethods',
|
|
17
|
-
target: 'posthog',
|
|
18
|
-
methods: [
|
|
19
|
-
{
|
|
20
|
-
name: 'init',
|
|
21
|
-
behavior: 'noop'
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'opt_in_capturing',
|
|
25
|
-
behavior: 'noop'
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: 'opt_out_capturing',
|
|
29
|
-
behavior: 'noop'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: 'get_explicit_consent_status',
|
|
33
|
-
behavior: 'return',
|
|
34
|
-
value: 'pending'
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
install: [
|
|
40
|
-
{
|
|
41
|
-
type: 'loadScript',
|
|
42
|
-
src: "{{scriptUrl}}",
|
|
43
|
-
async: true,
|
|
44
|
-
attributes: {
|
|
45
|
-
crossorigin: 'anonymous',
|
|
46
|
-
'data-api-host': '{{apiHost}}',
|
|
47
|
-
'data-ui-host': '{{apiHost}}'
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
afterLoad: [
|
|
52
|
-
{
|
|
53
|
-
type: 'callGlobal',
|
|
54
|
-
global: 'posthog',
|
|
55
|
-
method: 'init',
|
|
56
|
-
args: [
|
|
57
|
-
'{{id}}',
|
|
58
|
-
'{{initOptions}}'
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
],
|
|
62
|
-
onLoadGranted: [
|
|
63
|
-
{
|
|
64
|
-
type: 'callGlobal',
|
|
65
|
-
global: 'posthog',
|
|
66
|
-
method: 'opt_in_capturing'
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
onLoadDenied: [
|
|
70
|
-
{
|
|
71
|
-
type: 'callGlobal',
|
|
72
|
-
global: 'posthog',
|
|
73
|
-
method: 'opt_out_capturing'
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
onConsentGranted: [
|
|
77
|
-
{
|
|
78
|
-
type: 'callGlobal',
|
|
79
|
-
global: 'posthog',
|
|
80
|
-
method: 'opt_in_capturing'
|
|
81
|
-
}
|
|
82
|
-
],
|
|
83
|
-
onConsentDenied: [
|
|
84
|
-
{
|
|
85
|
-
type: 'callGlobal',
|
|
86
|
-
global: 'posthog',
|
|
87
|
-
method: 'opt_out_capturing'
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
};
|
|
91
|
-
function posthog(options) {
|
|
92
|
-
const resolved = resolveManifest(posthogManifest, {
|
|
93
|
-
id: options.id,
|
|
94
|
-
apiHost: options.apiHost ?? 'https://eu.i.posthog.com',
|
|
95
|
-
scriptUrl: options.scriptUrl ?? 'https://eu-assets.i.posthog.com/static/array.js',
|
|
96
|
-
initOptions: options.initOptions ?? {}
|
|
97
|
-
});
|
|
98
|
-
return resolved;
|
|
99
|
-
}
|
|
100
|
-
export { posthog, posthogManifest };
|
|
@@ -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 {};
|
|
File without changes
|