@shware/analytics 8.2.0 → 8.5.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 +78 -2
- package/dist/click-id/index.cjs +57 -3
- package/dist/click-id/index.cjs.map +1 -1
- package/dist/click-id/index.d.cts +16 -1
- package/dist/click-id/index.d.cts.map +1 -1
- package/dist/click-id/index.d.mts +16 -1
- package/dist/click-id/index.d.mts.map +1 -1
- package/dist/click-id/index.mjs +54 -4
- package/dist/click-id/index.mjs.map +1 -1
- package/dist/hooks/use-web-analytics.cjs +11 -5
- package/dist/hooks/use-web-analytics.cjs.map +1 -1
- package/dist/hooks/use-web-analytics.d.cts +4 -1
- package/dist/hooks/use-web-analytics.d.cts.map +1 -1
- package/dist/hooks/use-web-analytics.d.mts +4 -1
- package/dist/hooks/use-web-analytics.d.mts.map +1 -1
- package/dist/hooks/use-web-analytics.mjs +11 -5
- package/dist/hooks/use-web-analytics.mjs.map +1 -1
- package/dist/next/index.cjs +38 -2
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +3 -1
- package/dist/next/index.d.cts.map +1 -1
- package/dist/next/index.d.mts +3 -1
- package/dist/next/index.d.mts.map +1 -1
- package/dist/next/index.mjs +39 -3
- package/dist/next/index.mjs.map +1 -1
- package/dist/react-router/index.cjs +25 -3
- package/dist/react-router/index.cjs.map +1 -1
- package/dist/react-router/index.d.cts +3 -1
- package/dist/react-router/index.d.cts.map +1 -1
- package/dist/react-router/index.d.mts +3 -1
- package/dist/react-router/index.d.mts.map +1 -1
- package/dist/react-router/index.mjs +25 -3
- package/dist/react-router/index.mjs.map +1 -1
- package/dist/schema/index.cjs +1 -0
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +4 -0
- package/dist/schema/index.d.cts.map +1 -1
- package/dist/schema/index.d.mts +4 -0
- package/dist/schema/index.d.mts.map +1 -1
- package/dist/schema/index.mjs +1 -0
- package/dist/schema/index.mjs.map +1 -1
- package/dist/server/google-data-manager.cjs +2 -0
- package/dist/server/google-data-manager.cjs.map +1 -1
- package/dist/server/google-data-manager.d.cts.map +1 -1
- package/dist/server/google-data-manager.d.mts.map +1 -1
- package/dist/server/google-data-manager.mjs +2 -0
- package/dist/server/google-data-manager.mjs.map +1 -1
- package/dist/server/index.cjs +8 -0
- package/dist/server/index.d.cts +5 -4
- package/dist/server/index.d.mts +5 -4
- package/dist/server/index.mjs +5 -4
- package/dist/server/microsoft-conversions-api.cjs +171 -0
- package/dist/server/microsoft-conversions-api.cjs.map +1 -0
- package/dist/server/microsoft-conversions-api.d.cts +124 -0
- package/dist/server/microsoft-conversions-api.d.cts.map +1 -0
- package/dist/server/microsoft-conversions-api.d.mts +124 -0
- package/dist/server/microsoft-conversions-api.d.mts.map +1 -0
- package/dist/server/microsoft-conversions-api.mjs +168 -0
- package/dist/server/microsoft-conversions-api.mjs.map +1 -0
- package/dist/tanstack/analytics.cjs +25 -3
- package/dist/tanstack/analytics.cjs.map +1 -1
- package/dist/tanstack/analytics.d.cts +3 -1
- package/dist/tanstack/analytics.d.cts.map +1 -1
- package/dist/tanstack/analytics.d.mts +3 -1
- package/dist/tanstack/analytics.d.mts.map +1 -1
- package/dist/tanstack/analytics.mjs +25 -3
- package/dist/tanstack/analytics.mjs.map +1 -1
- package/dist/tanstack/middleware.cjs +2 -1
- package/dist/tanstack/middleware.cjs.map +1 -1
- package/dist/tanstack/middleware.d.cts +2 -1
- package/dist/tanstack/middleware.d.cts.map +1 -1
- package/dist/tanstack/middleware.d.mts +2 -1
- package/dist/tanstack/middleware.d.mts.map +1 -1
- package/dist/tanstack/middleware.mjs +2 -1
- package/dist/tanstack/middleware.mjs.map +1 -1
- package/dist/third-parties/index.cjs +5 -0
- package/dist/third-parties/index.d.cts +3 -1
- package/dist/third-parties/index.d.mts +3 -1
- package/dist/third-parties/index.mjs +2 -1
- package/dist/third-parties/microsoft-uet.cjs +119 -0
- package/dist/third-parties/microsoft-uet.cjs.map +1 -0
- package/dist/third-parties/microsoft-uet.d.cts +70 -0
- package/dist/third-parties/microsoft-uet.d.cts.map +1 -0
- package/dist/third-parties/microsoft-uet.d.mts +70 -0
- package/dist/third-parties/microsoft-uet.d.mts.map +1 -0
- package/dist/third-parties/microsoft-uet.mjs +115 -0
- package/dist/third-parties/microsoft-uet.mjs.map +1 -0
- package/dist/third-parties/openai-pixel.cjs +2 -7
- package/dist/third-parties/openai-pixel.cjs.map +1 -1
- package/dist/third-parties/openai-pixel.d.cts.map +1 -1
- package/dist/third-parties/openai-pixel.d.mts.map +1 -1
- package/dist/third-parties/openai-pixel.mjs +1 -6
- package/dist/third-parties/openai-pixel.mjs.map +1 -1
- package/dist/track/types.d.cts +7 -0
- package/dist/track/types.d.cts.map +1 -1
- package/dist/track/types.d.mts +7 -0
- package/dist/track/types.d.mts.map +1 -1
- package/dist/track/uetq.cjs +80 -0
- package/dist/track/uetq.cjs.map +1 -0
- package/dist/track/uetq.d.cts +111 -0
- package/dist/track/uetq.d.cts.map +1 -0
- package/dist/track/uetq.d.mts +111 -0
- package/dist/track/uetq.d.mts.map +1 -0
- package/dist/track/uetq.mjs +78 -0
- package/dist/track/uetq.mjs.map +1 -0
- package/dist/utils/sha256.cjs +19 -0
- package/dist/utils/sha256.cjs.map +1 -0
- package/dist/utils/sha256.d.cts +13 -0
- package/dist/utils/sha256.d.cts.map +1 -0
- package/dist/utils/sha256.d.mts +13 -0
- package/dist/utils/sha256.d.mts.map +1 -0
- package/dist/utils/sha256.mjs +18 -0
- package/dist/utils/sha256.mjs.map +1 -0
- package/dist/web/index.cjs +26 -2
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts.map +1 -1
- package/dist/web/index.d.mts.map +1 -1
- package/dist/web/index.mjs +27 -3
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/page-key.cjs +53 -0
- package/dist/web/page-key.cjs.map +1 -0
- package/dist/web/page-key.d.cts +24 -0
- package/dist/web/page-key.d.cts.map +1 -0
- package/dist/web/page-key.d.mts +24 -0
- package/dist/web/page-key.d.mts.map +1 -0
- package/dist/web/page-key.mjs +52 -0
- package/dist/web/page-key.mjs.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils_field = require("../utils/field.cjs");
|
|
3
|
+
const require_track_uetq = require("../track/uetq.cjs");
|
|
4
|
+
const require_utils_sha256 = require("../utils/sha256.cjs");
|
|
5
|
+
//#region src/third-parties/microsoft-uet.ts
|
|
6
|
+
const metrics = [
|
|
7
|
+
"CLS",
|
|
8
|
+
"FCP",
|
|
9
|
+
"FID",
|
|
10
|
+
"INP",
|
|
11
|
+
"LCP",
|
|
12
|
+
"TTFB"
|
|
13
|
+
];
|
|
14
|
+
/** Drop `undefined` fields: bat.js validates every key it receives, and `undefined` is a value. */
|
|
15
|
+
function clean(value) {
|
|
16
|
+
return JSON.parse(JSON.stringify(value));
|
|
17
|
+
}
|
|
18
|
+
function isLocal() {
|
|
19
|
+
return window.location.host.includes("127.0.0.1") || window.location.host.includes("localhost");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Forward an internal track event to the Microsoft Advertising UET tag.
|
|
23
|
+
*
|
|
24
|
+
* `eventId` is reused as UET's `event_id` so the browser event deduplicates against the same
|
|
25
|
+
* conversion sent through the Conversions API (`sendMicrosoftEvents`). The action name is the
|
|
26
|
+
* internal name on both channels — see `mapUETEvent`.
|
|
27
|
+
*
|
|
28
|
+
* `page_view` is not forwarded: bat.js turns that action into its page-load beacon, which the
|
|
29
|
+
* snippet already fires on load and, with `enableAutoSpaTracking: true` (the setting in
|
|
30
|
+
* Microsoft's generated snippet), on every history change — forwarding the SDK's own page views
|
|
31
|
+
* would report each page twice. The tag owns page loads; this tracker owns everything else.
|
|
32
|
+
*/
|
|
33
|
+
function sendUETEvent(name, properties, eventId) {
|
|
34
|
+
if (typeof window === "undefined" || !window.uetq) {
|
|
35
|
+
console.warn("uetq has not been initialized");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (metrics.includes(name) || name === "page_view") return;
|
|
39
|
+
if (isLocal()) return;
|
|
40
|
+
const [action, params] = require_track_uetq.mapUETEvent(name, properties, eventId);
|
|
41
|
+
window.uetq.push("event", action, clean(params));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Enhanced conversions: hand the tag the visitor's email and phone so Microsoft can match a
|
|
45
|
+
* conversion to an ad click without a third-party cookie. A `set` applies to every event fired
|
|
46
|
+
* from the page afterwards, `pageLoad` included, and the tag fires a `pid` beacon on its own
|
|
47
|
+
* when the page load already went out. Values are sent raw — the tag normalizes and SHA-256
|
|
48
|
+
* hashes them in the browser (bat.js `validatePid`) before anything leaves the page.
|
|
49
|
+
*
|
|
50
|
+
* No tag id parameter: unlike the Meta/Reddit pixels, UET is bound to its tag by the snippet
|
|
51
|
+
* and `set` addresses whichever tag drains `uetq`.
|
|
52
|
+
*/
|
|
53
|
+
function setUETUser() {
|
|
54
|
+
return ({ user_data }) => {
|
|
55
|
+
if (typeof window === "undefined" || !window.uetq) {
|
|
56
|
+
console.warn("uetq has not been initialized");
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const em = require_utils_field.getFirst(user_data?.email);
|
|
60
|
+
const ph = require_utils_field.getFirst(user_data?.phone_number);
|
|
61
|
+
if (!em && !ph) return;
|
|
62
|
+
window.uetq.push("set", { pid: clean({
|
|
63
|
+
em,
|
|
64
|
+
ph
|
|
65
|
+
}) });
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* UET consent mode. Push `default` before the tag loads (the tag processes `consent` early, ahead
|
|
70
|
+
* of the queued events) and `update` when the visitor decides. With `ad_storage: 'denied'` the
|
|
71
|
+
* tag neither writes its cookies nor reads the `msclkid` from the URL.
|
|
72
|
+
* https://help.ads.microsoft.com/#apex/ads/en/60119/1
|
|
73
|
+
*/
|
|
74
|
+
function setUETConsent(mode, consent) {
|
|
75
|
+
if (typeof window === "undefined") return;
|
|
76
|
+
window.uetq ??= [];
|
|
77
|
+
window.uetq.push("consent", mode, consent);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The Conversions API's client-side ID Sync pixel: ties the visitor id sent server-side as
|
|
81
|
+
* `anonymousId` to Microsoft's own identifier, so server events can be attributed across
|
|
82
|
+
* contexts (view-through, audiences). Microsoft requires it for remarketing built from CAPI
|
|
83
|
+
* events and recommends it for measurement quality; fire it at least once per session, ideally
|
|
84
|
+
* on the first page view. A pixel rather than a fetch on purpose: Microsoft must observe the
|
|
85
|
+
* browser context of the sync, which a server-side call cannot carry.
|
|
86
|
+
*
|
|
87
|
+
* `customerId` is the Microsoft Advertising customer id (`cid` in the UI's URLs) — not the UET
|
|
88
|
+
* tag id. `visitorId` is the SDK visitor id (`getVisitor().id`), which is what
|
|
89
|
+
* `sendMicrosoftEvents` sends as `anonymousId`; Microsoft requires the two to be equal.
|
|
90
|
+
* `userId` is the raw signed-in user id: it is SHA-256 hashed here, exactly as the server sender
|
|
91
|
+
* hashes it into `externalId`, so the pair matches as well. Hashing is asynchronous, so the
|
|
92
|
+
* pixel fires once the digest resolves; where SubtleCrypto is unavailable (an insecure context)
|
|
93
|
+
* the pixel goes out without `UID` rather than with a raw id.
|
|
94
|
+
* https://learn.microsoft.com/en-us/advertising/guides/uet-conversion-api-integration#id-sync-and-why-it-matters
|
|
95
|
+
*/
|
|
96
|
+
function sendUETIdSync(options) {
|
|
97
|
+
if (typeof window === "undefined" || typeof Image === "undefined") return;
|
|
98
|
+
if (isLocal()) return;
|
|
99
|
+
const fire = (uid) => {
|
|
100
|
+
const params = new URLSearchParams({
|
|
101
|
+
Red3: `BACID_${options.customerId}`,
|
|
102
|
+
VID: options.visitorId
|
|
103
|
+
});
|
|
104
|
+
if (uid) params.set("UID", uid);
|
|
105
|
+
new Image().src = `https://c.bing.com/c.gif?${params.toString()}`;
|
|
106
|
+
};
|
|
107
|
+
if (!options.userId) {
|
|
108
|
+
fire();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
require_utils_sha256.sha256(options.userId).then(fire, () => fire());
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
exports.sendUETEvent = sendUETEvent;
|
|
115
|
+
exports.sendUETIdSync = sendUETIdSync;
|
|
116
|
+
exports.setUETConsent = setUETConsent;
|
|
117
|
+
exports.setUETUser = setUETUser;
|
|
118
|
+
|
|
119
|
+
//# sourceMappingURL=microsoft-uet.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"microsoft-uet.cjs","names":["mapUETEvent","getFirst"],"sources":["../../src/third-parties/microsoft-uet.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { type UETConsent, type UETQ, mapUETEvent } from '../track/uetq';\nimport { getFirst } from '../utils/field';\nimport { sha256 } from '../utils/sha256';\n\ndeclare global {\n interface Window {\n /**\n * Defined by the UET snippet before `bat.js` loads (as a plain array), so pushes made early\n * are queued rather than lost. Undefined only where the snippet was never installed.\n */\n uetq?: UETQ;\n }\n}\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\n/** Drop `undefined` fields: bat.js validates every key it receives, and `undefined` is a value. */\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nfunction clean(value: unknown): any {\n return JSON.parse(JSON.stringify(value));\n}\n\nfunction isLocal(): boolean {\n return window.location.host.includes('127.0.0.1') || window.location.host.includes('localhost');\n}\n\n/**\n * Forward an internal track event to the Microsoft Advertising UET tag.\n *\n * `eventId` is reused as UET's `event_id` so the browser event deduplicates against the same\n * conversion sent through the Conversions API (`sendMicrosoftEvents`). The action name is the\n * internal name on both channels — see `mapUETEvent`.\n *\n * `page_view` is not forwarded: bat.js turns that action into its page-load beacon, which the\n * snippet already fires on load and, with `enableAutoSpaTracking: true` (the setting in\n * Microsoft's generated snippet), on every history change — forwarding the SDK's own page views\n * would report each page twice. The tag owns page loads; this tracker owns everything else.\n */\nexport function sendUETEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.uetq) {\n console.warn('uetq has not been initialized');\n return;\n }\n if (metrics.includes(name) || name === 'page_view') return;\n if (isLocal()) return;\n\n const [action, params] = mapUETEvent(name, properties, eventId);\n window.uetq.push('event', action, clean(params));\n}\n\n/**\n * Enhanced conversions: hand the tag the visitor's email and phone so Microsoft can match a\n * conversion to an ad click without a third-party cookie. A `set` applies to every event fired\n * from the page afterwards, `pageLoad` included, and the tag fires a `pid` beacon on its own\n * when the page load already went out. Values are sent raw — the tag normalizes and SHA-256\n * hashes them in the browser (bat.js `validatePid`) before anything leaves the page.\n *\n * No tag id parameter: unlike the Meta/Reddit pixels, UET is bound to its tag by the snippet\n * and `set` addresses whichever tag drains `uetq`.\n */\nexport function setUETUser() {\n return ({ user_data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.uetq) {\n console.warn('uetq has not been initialized');\n return;\n }\n\n const em = getFirst(user_data?.email);\n const ph = getFirst(user_data?.phone_number);\n if (!em && !ph) return;\n\n window.uetq.push('set', { pid: clean({ em, ph }) });\n };\n}\n\n/**\n * UET consent mode. Push `default` before the tag loads (the tag processes `consent` early, ahead\n * of the queued events) and `update` when the visitor decides. With `ad_storage: 'denied'` the\n * tag neither writes its cookies nor reads the `msclkid` from the URL.\n * https://help.ads.microsoft.com/#apex/ads/en/60119/1\n */\nexport function setUETConsent(mode: 'default' | 'update', consent: UETConsent) {\n if (typeof window === 'undefined') return;\n window.uetq ??= [] as unknown as UETQ;\n window.uetq.push('consent', mode, consent);\n}\n\n/**\n * The Conversions API's client-side ID Sync pixel: ties the visitor id sent server-side as\n * `anonymousId` to Microsoft's own identifier, so server events can be attributed across\n * contexts (view-through, audiences). Microsoft requires it for remarketing built from CAPI\n * events and recommends it for measurement quality; fire it at least once per session, ideally\n * on the first page view. A pixel rather than a fetch on purpose: Microsoft must observe the\n * browser context of the sync, which a server-side call cannot carry.\n *\n * `customerId` is the Microsoft Advertising customer id (`cid` in the UI's URLs) — not the UET\n * tag id. `visitorId` is the SDK visitor id (`getVisitor().id`), which is what\n * `sendMicrosoftEvents` sends as `anonymousId`; Microsoft requires the two to be equal.\n * `userId` is the raw signed-in user id: it is SHA-256 hashed here, exactly as the server sender\n * hashes it into `externalId`, so the pair matches as well. Hashing is asynchronous, so the\n * pixel fires once the digest resolves; where SubtleCrypto is unavailable (an insecure context)\n * the pixel goes out without `UID` rather than with a raw id.\n * https://learn.microsoft.com/en-us/advertising/guides/uet-conversion-api-integration#id-sync-and-why-it-matters\n */\nexport function sendUETIdSync(options: {\n customerId: string | number;\n visitorId: string;\n /** The signed-in user's id, raw; hashed before it leaves the page. */\n userId?: string;\n}) {\n if (typeof window === 'undefined' || typeof Image === 'undefined') return;\n if (isLocal()) return;\n\n const fire = (uid?: string) => {\n const params = new URLSearchParams({\n Red3: `BACID_${options.customerId}`,\n VID: options.visitorId,\n });\n if (uid) params.set('UID', uid);\n new Image().src = `https://c.bing.com/c.gif?${params.toString()}`;\n };\n\n if (!options.userId) {\n fire();\n return;\n }\n sha256(options.userId).then(fire, () => fire());\n}\n"],"mappings":";;;;;AAgBA,MAAM,UAAU;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;AAAM;;AAI1D,SAAS,MAAM,OAAqB;CAClC,OAAO,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC;AACzC;AAEA,SAAS,UAAmB;CAC1B,OAAO,OAAO,SAAS,KAAK,SAAS,WAAW,KAAK,OAAO,SAAS,KAAK,SAAS,WAAW;AAChG;;;;;;;;;;;;;AAcA,SAAgB,aACd,MACA,YACA,SACA;CACA,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,+BAA+B;EAC5C;CACF;CACA,IAAI,QAAQ,SAAS,IAAI,KAAK,SAAS,aAAa;CACpD,IAAI,QAAQ,GAAG;CAEf,MAAM,CAAC,QAAQ,UAAUA,mBAAAA,YAAY,MAAM,YAAY,OAAO;CAC9D,OAAO,KAAK,KAAK,SAAS,QAAQ,MAAM,MAAM,CAAC;AACjD;;;;;;;;;;;AAYA,SAAgB,aAAa;CAC3B,QAAQ,EAAE,gBAAkC;EAC1C,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;GACjD,QAAQ,KAAK,+BAA+B;GAC5C;EACF;EAEA,MAAM,KAAKC,oBAAAA,SAAS,WAAW,KAAK;EACpC,MAAM,KAAKA,oBAAAA,SAAS,WAAW,YAAY;EAC3C,IAAI,CAAC,MAAM,CAAC,IAAI;EAEhB,OAAO,KAAK,KAAK,OAAO,EAAE,KAAK,MAAM;GAAE;GAAI;EAAG,CAAC,EAAE,CAAC;CACpD;AACF;;;;;;;AAQA,SAAgB,cAAc,MAA4B,SAAqB;CAC7E,IAAI,OAAO,WAAW,aAAa;CACnC,OAAO,SAAS,CAAC;CACjB,OAAO,KAAK,KAAK,WAAW,MAAM,OAAO;AAC3C;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,cAAc,SAK3B;CACD,IAAI,OAAO,WAAW,eAAe,OAAO,UAAU,aAAa;CACnE,IAAI,QAAQ,GAAG;CAEf,MAAM,QAAQ,QAAiB;EAC7B,MAAM,SAAS,IAAI,gBAAgB;GACjC,MAAM,SAAS,QAAQ;GACvB,KAAK,QAAQ;EACf,CAAC;EACD,IAAI,KAAK,OAAO,IAAI,OAAO,GAAG;EAC9B,IAAI,MAAM,CAAC,CAAC,MAAM,4BAA4B,OAAO,SAAS;CAChE;CAEA,IAAI,CAAC,QAAQ,QAAQ;EACnB,KAAK;EACL;CACF;CACA,qBAAA,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;AAChD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { UpdateVisitorDTO } from "../schema/index.cjs";
|
|
2
|
+
import { EventName, TrackName, TrackProperties } from "../track/types.cjs";
|
|
3
|
+
import { UETConsent, UETQ } from "../track/uetq.cjs";
|
|
4
|
+
//#region src/third-parties/microsoft-uet.d.ts
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
/**
|
|
8
|
+
* Defined by the UET snippet before `bat.js` loads (as a plain array), so pushes made early
|
|
9
|
+
* are queued rather than lost. Undefined only where the snippet was never installed.
|
|
10
|
+
*/
|
|
11
|
+
uetq?: UETQ;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Forward an internal track event to the Microsoft Advertising UET tag.
|
|
16
|
+
*
|
|
17
|
+
* `eventId` is reused as UET's `event_id` so the browser event deduplicates against the same
|
|
18
|
+
* conversion sent through the Conversions API (`sendMicrosoftEvents`). The action name is the
|
|
19
|
+
* internal name on both channels — see `mapUETEvent`.
|
|
20
|
+
*
|
|
21
|
+
* `page_view` is not forwarded: bat.js turns that action into its page-load beacon, which the
|
|
22
|
+
* snippet already fires on load and, with `enableAutoSpaTracking: true` (the setting in
|
|
23
|
+
* Microsoft's generated snippet), on every history change — forwarding the SDK's own page views
|
|
24
|
+
* would report each page twice. The tag owns page loads; this tracker owns everything else.
|
|
25
|
+
*/
|
|
26
|
+
declare function sendUETEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, eventId?: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Enhanced conversions: hand the tag the visitor's email and phone so Microsoft can match a
|
|
29
|
+
* conversion to an ad click without a third-party cookie. A `set` applies to every event fired
|
|
30
|
+
* from the page afterwards, `pageLoad` included, and the tag fires a `pid` beacon on its own
|
|
31
|
+
* when the page load already went out. Values are sent raw — the tag normalizes and SHA-256
|
|
32
|
+
* hashes them in the browser (bat.js `validatePid`) before anything leaves the page.
|
|
33
|
+
*
|
|
34
|
+
* No tag id parameter: unlike the Meta/Reddit pixels, UET is bound to its tag by the snippet
|
|
35
|
+
* and `set` addresses whichever tag drains `uetq`.
|
|
36
|
+
*/
|
|
37
|
+
declare function setUETUser(): ({ user_data }: UpdateVisitorDTO) => void;
|
|
38
|
+
/**
|
|
39
|
+
* UET consent mode. Push `default` before the tag loads (the tag processes `consent` early, ahead
|
|
40
|
+
* of the queued events) and `update` when the visitor decides. With `ad_storage: 'denied'` the
|
|
41
|
+
* tag neither writes its cookies nor reads the `msclkid` from the URL.
|
|
42
|
+
* https://help.ads.microsoft.com/#apex/ads/en/60119/1
|
|
43
|
+
*/
|
|
44
|
+
declare function setUETConsent(mode: 'default' | 'update', consent: UETConsent): void;
|
|
45
|
+
/**
|
|
46
|
+
* The Conversions API's client-side ID Sync pixel: ties the visitor id sent server-side as
|
|
47
|
+
* `anonymousId` to Microsoft's own identifier, so server events can be attributed across
|
|
48
|
+
* contexts (view-through, audiences). Microsoft requires it for remarketing built from CAPI
|
|
49
|
+
* events and recommends it for measurement quality; fire it at least once per session, ideally
|
|
50
|
+
* on the first page view. A pixel rather than a fetch on purpose: Microsoft must observe the
|
|
51
|
+
* browser context of the sync, which a server-side call cannot carry.
|
|
52
|
+
*
|
|
53
|
+
* `customerId` is the Microsoft Advertising customer id (`cid` in the UI's URLs) — not the UET
|
|
54
|
+
* tag id. `visitorId` is the SDK visitor id (`getVisitor().id`), which is what
|
|
55
|
+
* `sendMicrosoftEvents` sends as `anonymousId`; Microsoft requires the two to be equal.
|
|
56
|
+
* `userId` is the raw signed-in user id: it is SHA-256 hashed here, exactly as the server sender
|
|
57
|
+
* hashes it into `externalId`, so the pair matches as well. Hashing is asynchronous, so the
|
|
58
|
+
* pixel fires once the digest resolves; where SubtleCrypto is unavailable (an insecure context)
|
|
59
|
+
* the pixel goes out without `UID` rather than with a raw id.
|
|
60
|
+
* https://learn.microsoft.com/en-us/advertising/guides/uet-conversion-api-integration#id-sync-and-why-it-matters
|
|
61
|
+
*/
|
|
62
|
+
declare function sendUETIdSync(options: {
|
|
63
|
+
customerId: string | number;
|
|
64
|
+
visitorId: string;
|
|
65
|
+
/** The signed-in user's id, raw; hashed before it leaves the page. */
|
|
66
|
+
userId?: string;
|
|
67
|
+
}): void;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { sendUETEvent, sendUETIdSync, setUETConsent, setUETUser };
|
|
70
|
+
//# sourceMappingURL=microsoft-uet.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"microsoft-uet.d.cts","names":[],"sources":["../../src/third-parties/microsoft-uet.ts"],"mappings":";;;;QAMQ;YACI;;;;;IAKR,OAAO;;;;;;;;;;;;;;;iBA4BK,aAAa,UAAU,WACrC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;;;;;;;;;;;iBAuBc,iBAAU,aACD;;;;;;;iBAoBT,cAAc,4BAA4B,SAAS;;;;;;;;;;;;;;;;;;iBAuBnD,cAAc;EAC5B;EACA;;EAEA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { UpdateVisitorDTO } from "../schema/index.mjs";
|
|
2
|
+
import { EventName, TrackName, TrackProperties } from "../track/types.mjs";
|
|
3
|
+
import { UETConsent, UETQ } from "../track/uetq.mjs";
|
|
4
|
+
//#region src/third-parties/microsoft-uet.d.ts
|
|
5
|
+
declare global {
|
|
6
|
+
interface Window {
|
|
7
|
+
/**
|
|
8
|
+
* Defined by the UET snippet before `bat.js` loads (as a plain array), so pushes made early
|
|
9
|
+
* are queued rather than lost. Undefined only where the snippet was never installed.
|
|
10
|
+
*/
|
|
11
|
+
uetq?: UETQ;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Forward an internal track event to the Microsoft Advertising UET tag.
|
|
16
|
+
*
|
|
17
|
+
* `eventId` is reused as UET's `event_id` so the browser event deduplicates against the same
|
|
18
|
+
* conversion sent through the Conversions API (`sendMicrosoftEvents`). The action name is the
|
|
19
|
+
* internal name on both channels — see `mapUETEvent`.
|
|
20
|
+
*
|
|
21
|
+
* `page_view` is not forwarded: bat.js turns that action into its page-load beacon, which the
|
|
22
|
+
* snippet already fires on load and, with `enableAutoSpaTracking: true` (the setting in
|
|
23
|
+
* Microsoft's generated snippet), on every history change — forwarding the SDK's own page views
|
|
24
|
+
* would report each page twice. The tag owns page loads; this tracker owns everything else.
|
|
25
|
+
*/
|
|
26
|
+
declare function sendUETEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, eventId?: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Enhanced conversions: hand the tag the visitor's email and phone so Microsoft can match a
|
|
29
|
+
* conversion to an ad click without a third-party cookie. A `set` applies to every event fired
|
|
30
|
+
* from the page afterwards, `pageLoad` included, and the tag fires a `pid` beacon on its own
|
|
31
|
+
* when the page load already went out. Values are sent raw — the tag normalizes and SHA-256
|
|
32
|
+
* hashes them in the browser (bat.js `validatePid`) before anything leaves the page.
|
|
33
|
+
*
|
|
34
|
+
* No tag id parameter: unlike the Meta/Reddit pixels, UET is bound to its tag by the snippet
|
|
35
|
+
* and `set` addresses whichever tag drains `uetq`.
|
|
36
|
+
*/
|
|
37
|
+
declare function setUETUser(): ({ user_data }: UpdateVisitorDTO) => void;
|
|
38
|
+
/**
|
|
39
|
+
* UET consent mode. Push `default` before the tag loads (the tag processes `consent` early, ahead
|
|
40
|
+
* of the queued events) and `update` when the visitor decides. With `ad_storage: 'denied'` the
|
|
41
|
+
* tag neither writes its cookies nor reads the `msclkid` from the URL.
|
|
42
|
+
* https://help.ads.microsoft.com/#apex/ads/en/60119/1
|
|
43
|
+
*/
|
|
44
|
+
declare function setUETConsent(mode: 'default' | 'update', consent: UETConsent): void;
|
|
45
|
+
/**
|
|
46
|
+
* The Conversions API's client-side ID Sync pixel: ties the visitor id sent server-side as
|
|
47
|
+
* `anonymousId` to Microsoft's own identifier, so server events can be attributed across
|
|
48
|
+
* contexts (view-through, audiences). Microsoft requires it for remarketing built from CAPI
|
|
49
|
+
* events and recommends it for measurement quality; fire it at least once per session, ideally
|
|
50
|
+
* on the first page view. A pixel rather than a fetch on purpose: Microsoft must observe the
|
|
51
|
+
* browser context of the sync, which a server-side call cannot carry.
|
|
52
|
+
*
|
|
53
|
+
* `customerId` is the Microsoft Advertising customer id (`cid` in the UI's URLs) — not the UET
|
|
54
|
+
* tag id. `visitorId` is the SDK visitor id (`getVisitor().id`), which is what
|
|
55
|
+
* `sendMicrosoftEvents` sends as `anonymousId`; Microsoft requires the two to be equal.
|
|
56
|
+
* `userId` is the raw signed-in user id: it is SHA-256 hashed here, exactly as the server sender
|
|
57
|
+
* hashes it into `externalId`, so the pair matches as well. Hashing is asynchronous, so the
|
|
58
|
+
* pixel fires once the digest resolves; where SubtleCrypto is unavailable (an insecure context)
|
|
59
|
+
* the pixel goes out without `UID` rather than with a raw id.
|
|
60
|
+
* https://learn.microsoft.com/en-us/advertising/guides/uet-conversion-api-integration#id-sync-and-why-it-matters
|
|
61
|
+
*/
|
|
62
|
+
declare function sendUETIdSync(options: {
|
|
63
|
+
customerId: string | number;
|
|
64
|
+
visitorId: string;
|
|
65
|
+
/** The signed-in user's id, raw; hashed before it leaves the page. */
|
|
66
|
+
userId?: string;
|
|
67
|
+
}): void;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { sendUETEvent, sendUETIdSync, setUETConsent, setUETUser };
|
|
70
|
+
//# sourceMappingURL=microsoft-uet.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"microsoft-uet.d.mts","names":[],"sources":["../../src/third-parties/microsoft-uet.ts"],"mappings":";;;;QAMQ;YACI;;;;;IAKR,OAAO;;;;;;;;;;;;;;;iBA4BK,aAAa,UAAU,WACrC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;;;;;;;;;;;iBAuBc,iBAAU,aACD;;;;;;;iBAoBT,cAAc,4BAA4B,SAAS;;;;;;;;;;;;;;;;;;iBAuBnD,cAAc;EAC5B;EACA;;EAEA"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { getFirst } from "../utils/field.mjs";
|
|
2
|
+
import { mapUETEvent } from "../track/uetq.mjs";
|
|
3
|
+
import { sha256 } from "../utils/sha256.mjs";
|
|
4
|
+
//#region src/third-parties/microsoft-uet.ts
|
|
5
|
+
const metrics = [
|
|
6
|
+
"CLS",
|
|
7
|
+
"FCP",
|
|
8
|
+
"FID",
|
|
9
|
+
"INP",
|
|
10
|
+
"LCP",
|
|
11
|
+
"TTFB"
|
|
12
|
+
];
|
|
13
|
+
/** Drop `undefined` fields: bat.js validates every key it receives, and `undefined` is a value. */
|
|
14
|
+
function clean(value) {
|
|
15
|
+
return JSON.parse(JSON.stringify(value));
|
|
16
|
+
}
|
|
17
|
+
function isLocal() {
|
|
18
|
+
return window.location.host.includes("127.0.0.1") || window.location.host.includes("localhost");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Forward an internal track event to the Microsoft Advertising UET tag.
|
|
22
|
+
*
|
|
23
|
+
* `eventId` is reused as UET's `event_id` so the browser event deduplicates against the same
|
|
24
|
+
* conversion sent through the Conversions API (`sendMicrosoftEvents`). The action name is the
|
|
25
|
+
* internal name on both channels — see `mapUETEvent`.
|
|
26
|
+
*
|
|
27
|
+
* `page_view` is not forwarded: bat.js turns that action into its page-load beacon, which the
|
|
28
|
+
* snippet already fires on load and, with `enableAutoSpaTracking: true` (the setting in
|
|
29
|
+
* Microsoft's generated snippet), on every history change — forwarding the SDK's own page views
|
|
30
|
+
* would report each page twice. The tag owns page loads; this tracker owns everything else.
|
|
31
|
+
*/
|
|
32
|
+
function sendUETEvent(name, properties, eventId) {
|
|
33
|
+
if (typeof window === "undefined" || !window.uetq) {
|
|
34
|
+
console.warn("uetq has not been initialized");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (metrics.includes(name) || name === "page_view") return;
|
|
38
|
+
if (isLocal()) return;
|
|
39
|
+
const [action, params] = mapUETEvent(name, properties, eventId);
|
|
40
|
+
window.uetq.push("event", action, clean(params));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Enhanced conversions: hand the tag the visitor's email and phone so Microsoft can match a
|
|
44
|
+
* conversion to an ad click without a third-party cookie. A `set` applies to every event fired
|
|
45
|
+
* from the page afterwards, `pageLoad` included, and the tag fires a `pid` beacon on its own
|
|
46
|
+
* when the page load already went out. Values are sent raw — the tag normalizes and SHA-256
|
|
47
|
+
* hashes them in the browser (bat.js `validatePid`) before anything leaves the page.
|
|
48
|
+
*
|
|
49
|
+
* No tag id parameter: unlike the Meta/Reddit pixels, UET is bound to its tag by the snippet
|
|
50
|
+
* and `set` addresses whichever tag drains `uetq`.
|
|
51
|
+
*/
|
|
52
|
+
function setUETUser() {
|
|
53
|
+
return ({ user_data }) => {
|
|
54
|
+
if (typeof window === "undefined" || !window.uetq) {
|
|
55
|
+
console.warn("uetq has not been initialized");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const em = getFirst(user_data?.email);
|
|
59
|
+
const ph = getFirst(user_data?.phone_number);
|
|
60
|
+
if (!em && !ph) return;
|
|
61
|
+
window.uetq.push("set", { pid: clean({
|
|
62
|
+
em,
|
|
63
|
+
ph
|
|
64
|
+
}) });
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* UET consent mode. Push `default` before the tag loads (the tag processes `consent` early, ahead
|
|
69
|
+
* of the queued events) and `update` when the visitor decides. With `ad_storage: 'denied'` the
|
|
70
|
+
* tag neither writes its cookies nor reads the `msclkid` from the URL.
|
|
71
|
+
* https://help.ads.microsoft.com/#apex/ads/en/60119/1
|
|
72
|
+
*/
|
|
73
|
+
function setUETConsent(mode, consent) {
|
|
74
|
+
if (typeof window === "undefined") return;
|
|
75
|
+
window.uetq ??= [];
|
|
76
|
+
window.uetq.push("consent", mode, consent);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The Conversions API's client-side ID Sync pixel: ties the visitor id sent server-side as
|
|
80
|
+
* `anonymousId` to Microsoft's own identifier, so server events can be attributed across
|
|
81
|
+
* contexts (view-through, audiences). Microsoft requires it for remarketing built from CAPI
|
|
82
|
+
* events and recommends it for measurement quality; fire it at least once per session, ideally
|
|
83
|
+
* on the first page view. A pixel rather than a fetch on purpose: Microsoft must observe the
|
|
84
|
+
* browser context of the sync, which a server-side call cannot carry.
|
|
85
|
+
*
|
|
86
|
+
* `customerId` is the Microsoft Advertising customer id (`cid` in the UI's URLs) — not the UET
|
|
87
|
+
* tag id. `visitorId` is the SDK visitor id (`getVisitor().id`), which is what
|
|
88
|
+
* `sendMicrosoftEvents` sends as `anonymousId`; Microsoft requires the two to be equal.
|
|
89
|
+
* `userId` is the raw signed-in user id: it is SHA-256 hashed here, exactly as the server sender
|
|
90
|
+
* hashes it into `externalId`, so the pair matches as well. Hashing is asynchronous, so the
|
|
91
|
+
* pixel fires once the digest resolves; where SubtleCrypto is unavailable (an insecure context)
|
|
92
|
+
* the pixel goes out without `UID` rather than with a raw id.
|
|
93
|
+
* https://learn.microsoft.com/en-us/advertising/guides/uet-conversion-api-integration#id-sync-and-why-it-matters
|
|
94
|
+
*/
|
|
95
|
+
function sendUETIdSync(options) {
|
|
96
|
+
if (typeof window === "undefined" || typeof Image === "undefined") return;
|
|
97
|
+
if (isLocal()) return;
|
|
98
|
+
const fire = (uid) => {
|
|
99
|
+
const params = new URLSearchParams({
|
|
100
|
+
Red3: `BACID_${options.customerId}`,
|
|
101
|
+
VID: options.visitorId
|
|
102
|
+
});
|
|
103
|
+
if (uid) params.set("UID", uid);
|
|
104
|
+
new Image().src = `https://c.bing.com/c.gif?${params.toString()}`;
|
|
105
|
+
};
|
|
106
|
+
if (!options.userId) {
|
|
107
|
+
fire();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
sha256(options.userId).then(fire, () => fire());
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { sendUETEvent, sendUETIdSync, setUETConsent, setUETUser };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=microsoft-uet.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"microsoft-uet.mjs","names":[],"sources":["../../src/third-parties/microsoft-uet.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { type UETConsent, type UETQ, mapUETEvent } from '../track/uetq';\nimport { getFirst } from '../utils/field';\nimport { sha256 } from '../utils/sha256';\n\ndeclare global {\n interface Window {\n /**\n * Defined by the UET snippet before `bat.js` loads (as a plain array), so pushes made early\n * are queued rather than lost. Undefined only where the snippet was never installed.\n */\n uetq?: UETQ;\n }\n}\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\n/** Drop `undefined` fields: bat.js validates every key it receives, and `undefined` is a value. */\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nfunction clean(value: unknown): any {\n return JSON.parse(JSON.stringify(value));\n}\n\nfunction isLocal(): boolean {\n return window.location.host.includes('127.0.0.1') || window.location.host.includes('localhost');\n}\n\n/**\n * Forward an internal track event to the Microsoft Advertising UET tag.\n *\n * `eventId` is reused as UET's `event_id` so the browser event deduplicates against the same\n * conversion sent through the Conversions API (`sendMicrosoftEvents`). The action name is the\n * internal name on both channels — see `mapUETEvent`.\n *\n * `page_view` is not forwarded: bat.js turns that action into its page-load beacon, which the\n * snippet already fires on load and, with `enableAutoSpaTracking: true` (the setting in\n * Microsoft's generated snippet), on every history change — forwarding the SDK's own page views\n * would report each page twice. The tag owns page loads; this tracker owns everything else.\n */\nexport function sendUETEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.uetq) {\n console.warn('uetq has not been initialized');\n return;\n }\n if (metrics.includes(name) || name === 'page_view') return;\n if (isLocal()) return;\n\n const [action, params] = mapUETEvent(name, properties, eventId);\n window.uetq.push('event', action, clean(params));\n}\n\n/**\n * Enhanced conversions: hand the tag the visitor's email and phone so Microsoft can match a\n * conversion to an ad click without a third-party cookie. A `set` applies to every event fired\n * from the page afterwards, `pageLoad` included, and the tag fires a `pid` beacon on its own\n * when the page load already went out. Values are sent raw — the tag normalizes and SHA-256\n * hashes them in the browser (bat.js `validatePid`) before anything leaves the page.\n *\n * No tag id parameter: unlike the Meta/Reddit pixels, UET is bound to its tag by the snippet\n * and `set` addresses whichever tag drains `uetq`.\n */\nexport function setUETUser() {\n return ({ user_data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.uetq) {\n console.warn('uetq has not been initialized');\n return;\n }\n\n const em = getFirst(user_data?.email);\n const ph = getFirst(user_data?.phone_number);\n if (!em && !ph) return;\n\n window.uetq.push('set', { pid: clean({ em, ph }) });\n };\n}\n\n/**\n * UET consent mode. Push `default` before the tag loads (the tag processes `consent` early, ahead\n * of the queued events) and `update` when the visitor decides. With `ad_storage: 'denied'` the\n * tag neither writes its cookies nor reads the `msclkid` from the URL.\n * https://help.ads.microsoft.com/#apex/ads/en/60119/1\n */\nexport function setUETConsent(mode: 'default' | 'update', consent: UETConsent) {\n if (typeof window === 'undefined') return;\n window.uetq ??= [] as unknown as UETQ;\n window.uetq.push('consent', mode, consent);\n}\n\n/**\n * The Conversions API's client-side ID Sync pixel: ties the visitor id sent server-side as\n * `anonymousId` to Microsoft's own identifier, so server events can be attributed across\n * contexts (view-through, audiences). Microsoft requires it for remarketing built from CAPI\n * events and recommends it for measurement quality; fire it at least once per session, ideally\n * on the first page view. A pixel rather than a fetch on purpose: Microsoft must observe the\n * browser context of the sync, which a server-side call cannot carry.\n *\n * `customerId` is the Microsoft Advertising customer id (`cid` in the UI's URLs) — not the UET\n * tag id. `visitorId` is the SDK visitor id (`getVisitor().id`), which is what\n * `sendMicrosoftEvents` sends as `anonymousId`; Microsoft requires the two to be equal.\n * `userId` is the raw signed-in user id: it is SHA-256 hashed here, exactly as the server sender\n * hashes it into `externalId`, so the pair matches as well. Hashing is asynchronous, so the\n * pixel fires once the digest resolves; where SubtleCrypto is unavailable (an insecure context)\n * the pixel goes out without `UID` rather than with a raw id.\n * https://learn.microsoft.com/en-us/advertising/guides/uet-conversion-api-integration#id-sync-and-why-it-matters\n */\nexport function sendUETIdSync(options: {\n customerId: string | number;\n visitorId: string;\n /** The signed-in user's id, raw; hashed before it leaves the page. */\n userId?: string;\n}) {\n if (typeof window === 'undefined' || typeof Image === 'undefined') return;\n if (isLocal()) return;\n\n const fire = (uid?: string) => {\n const params = new URLSearchParams({\n Red3: `BACID_${options.customerId}`,\n VID: options.visitorId,\n });\n if (uid) params.set('UID', uid);\n new Image().src = `https://c.bing.com/c.gif?${params.toString()}`;\n };\n\n if (!options.userId) {\n fire();\n return;\n }\n sha256(options.userId).then(fire, () => fire());\n}\n"],"mappings":";;;;AAgBA,MAAM,UAAU;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;AAAM;;AAI1D,SAAS,MAAM,OAAqB;CAClC,OAAO,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC;AACzC;AAEA,SAAS,UAAmB;CAC1B,OAAO,OAAO,SAAS,KAAK,SAAS,WAAW,KAAK,OAAO,SAAS,KAAK,SAAS,WAAW;AAChG;;;;;;;;;;;;;AAcA,SAAgB,aACd,MACA,YACA,SACA;CACA,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,+BAA+B;EAC5C;CACF;CACA,IAAI,QAAQ,SAAS,IAAI,KAAK,SAAS,aAAa;CACpD,IAAI,QAAQ,GAAG;CAEf,MAAM,CAAC,QAAQ,UAAU,YAAY,MAAM,YAAY,OAAO;CAC9D,OAAO,KAAK,KAAK,SAAS,QAAQ,MAAM,MAAM,CAAC;AACjD;;;;;;;;;;;AAYA,SAAgB,aAAa;CAC3B,QAAQ,EAAE,gBAAkC;EAC1C,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;GACjD,QAAQ,KAAK,+BAA+B;GAC5C;EACF;EAEA,MAAM,KAAK,SAAS,WAAW,KAAK;EACpC,MAAM,KAAK,SAAS,WAAW,YAAY;EAC3C,IAAI,CAAC,MAAM,CAAC,IAAI;EAEhB,OAAO,KAAK,KAAK,OAAO,EAAE,KAAK,MAAM;GAAE;GAAI;EAAG,CAAC,EAAE,CAAC;CACpD;AACF;;;;;;;AAQA,SAAgB,cAAc,MAA4B,SAAqB;CAC7E,IAAI,OAAO,WAAW,aAAa;CACnC,OAAO,SAAS,CAAC;CACjB,OAAO,KAAK,KAAK,WAAW,MAAM,OAAO;AAC3C;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,cAAc,SAK3B;CACD,IAAI,OAAO,WAAW,eAAe,OAAO,UAAU,aAAa;CACnE,IAAI,QAAQ,GAAG;CAEf,MAAM,QAAQ,QAAiB;EAC7B,MAAM,SAAS,IAAI,gBAAgB;GACjC,MAAM,SAAS,QAAQ;GACvB,KAAK,QAAQ;EACf,CAAC;EACD,IAAI,KAAK,OAAO,IAAI,OAAO,GAAG;EAC9B,IAAI,MAAM,CAAC,CAAC,MAAM,4BAA4B,OAAO,SAAS;CAChE;CAEA,IAAI,CAAC,QAAQ,QAAQ;EACnB,KAAK;EACL;CACF;CACA,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;AAChD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_utils_field = require("../utils/field.cjs");
|
|
3
3
|
const require_track_oaiq = require("../track/oaiq.cjs");
|
|
4
|
+
const require_utils_sha256 = require("../utils/sha256.cjs");
|
|
4
5
|
//#region src/third-parties/openai-pixel.ts
|
|
5
6
|
/** Drop `undefined` fields so the SDK only receives populated values. */
|
|
6
7
|
function clean(value) {
|
|
@@ -26,12 +27,6 @@ function sendOpenAIEvent(name, properties, eventId) {
|
|
|
26
27
|
});
|
|
27
28
|
else window.oaiq("measure", type, clean(data), { event_id: eventId });
|
|
28
29
|
}
|
|
29
|
-
/** SHA-256 hex digest, lowercase — the format OpenAI expects for hashed identity fields. */
|
|
30
|
-
async function sha256(value) {
|
|
31
|
-
const bytes = new TextEncoder().encode(value);
|
|
32
|
-
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
33
|
-
return Array.from(new Uint8Array(digest)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
34
|
-
}
|
|
35
30
|
/**
|
|
36
31
|
* Re-initialize the pixel with hashed user identity for better conversion matching. Email and
|
|
37
32
|
* external id are hashed client-side; geographic fields are sent raw. Hashing is asynchronous,
|
|
@@ -60,7 +55,7 @@ function setOpenAIUser(pixelId) {
|
|
|
60
55
|
})
|
|
61
56
|
});
|
|
62
57
|
};
|
|
63
|
-
Promise.all([email ? sha256(email) : void 0, user_id ? sha256(user_id) : void 0]).then(([email_sha256, external_id_sha256]) => init({
|
|
58
|
+
Promise.all([email ? require_utils_sha256.sha256(email) : void 0, user_id ? require_utils_sha256.sha256(user_id) : void 0]).then(([email_sha256, external_id_sha256]) => init({
|
|
64
59
|
email_sha256,
|
|
65
60
|
external_id_sha256
|
|
66
61
|
})).catch(() => init({}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-pixel.cjs","names":["NON_AD_EVENTS","mapOAIEvent","getFirst"],"sources":["../../src/third-parties/openai-pixel.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { NON_AD_EVENTS, type OAIQ, type OAIQUser, mapOAIEvent } from '../track/oaiq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\n\ndeclare global {\n interface Window {\n /** Undefined until the OpenAI pixel script has loaded. */\n oaiq?: OAIQ['oaiq'];\n }\n}\n\n/** Drop `undefined` fields so the SDK only receives populated values. */\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nfunction clean(value: unknown): any {\n return JSON.parse(JSON.stringify(value));\n}\n\n/**\n * Forward an internal track event to the OpenAI measurement pixel.\n * `eventId` is reused as the OpenAI `event_id` so browser events deduplicate against the\n * Conversions API. https://developers.openai.com/ads/measurement-pixel\n */\nexport function sendOpenAIEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.oaiq) {\n console.warn('oaiq has not been initialized');\n return;\n }\n if (NON_AD_EVENTS.includes(name)) return;\n if (window.location.host.includes('127.0.0.1')) return;\n if (window.location.host.includes('localhost')) return;\n\n const { type, data } = mapOAIEvent(name, properties);\n if (type === 'custom') {\n window.oaiq('measure', 'custom', clean(data), { event_id: eventId, custom_event_name: name });\n } else {\n window.oaiq('measure', type, clean(data), { event_id: eventId });\n }\n}\n\n
|
|
1
|
+
{"version":3,"file":"openai-pixel.cjs","names":["NON_AD_EVENTS","mapOAIEvent","getFirst","sha256"],"sources":["../../src/third-parties/openai-pixel.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { NON_AD_EVENTS, type OAIQ, type OAIQUser, mapOAIEvent } from '../track/oaiq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\nimport { sha256 } from '../utils/sha256';\n\ndeclare global {\n interface Window {\n /** Undefined until the OpenAI pixel script has loaded. */\n oaiq?: OAIQ['oaiq'];\n }\n}\n\n/** Drop `undefined` fields so the SDK only receives populated values. */\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nfunction clean(value: unknown): any {\n return JSON.parse(JSON.stringify(value));\n}\n\n/**\n * Forward an internal track event to the OpenAI measurement pixel.\n * `eventId` is reused as the OpenAI `event_id` so browser events deduplicate against the\n * Conversions API. https://developers.openai.com/ads/measurement-pixel\n */\nexport function sendOpenAIEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.oaiq) {\n console.warn('oaiq has not been initialized');\n return;\n }\n if (NON_AD_EVENTS.includes(name)) return;\n if (window.location.host.includes('127.0.0.1')) return;\n if (window.location.host.includes('localhost')) return;\n\n const { type, data } = mapOAIEvent(name, properties);\n if (type === 'custom') {\n window.oaiq('measure', 'custom', clean(data), { event_id: eventId, custom_event_name: name });\n } else {\n window.oaiq('measure', type, clean(data), { event_id: eventId });\n }\n}\n\n/**\n * Re-initialize the pixel with hashed user identity for better conversion matching. Email and\n * external id are hashed client-side; geographic fields are sent raw. Hashing is asynchronous,\n * so the `init` call is deferred until the digests resolve.\n */\nexport function setOpenAIUser(pixelId: string) {\n return ({ user_id, user_data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.oaiq) {\n console.warn('oaiq has not been initialized');\n return;\n }\n // Capture the narrowed reference so the deferred `init` closure keeps it non-optional.\n const oaiq = window.oaiq;\n\n const email = getFirst(user_data?.email)?.trim().toLowerCase();\n const address = getFirst(user_data?.address);\n\n const base: OAIQUser = {\n country: address?.country?.trim().toUpperCase(),\n city: address?.city?.trim().toLowerCase(),\n zip_code: address?.postal_code,\n };\n\n const init = (hashed: Partial<OAIQUser>) => {\n oaiq('init', { pixelId, user: clean({ ...base, ...hashed }) });\n };\n\n Promise.all([email ? sha256(email) : undefined, user_id ? sha256(user_id) : undefined])\n .then(([email_sha256, external_id_sha256]) => init({ email_sha256, external_id_sha256 }))\n .catch(() => init({}));\n };\n}\n"],"mappings":";;;;;;AAeA,SAAS,MAAM,OAAqB;CAClC,OAAO,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC;AACzC;;;;;;AAOA,SAAgB,gBACd,MACA,YACA,SACA;CACA,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,+BAA+B;EAC5C;CACF;CACA,IAAIA,mBAAAA,cAAc,SAAS,IAAI,GAAG;CAClC,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAChD,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAEhD,MAAM,EAAE,MAAM,SAASC,mBAAAA,YAAY,MAAM,UAAU;CACnD,IAAI,SAAS,UACX,OAAO,KAAK,WAAW,UAAU,MAAM,IAAI,GAAG;EAAE,UAAU;EAAS,mBAAmB;CAAK,CAAC;MAE5F,OAAO,KAAK,WAAW,MAAM,MAAM,IAAI,GAAG,EAAE,UAAU,QAAQ,CAAC;AAEnE;;;;;;AAOA,SAAgB,cAAc,SAAiB;CAC7C,QAAQ,EAAE,SAAS,gBAAkC;EACnD,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;GACjD,QAAQ,KAAK,+BAA+B;GAC5C;EACF;EAEA,MAAM,OAAO,OAAO;EAEpB,MAAM,QAAQC,oBAAAA,SAAS,WAAW,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,YAAY;EAC7D,MAAM,UAAUA,oBAAAA,SAAS,WAAW,OAAO;EAE3C,MAAM,OAAiB;GACrB,SAAS,SAAS,SAAS,KAAK,CAAC,CAAC,YAAY;GAC9C,MAAM,SAAS,MAAM,KAAK,CAAC,CAAC,YAAY;GACxC,UAAU,SAAS;EACrB;EAEA,MAAM,QAAQ,WAA8B;GAC1C,KAAK,QAAQ;IAAE;IAAS,MAAM,MAAM;KAAE,GAAG;KAAM,GAAG;IAAO,CAAC;GAAE,CAAC;EAC/D;EAEA,QAAQ,IAAI,CAAC,QAAQC,qBAAAA,OAAO,KAAK,IAAI,KAAA,GAAW,UAAUA,qBAAAA,OAAO,OAAO,IAAI,KAAA,CAAS,CAAC,CAAC,CACpF,MAAM,CAAC,cAAc,wBAAwB,KAAK;GAAE;GAAc;EAAmB,CAAC,CAAC,CAAC,CACxF,YAAY,KAAK,CAAC,CAAC,CAAC;CACzB;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-pixel.d.cts","names":[],"sources":["../../src/third-parties/openai-pixel.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"openai-pixel.d.cts","names":[],"sources":["../../src/third-parties/openai-pixel.ts"],"mappings":";;;;QAMQ;YACI;;IAER,OAAO;;;;;;;;iBAeK,gBAAgB,UAAU,WACxC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;;;;;;iBAuBc,cAAc,qBAAe,SAAA,aACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-pixel.d.mts","names":[],"sources":["../../src/third-parties/openai-pixel.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"openai-pixel.d.mts","names":[],"sources":["../../src/third-parties/openai-pixel.ts"],"mappings":";;;;QAMQ;YACI;;IAER,OAAO;;;;;;;;iBAeK,gBAAgB,UAAU,WACxC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;;;;;;iBAuBc,cAAc,qBAAe,SAAA,aACX"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getFirst } from "../utils/field.mjs";
|
|
2
2
|
import { NON_AD_EVENTS, mapOAIEvent } from "../track/oaiq.mjs";
|
|
3
|
+
import { sha256 } from "../utils/sha256.mjs";
|
|
3
4
|
//#region src/third-parties/openai-pixel.ts
|
|
4
5
|
/** Drop `undefined` fields so the SDK only receives populated values. */
|
|
5
6
|
function clean(value) {
|
|
@@ -25,12 +26,6 @@ function sendOpenAIEvent(name, properties, eventId) {
|
|
|
25
26
|
});
|
|
26
27
|
else window.oaiq("measure", type, clean(data), { event_id: eventId });
|
|
27
28
|
}
|
|
28
|
-
/** SHA-256 hex digest, lowercase — the format OpenAI expects for hashed identity fields. */
|
|
29
|
-
async function sha256(value) {
|
|
30
|
-
const bytes = new TextEncoder().encode(value);
|
|
31
|
-
const digest = await crypto.subtle.digest("SHA-256", bytes);
|
|
32
|
-
return Array.from(new Uint8Array(digest)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
33
|
-
}
|
|
34
29
|
/**
|
|
35
30
|
* Re-initialize the pixel with hashed user identity for better conversion matching. Email and
|
|
36
31
|
* external id are hashed client-side; geographic fields are sent raw. Hashing is asynchronous,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-pixel.mjs","names":[],"sources":["../../src/third-parties/openai-pixel.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { NON_AD_EVENTS, type OAIQ, type OAIQUser, mapOAIEvent } from '../track/oaiq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\n\ndeclare global {\n interface Window {\n /** Undefined until the OpenAI pixel script has loaded. */\n oaiq?: OAIQ['oaiq'];\n }\n}\n\n/** Drop `undefined` fields so the SDK only receives populated values. */\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nfunction clean(value: unknown): any {\n return JSON.parse(JSON.stringify(value));\n}\n\n/**\n * Forward an internal track event to the OpenAI measurement pixel.\n * `eventId` is reused as the OpenAI `event_id` so browser events deduplicate against the\n * Conversions API. https://developers.openai.com/ads/measurement-pixel\n */\nexport function sendOpenAIEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.oaiq) {\n console.warn('oaiq has not been initialized');\n return;\n }\n if (NON_AD_EVENTS.includes(name)) return;\n if (window.location.host.includes('127.0.0.1')) return;\n if (window.location.host.includes('localhost')) return;\n\n const { type, data } = mapOAIEvent(name, properties);\n if (type === 'custom') {\n window.oaiq('measure', 'custom', clean(data), { event_id: eventId, custom_event_name: name });\n } else {\n window.oaiq('measure', type, clean(data), { event_id: eventId });\n }\n}\n\n
|
|
1
|
+
{"version":3,"file":"openai-pixel.mjs","names":[],"sources":["../../src/third-parties/openai-pixel.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport { NON_AD_EVENTS, type OAIQ, type OAIQUser, mapOAIEvent } from '../track/oaiq';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\nimport { sha256 } from '../utils/sha256';\n\ndeclare global {\n interface Window {\n /** Undefined until the OpenAI pixel script has loaded. */\n oaiq?: OAIQ['oaiq'];\n }\n}\n\n/** Drop `undefined` fields so the SDK only receives populated values. */\n// oxlint-disable-next-line @typescript-eslint/no-explicit-any\nfunction clean(value: unknown): any {\n return JSON.parse(JSON.stringify(value));\n}\n\n/**\n * Forward an internal track event to the OpenAI measurement pixel.\n * `eventId` is reused as the OpenAI `event_id` so browser events deduplicate against the\n * Conversions API. https://developers.openai.com/ads/measurement-pixel\n */\nexport function sendOpenAIEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>,\n eventId?: string\n) {\n if (typeof window === 'undefined' || !window.oaiq) {\n console.warn('oaiq has not been initialized');\n return;\n }\n if (NON_AD_EVENTS.includes(name)) return;\n if (window.location.host.includes('127.0.0.1')) return;\n if (window.location.host.includes('localhost')) return;\n\n const { type, data } = mapOAIEvent(name, properties);\n if (type === 'custom') {\n window.oaiq('measure', 'custom', clean(data), { event_id: eventId, custom_event_name: name });\n } else {\n window.oaiq('measure', type, clean(data), { event_id: eventId });\n }\n}\n\n/**\n * Re-initialize the pixel with hashed user identity for better conversion matching. Email and\n * external id are hashed client-side; geographic fields are sent raw. Hashing is asynchronous,\n * so the `init` call is deferred until the digests resolve.\n */\nexport function setOpenAIUser(pixelId: string) {\n return ({ user_id, user_data }: UpdateVisitorDTO) => {\n if (typeof window === 'undefined' || !window.oaiq) {\n console.warn('oaiq has not been initialized');\n return;\n }\n // Capture the narrowed reference so the deferred `init` closure keeps it non-optional.\n const oaiq = window.oaiq;\n\n const email = getFirst(user_data?.email)?.trim().toLowerCase();\n const address = getFirst(user_data?.address);\n\n const base: OAIQUser = {\n country: address?.country?.trim().toUpperCase(),\n city: address?.city?.trim().toLowerCase(),\n zip_code: address?.postal_code,\n };\n\n const init = (hashed: Partial<OAIQUser>) => {\n oaiq('init', { pixelId, user: clean({ ...base, ...hashed }) });\n };\n\n Promise.all([email ? sha256(email) : undefined, user_id ? sha256(user_id) : undefined])\n .then(([email_sha256, external_id_sha256]) => init({ email_sha256, external_id_sha256 }))\n .catch(() => init({}));\n };\n}\n"],"mappings":";;;;;AAeA,SAAS,MAAM,OAAqB;CAClC,OAAO,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC;AACzC;;;;;;AAOA,SAAgB,gBACd,MACA,YACA,SACA;CACA,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,+BAA+B;EAC5C;CACF;CACA,IAAI,cAAc,SAAS,IAAI,GAAG;CAClC,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAChD,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAEhD,MAAM,EAAE,MAAM,SAAS,YAAY,MAAM,UAAU;CACnD,IAAI,SAAS,UACX,OAAO,KAAK,WAAW,UAAU,MAAM,IAAI,GAAG;EAAE,UAAU;EAAS,mBAAmB;CAAK,CAAC;MAE5F,OAAO,KAAK,WAAW,MAAM,MAAM,IAAI,GAAG,EAAE,UAAU,QAAQ,CAAC;AAEnE;;;;;;AAOA,SAAgB,cAAc,SAAiB;CAC7C,QAAQ,EAAE,SAAS,gBAAkC;EACnD,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;GACjD,QAAQ,KAAK,+BAA+B;GAC5C;EACF;EAEA,MAAM,OAAO,OAAO;EAEpB,MAAM,QAAQ,SAAS,WAAW,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,YAAY;EAC7D,MAAM,UAAU,SAAS,WAAW,OAAO;EAE3C,MAAM,OAAiB;GACrB,SAAS,SAAS,SAAS,KAAK,CAAC,CAAC,YAAY;GAC9C,MAAM,SAAS,MAAM,KAAK,CAAC,CAAC,YAAY;GACxC,UAAU,SAAS;EACrB;EAEA,MAAM,QAAQ,WAA8B;GAC1C,KAAK,QAAQ;IAAE;IAAS,MAAM,MAAM;KAAE,GAAG;KAAM,GAAG;IAAO,CAAC;GAAE,CAAC;EAC/D;EAEA,QAAQ,IAAI,CAAC,QAAQ,OAAO,KAAK,IAAI,KAAA,GAAW,UAAU,OAAO,OAAO,IAAI,KAAA,CAAS,CAAC,CAAC,CACpF,MAAM,CAAC,cAAc,wBAAwB,KAAK;GAAE;GAAc;EAAmB,CAAC,CAAC,CAAC,CACxF,YAAY,KAAK,CAAC,CAAC,CAAC;CACzB;AACF"}
|
package/dist/track/types.d.cts
CHANGED
|
@@ -108,6 +108,13 @@ interface PageInfo {
|
|
|
108
108
|
page_location?: string;
|
|
109
109
|
page_referrer?: string;
|
|
110
110
|
page_title?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Identifies one page load: every event of a page carries the same id, and a navigation — a
|
|
113
|
+
* reload, or a single-page-app route change, the same moments a `page_view` is sent — starts
|
|
114
|
+
* a new one. Lets a server-side sender tie a conversion to the page load it happened on
|
|
115
|
+
* (Microsoft's `pageLoadId`). Web only.
|
|
116
|
+
*/
|
|
117
|
+
page_load_id?: string;
|
|
111
118
|
/**
|
|
112
119
|
* @deprecated Renamed to `page_location` in 7.0.0, and never set by this SDK any more.
|
|
113
120
|
* Declared so events from clients still on an older version keep their page URL through
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/track/types.ts"],"mappings":";;KAEY;KACA,YAAY;KAEZ,UAAU,UAAU,YAAY,aAAa,gBAAgB,iBACrE,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+Ba;;;;;;;KAQZ,oBAAoB,KAAK,gBAAgB,wBAC1C,sBAAsB;KAGd,gBAAgB,UAAU,YAAY,aAAa,gBAAgB,iBAC3E,eAAe,KAAK,oBAAoB,KACxC,gBAAgB,wBACd,sBAAsB,KACtB,OAAO,mBAAmB;KAEpB;KACA;UAEK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,yBAAyB;EACxC;EACA;EACA;EACA;EACA;IAAa;IAAc;IAAe;;EAE1C;EACA;;KAGU,qBAAqB,UAAU,WACzC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;;EAEf;EACA;;UAGe;EACf;EACA;EACA;;;;;;;;;;UAWe;EACf;EACA;EACA;;;;;;EAMA;;UAGe;;;;;;;EAOf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;UAQe;;EAEf;;;;;;;;;;;;EAqCA;;;;;;EAuDA;;EAMA;;EAEA;;EAEA;;EAEA;;EAUA;;EAEA;;UAGe,kBACP,cAAc,YAAY,SAAS,iBAAiB,UAAU,iBAAiB;EACvF;GACC;;UAGc,WAAW,UAAU,YAAY;EAChD;EACA,MAAM,UAAU;EAChB,MAAM;EACN;EACA;EACA,UAAU;EACV,aAAa;EACb,aAAa,gBAAgB;EAC7B;;KAGU;;EAEV"}
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/track/types.ts"],"mappings":";;KAEY;KACA,YAAY;KAEZ,UAAU,UAAU,YAAY,aAAa,gBAAgB,iBACrE,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+Ba;;;;;;;KAQZ,oBAAoB,KAAK,gBAAgB,wBAC1C,sBAAsB;KAGd,gBAAgB,UAAU,YAAY,aAAa,gBAAgB,iBAC3E,eAAe,KAAK,oBAAoB,KACxC,gBAAgB,wBACd,sBAAsB,KACtB,OAAO,mBAAmB;KAEpB;KACA;UAEK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,yBAAyB;EACxC;EACA;EACA;EACA;EACA;IAAa;IAAc;IAAe;;EAE1C;EACA;;KAGU,qBAAqB,UAAU,WACzC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;;EAEf;EACA;;UAGe;EACf;EACA;EACA;;;;;;;;;;UAWe;EACf;EACA;EACA;;;;;;;EAOA;;;;;;EAMA;;UAGe;;;;;;;EAOf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;UAQe;;EAEf;;;;;;;;;;;;EAqCA;;;;;;EAuDA;;EAMA;;EAEA;;EAEA;;EAEA;;EAUA;;EAEA;;UAGe,kBACP,cAAc,YAAY,SAAS,iBAAiB,UAAU,iBAAiB;EACvF;GACC;;UAGc,WAAW,UAAU,YAAY;EAChD;EACA,MAAM,UAAU;EAChB,MAAM;EACN;EACA;EACA,UAAU;EACV,aAAa;EACb,aAAa,gBAAgB;EAC7B;;KAGU;;EAEV"}
|
package/dist/track/types.d.mts
CHANGED
|
@@ -108,6 +108,13 @@ interface PageInfo {
|
|
|
108
108
|
page_location?: string;
|
|
109
109
|
page_referrer?: string;
|
|
110
110
|
page_title?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Identifies one page load: every event of a page carries the same id, and a navigation — a
|
|
113
|
+
* reload, or a single-page-app route change, the same moments a `page_view` is sent — starts
|
|
114
|
+
* a new one. Lets a server-side sender tie a conversion to the page load it happened on
|
|
115
|
+
* (Microsoft's `pageLoadId`). Web only.
|
|
116
|
+
*/
|
|
117
|
+
page_load_id?: string;
|
|
111
118
|
/**
|
|
112
119
|
* @deprecated Renamed to `page_location` in 7.0.0, and never set by this SDK any more.
|
|
113
120
|
* Declared so events from clients still on an older version keep their page URL through
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/track/types.ts"],"mappings":";;KAEY;KACA,YAAY;KAEZ,UAAU,UAAU,YAAY,aAAa,gBAAgB,iBACrE,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+Ba;;;;;;;KAQZ,oBAAoB,KAAK,gBAAgB,wBAC1C,sBAAsB;KAGd,gBAAgB,UAAU,YAAY,aAAa,gBAAgB,iBAC3E,eAAe,KAAK,oBAAoB,KACxC,gBAAgB,wBACd,sBAAsB,KACtB,OAAO,mBAAmB;KAEpB;KACA;UAEK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,yBAAyB;EACxC;EACA;EACA;EACA;EACA;IAAa;IAAc;IAAe;;EAE1C;EACA;;KAGU,qBAAqB,UAAU,WACzC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;;EAEf;EACA;;UAGe;EACf;EACA;EACA;;;;;;;;;;UAWe;EACf;EACA;EACA;;;;;;EAMA;;UAGe;;;;;;;EAOf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;UAQe;;EAEf;;;;;;;;;;;;EAqCA;;;;;;EAuDA;;EAMA;;EAEA;;EAEA;;EAEA;;EAUA;;EAEA;;UAGe,kBACP,cAAc,YAAY,SAAS,iBAAiB,UAAU,iBAAiB;EACvF;GACC;;UAGc,WAAW,UAAU,YAAY;EAChD;EACA,MAAM,UAAU;EAChB,MAAM;EACN;EACA;EACA,UAAU;EACV,aAAa;EACb,aAAa,gBAAgB;EAC7B;;KAGU;;EAEV"}
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/track/types.ts"],"mappings":";;KAEY;KACA,YAAY;KAEZ,UAAU,UAAU,YAAY,aAAa,gBAAgB,iBACrE,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+Ba;;;;;;;KAQZ,oBAAoB,KAAK,gBAAgB,wBAC1C,sBAAsB;KAGd,gBAAgB,UAAU,YAAY,aAAa,gBAAgB,iBAC3E,eAAe,KAAK,oBAAoB,KACxC,gBAAgB,wBACd,sBAAsB,KACtB,OAAO,mBAAmB;KAEpB;KACA;UAEK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe,yBAAyB;EACxC;EACA;EACA;EACA;EACA;IAAa;IAAc;IAAe;;EAE1C;EACA;;KAGU,qBAAqB,UAAU,WACzC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;;EAEf;EACA;;UAGe;EACf;EACA;EACA;;;;;;;;;;UAWe;EACf;EACA;EACA;;;;;;;EAOA;;;;;;EAMA;;UAGe;;;;;;;EAOf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAEA;EACA;;EAEA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;UAQe;;EAEf;;;;;;;;;;;;EAqCA;;;;;;EAuDA;;EAMA;;EAEA;;EAEA;;EAEA;;EAUA;;EAEA;;UAGe,kBACP,cAAc,YAAY,SAAS,iBAAiB,UAAU,iBAAiB;EACvF;GACC;;UAGc,WAAW,UAAU,YAAY;EAChD;EACA,MAAM,UAAU;EAChB,MAAM;EACN;EACA;EACA,UAAU;EACV,aAAa;EACb,aAAa,gBAAgB;EAC7B;;KAGU;;EAEV"}
|