@c15t/scripts 1.0.0-canary-20251012181938
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/LICENSE.md +595 -0
- package/README.md +70 -0
- package/dist/google-tag-manager.cjs +133 -0
- package/dist/google-tag-manager.d.ts +63 -0
- package/dist/google-tag-manager.d.ts.map +1 -0
- package/dist/google-tag-manager.js +93 -0
- package/dist/google-tag.cjs +75 -0
- package/dist/google-tag.d.ts +38 -0
- package/dist/google-tag.d.ts.map +1 -0
- package/dist/google-tag.js +41 -0
- package/dist/linkedin-insights.cjs +74 -0
- package/dist/linkedin-insights.d.ts +48 -0
- package/dist/linkedin-insights.d.ts.map +1 -0
- package/dist/linkedin-insights.js +40 -0
- package/dist/meta-pixel.cjs +63 -0
- package/dist/meta-pixel.d.ts +138 -0
- package/dist/meta-pixel.d.ts.map +1 -0
- package/dist/meta-pixel.js +26 -0
- package/dist/microsoft-uet.cjs +90 -0
- package/dist/microsoft-uet.d.ts +40 -0
- package/dist/microsoft-uet.d.ts.map +1 -0
- package/dist/microsoft-uet.js +56 -0
- package/dist/posthog.cjs +88 -0
- package/dist/posthog.d.ts +54 -0
- package/dist/posthog.d.ts.map +1 -0
- package/dist/posthog.js +54 -0
- package/dist/tiktok-pixel.cjs +60 -0
- package/dist/tiktok-pixel.d.ts +44 -0
- package/dist/tiktok-pixel.d.ts.map +1 -0
- package/dist/tiktok-pixel.js +26 -0
- package/dist/x-pixel.cjs +55 -0
- package/dist/x-pixel.d.ts +140 -0
- package/dist/x-pixel.d.ts.map +1 -0
- package/dist/x-pixel.js +18 -0
- package/package.json +46 -0
- package/readme.json +12 -0
|
@@ -0,0 +1,60 @@
|
|
|
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 ('undefined' != 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
|
+
tiktokPixel: ()=>tiktokPixel
|
|
28
|
+
});
|
|
29
|
+
function tiktokPixel({ pixelId, script }) {
|
|
30
|
+
return {
|
|
31
|
+
id: script?.id ?? 'tiktok-pixel',
|
|
32
|
+
category: script?.category ?? 'marketing',
|
|
33
|
+
textContent: `
|
|
34
|
+
!function (w, d, t) {
|
|
35
|
+
w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie","holdConsent","revokeConsent","grantConsent"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(
|
|
36
|
+
var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){var r="${script?.src ?? 'https://analytics.tiktok.com/i18n/pixel/events.js'}",o=n&&n.partner;ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=r,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};n=document.createElement("script")
|
|
37
|
+
;n.type="text/javascript",n.async=!0,n.src=r+"?sdkid="+e+"&lib="+t;e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(n,e)};
|
|
38
|
+
ttq.load('${pixelId}');
|
|
39
|
+
ttq.grantConsent();
|
|
40
|
+
ttq.page();
|
|
41
|
+
}(window, document, 'ttq');
|
|
42
|
+
`.trim(),
|
|
43
|
+
persistAfterConsentRevoked: true,
|
|
44
|
+
onLoad: (rest)=>{
|
|
45
|
+
window.ttq.grantConsent();
|
|
46
|
+
if (script?.onLoad) script.onLoad(rest);
|
|
47
|
+
},
|
|
48
|
+
onDelete: (rest)=>{
|
|
49
|
+
window.ttq.revokeConsent();
|
|
50
|
+
if (script?.onDelete) script.onDelete(rest);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.tiktokPixel = __webpack_exports__.tiktokPixel;
|
|
55
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
56
|
+
"tiktokPixel"
|
|
57
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
58
|
+
Object.defineProperty(exports, '__esModule', {
|
|
59
|
+
value: true
|
|
60
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
export interface TikTokPixelOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Your TikTok Pixel ID
|
|
14
|
+
* @example `123456789012345`
|
|
15
|
+
*/
|
|
16
|
+
pixelId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Override or extend the default script values.
|
|
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>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a Tiktok Pixel script.
|
|
29
|
+
* 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.
|
|
30
|
+
*
|
|
31
|
+
* @param options - The options for the TikTok Pixel script
|
|
32
|
+
* @returns The TikTok Pixel script configuration
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const tiktokPixelScript = tiktokPixel({
|
|
37
|
+
* pixelId: '123456789012345',
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @see {@link https://ads.tiktok.com/help/article/tiktok-pixel} TikTok Pixel documentation
|
|
42
|
+
*/
|
|
43
|
+
export declare function tiktokPixel({ pixelId, script }: TikTokPixelOptions): Script;
|
|
44
|
+
//# sourceMappingURL=tiktok-pixel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiktok-pixel.d.ts","sourceRoot":"","sources":["../src/tiktok-pixel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,GAAG,EAAE;YACJ,YAAY,EAAE,MAAM,IAAI,CAAC;YACzB,aAAa,EAAE,MAAM,IAAI,CAAC;YAC1B,IAAI,EAAE,MAAM,IAAI,CAAC;SACjB,CAAC;KACF;CACD;AAED,MAAM,WAAW,kBAAkB;IAClC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,kBAAkB,GAAG,MAAM,CA+B3E"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function tiktokPixel({ pixelId, script }) {
|
|
2
|
+
return {
|
|
3
|
+
id: script?.id ?? 'tiktok-pixel',
|
|
4
|
+
category: script?.category ?? 'marketing',
|
|
5
|
+
textContent: `
|
|
6
|
+
!function (w, d, t) {
|
|
7
|
+
w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie","holdConsent","revokeConsent","grantConsent"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(
|
|
8
|
+
var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){var r="${script?.src ?? 'https://analytics.tiktok.com/i18n/pixel/events.js'}",o=n&&n.partner;ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=r,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};n=document.createElement("script")
|
|
9
|
+
;n.type="text/javascript",n.async=!0,n.src=r+"?sdkid="+e+"&lib="+t;e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(n,e)};
|
|
10
|
+
ttq.load('${pixelId}');
|
|
11
|
+
ttq.grantConsent();
|
|
12
|
+
ttq.page();
|
|
13
|
+
}(window, document, 'ttq');
|
|
14
|
+
`.trim(),
|
|
15
|
+
persistAfterConsentRevoked: true,
|
|
16
|
+
onLoad: (rest)=>{
|
|
17
|
+
window.ttq.grantConsent();
|
|
18
|
+
if (script?.onLoad) script.onLoad(rest);
|
|
19
|
+
},
|
|
20
|
+
onDelete: (rest)=>{
|
|
21
|
+
window.ttq.revokeConsent();
|
|
22
|
+
if (script?.onDelete) script.onDelete(rest);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export { tiktokPixel };
|
package/dist/x-pixel.cjs
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
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 ('undefined' != 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
|
+
xPixel: ()=>xPixel,
|
|
28
|
+
xPixelEvent: ()=>xPixelEvent
|
|
29
|
+
});
|
|
30
|
+
function xPixel({ pixelId, script }) {
|
|
31
|
+
return {
|
|
32
|
+
id: script?.id ?? 'x-pixel',
|
|
33
|
+
category: script?.category ?? 'marketing',
|
|
34
|
+
textContent: `
|
|
35
|
+
!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);
|
|
36
|
+
},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='${script?.src ?? 'https://static.ads-twitter.com/uwt.js'}',
|
|
37
|
+
a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');
|
|
38
|
+
twq('config','${pixelId}');
|
|
39
|
+
`.trim(),
|
|
40
|
+
onDelete: (rest)=>{
|
|
41
|
+
delete window.twq;
|
|
42
|
+
if (script?.onDelete) script.onDelete(rest);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const xPixelEvent = (eventId, metadata)=>window.twq?.('event', eventId, metadata);
|
|
47
|
+
exports.xPixel = __webpack_exports__.xPixel;
|
|
48
|
+
exports.xPixelEvent = __webpack_exports__.xPixelEvent;
|
|
49
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
50
|
+
"xPixel",
|
|
51
|
+
"xPixelEvent"
|
|
52
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
53
|
+
Object.defineProperty(exports, '__esModule', {
|
|
54
|
+
value: true
|
|
55
|
+
});
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { Script } from 'c15t';
|
|
2
|
+
export interface XPixelContent {
|
|
3
|
+
/**
|
|
4
|
+
* Type of the content
|
|
5
|
+
* @example "Animals & Pet Supplies > Pet Supplies > Cat Supplies > Cat Beds"
|
|
6
|
+
* @see https://www.google.com/basepages/producttype/taxonomy.en-US.txt
|
|
7
|
+
*/
|
|
8
|
+
content_type?: string;
|
|
9
|
+
/**
|
|
10
|
+
* ID of the content
|
|
11
|
+
* For product catalog users: please pass SKU
|
|
12
|
+
* For all other users: Please pass Global Trade Item Number (GTIN) if available, otherwise pass SKU
|
|
13
|
+
* @example "1234567890"
|
|
14
|
+
*/
|
|
15
|
+
content_id: string;
|
|
16
|
+
/**
|
|
17
|
+
* Name of a product or service
|
|
18
|
+
* @example "Cat Bed"
|
|
19
|
+
*/
|
|
20
|
+
content_name?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Price of a product or service
|
|
23
|
+
* @example 10.00
|
|
24
|
+
*/
|
|
25
|
+
content_price?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Quantity of the content
|
|
28
|
+
* @example 1
|
|
29
|
+
*/
|
|
30
|
+
num_items?: number;
|
|
31
|
+
/**
|
|
32
|
+
* ID associated with a group of product variants
|
|
33
|
+
* @example "1234567890"
|
|
34
|
+
*/
|
|
35
|
+
content_group_id?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface XPixelEvent {
|
|
38
|
+
/**
|
|
39
|
+
* Total value of the conversion event (ex: $ value of the transaction in case of a purchase, etc.)
|
|
40
|
+
* @example 10.00
|
|
41
|
+
*/
|
|
42
|
+
value?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Currency of the conversion event
|
|
45
|
+
* ISO 4217 code (ex: USD, EUR, JPY, etc.)
|
|
46
|
+
* @example USD
|
|
47
|
+
*/
|
|
48
|
+
currency?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Unique identifier for the event that can be used for deduplication purposes
|
|
51
|
+
* @example tw-xxxx-xxxx
|
|
52
|
+
*/
|
|
53
|
+
conversion_id?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Search string of the conversion event
|
|
56
|
+
* @example "search query"
|
|
57
|
+
*/
|
|
58
|
+
search_string?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Description of the conversion event
|
|
61
|
+
* @example "purchase"
|
|
62
|
+
*/
|
|
63
|
+
description?: string;
|
|
64
|
+
/**
|
|
65
|
+
* twclid of the conversion event
|
|
66
|
+
* The X Pixel already automatically passes twclid from URL or first-party cookie. This parameter can be optionally used to force attribution to a certain ad click.
|
|
67
|
+
* @example "twclid"
|
|
68
|
+
*/
|
|
69
|
+
twclid?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Status of the conversion event
|
|
72
|
+
* @example completed
|
|
73
|
+
*/
|
|
74
|
+
status?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Content/products associated with the conversion event
|
|
77
|
+
* @example [{content_id: 'OT001', content_name: 'bird seed', content_price: 50, num_items: 1}]
|
|
78
|
+
* @see {@link XPixelContent}
|
|
79
|
+
*/
|
|
80
|
+
contents?: XPixelContent[];
|
|
81
|
+
}
|
|
82
|
+
declare global {
|
|
83
|
+
interface Window {
|
|
84
|
+
twq?: (event: string, ...args: unknown[]) => void;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export interface XPixelOptions {
|
|
88
|
+
/**
|
|
89
|
+
* Your X Pixel ID
|
|
90
|
+
* @example `123456789012345`
|
|
91
|
+
*/
|
|
92
|
+
pixelId: string;
|
|
93
|
+
/**
|
|
94
|
+
* Override or extend the default script values.
|
|
95
|
+
*
|
|
96
|
+
* Default values:
|
|
97
|
+
* - `id`: 'x-pixel'
|
|
98
|
+
* - `src`: `https://static.ads-twitter.com/uwt.js`
|
|
99
|
+
* - `category`: 'marketing'
|
|
100
|
+
*/
|
|
101
|
+
script?: Partial<Script>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Creates an X Pixel script.
|
|
105
|
+
* 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.
|
|
106
|
+
*
|
|
107
|
+
* @param options - The options for the X Pixel script
|
|
108
|
+
* @returns The X Pixel script configuration
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* const xPixelScript = xPixel({
|
|
113
|
+
* pixelId: '123456789012345',
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @see {@link https://ads.twitter.com/help/article/x-pixel} X Pixel documentation
|
|
118
|
+
*/
|
|
119
|
+
export declare function xPixel({ pixelId, script }: XPixelOptions): Script;
|
|
120
|
+
/**
|
|
121
|
+
* @param eventId - The event ID to track
|
|
122
|
+
* @example 'tw-xxxx-xxxx'
|
|
123
|
+
* @param metadata - Optional metadata to track
|
|
124
|
+
*
|
|
125
|
+
* @usage
|
|
126
|
+
* ```ts
|
|
127
|
+
* xPixelEvent('tw-xxxx-xxxx', {
|
|
128
|
+
* value: 200.00,
|
|
129
|
+
* currency: 'USD',
|
|
130
|
+
* contents: [
|
|
131
|
+
* {content_id: 'OT001', content_name: 'bird seed', content_price: 50, num_items: 1},
|
|
132
|
+
* {content_id: 'OT002', content_name: 'bird cage', content_price: 150, num_items: 1}
|
|
133
|
+
* ]
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @see {@link https://business.x.com/en/help/campaign-measurement-and-analytics/conversion-tracking-for-websites#event-types-and-parameters}
|
|
138
|
+
*/
|
|
139
|
+
export declare const xPixelEvent: (eventId: string, metadata?: XPixelEvent) => void | undefined;
|
|
140
|
+
//# sourceMappingURL=x-pixel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x-pixel.d.ts","sourceRoot":"","sources":["../src/x-pixel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,MAAM,WAAW,aAAa;IAC7B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC1B;AACD,MAAM,WAAW,WAAW;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;CAC3B;AAGD,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,MAAM;QACf,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;KAClD;CACD;AAED,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,MAAM,CAkBjE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,WAAW,WAAW,qBAC1B,CAAC"}
|
package/dist/x-pixel.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function xPixel({ pixelId, script }) {
|
|
2
|
+
return {
|
|
3
|
+
id: script?.id ?? 'x-pixel',
|
|
4
|
+
category: script?.category ?? 'marketing',
|
|
5
|
+
textContent: `
|
|
6
|
+
!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);
|
|
7
|
+
},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='${script?.src ?? 'https://static.ads-twitter.com/uwt.js'}',
|
|
8
|
+
a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');
|
|
9
|
+
twq('config','${pixelId}');
|
|
10
|
+
`.trim(),
|
|
11
|
+
onDelete: (rest)=>{
|
|
12
|
+
delete window.twq;
|
|
13
|
+
if (script?.onDelete) script.onDelete(rest);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const xPixelEvent = (eventId, metadata)=>window.twq?.('event', eventId, metadata);
|
|
18
|
+
export { xPixel, xPixelEvent };
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@c15t/scripts",
|
|
3
|
+
"version": "1.0.0-canary-20251012181938",
|
|
4
|
+
"description": "Pre-built scripts of popular tools for c15t's script loader.",
|
|
5
|
+
"homepage": "https://c15t.com/docs/frameworks/javascript/script-loader",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/c15t/c15t.git",
|
|
9
|
+
"directory": "packages/scripts"
|
|
10
|
+
},
|
|
11
|
+
"license": "GPL-3.0-only",
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./*": {
|
|
16
|
+
"types": "./dist/*.d.ts",
|
|
17
|
+
"import": "./dist/*.js",
|
|
18
|
+
"require": "./dist/*.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"browserslist": [
|
|
25
|
+
">0.2%",
|
|
26
|
+
"not dead",
|
|
27
|
+
"not op_mini all"
|
|
28
|
+
],
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@c15t/typescript-config": "0.0.1-beta.1",
|
|
31
|
+
"@c15t/vitest-config": "1.0.0",
|
|
32
|
+
"c15t": "1.7.0-canary-20251012181938"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "rslib build",
|
|
39
|
+
"check-types": "tsc --noEmit",
|
|
40
|
+
"dev": "rslib build --watch",
|
|
41
|
+
"fmt": "pnpm biome format --write . && biome check --formatter-enabled=false --linter-enabled=false --write",
|
|
42
|
+
"lint": "pnpm biome lint ./src",
|
|
43
|
+
"test": "vitest run --passWithNoTests",
|
|
44
|
+
"test:watch": "vitest"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/readme.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "@c15t/scripts: Prebuilt Consent Scripts",
|
|
3
|
+
"description": "Prebuilt script integrations for c15t, providing ready-to-use consent-aware analytics and marketing scripts.",
|
|
4
|
+
"features": [
|
|
5
|
+
"Prebuilt script snippets for popular analytics and marketing tools",
|
|
6
|
+
"Easy integration with c15t's script loader",
|
|
7
|
+
"Configuration options for each supported vendor",
|
|
8
|
+
"Supported vendors include Google Tag Manager, Meta Pixel, PostHog, TikTok Pixel, LinkedIn Insights, Microsoft UET, and X Pixel"
|
|
9
|
+
],
|
|
10
|
+
"docsLink": "https://c15t.com/docs/integrations",
|
|
11
|
+
"showCLIGeneration": false
|
|
12
|
+
}
|