@shware/analytics 8.12.0 → 8.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attribution/classify.cjs +35 -26
- package/dist/attribution/classify.cjs.map +1 -1
- package/dist/attribution/classify.d.cts +15 -9
- package/dist/attribution/classify.d.cts.map +1 -1
- package/dist/attribution/classify.d.mts +15 -9
- package/dist/attribution/classify.d.mts.map +1 -1
- package/dist/attribution/classify.mjs +36 -27
- package/dist/attribution/classify.mjs.map +1 -1
- package/dist/attribution/index.cjs +2 -0
- package/dist/attribution/index.d.cts +2 -2
- package/dist/attribution/index.d.mts +2 -2
- package/dist/attribution/index.mjs +2 -2
- package/dist/attribution/vocabulary.cjs +207 -34
- package/dist/attribution/vocabulary.cjs.map +1 -1
- package/dist/attribution/vocabulary.d.cts +75 -31
- package/dist/attribution/vocabulary.d.cts.map +1 -1
- package/dist/attribution/vocabulary.d.mts +75 -31
- package/dist/attribution/vocabulary.d.mts.map +1 -1
- package/dist/attribution/vocabulary.mjs +206 -35
- package/dist/attribution/vocabulary.mjs.map +1 -1
- package/dist/click-id/index.d.cts +18 -19
- package/dist/click-id/index.d.cts.map +1 -1
- package/dist/click-id/index.d.mts +18 -19
- package/dist/click-id/index.d.mts.map +1 -1
- package/dist/constants/storage.d.cts +1 -2
- package/dist/constants/storage.d.cts.map +1 -1
- package/dist/constants/storage.d.mts +1 -2
- package/dist/constants/storage.d.mts.map +1 -1
- package/dist/feedback/index.d.cts +1 -2
- package/dist/feedback/index.d.cts.map +1 -1
- package/dist/feedback/index.d.mts +1 -2
- package/dist/feedback/index.d.mts.map +1 -1
- package/dist/hooks/use-app-analytics.d.cts +1 -2
- package/dist/hooks/use-app-analytics.d.cts.map +1 -1
- package/dist/hooks/use-app-analytics.d.mts +1 -2
- package/dist/hooks/use-app-analytics.d.mts.map +1 -1
- package/dist/hooks/use-outbound-click-analytics.d.cts +1 -2
- package/dist/hooks/use-outbound-click-analytics.d.cts.map +1 -1
- package/dist/hooks/use-outbound-click-analytics.d.mts +1 -2
- package/dist/hooks/use-outbound-click-analytics.d.mts.map +1 -1
- package/dist/hooks/use-previous.d.cts +1 -2
- package/dist/hooks/use-previous.d.cts.map +1 -1
- package/dist/hooks/use-previous.d.mts +1 -2
- package/dist/hooks/use-previous.d.mts.map +1 -1
- package/dist/hooks/use-report-web-vitals.d.cts +1 -2
- package/dist/hooks/use-report-web-vitals.d.cts.map +1 -1
- package/dist/hooks/use-report-web-vitals.d.mts +1 -2
- package/dist/hooks/use-report-web-vitals.d.mts.map +1 -1
- package/dist/hooks/use-track-impression.d.cts +1 -2
- package/dist/hooks/use-track-impression.d.cts.map +1 -1
- package/dist/hooks/use-track-impression.d.mts +1 -2
- package/dist/hooks/use-track-impression.d.mts.map +1 -1
- package/dist/hooks/use-uet-id-sync.d.cts +1 -2
- package/dist/hooks/use-uet-id-sync.d.cts.map +1 -1
- package/dist/hooks/use-uet-id-sync.d.mts +1 -2
- package/dist/hooks/use-uet-id-sync.d.mts.map +1 -1
- package/dist/hooks/use-web-analytics.d.cts +1 -2
- package/dist/hooks/use-web-analytics.d.cts.map +1 -1
- package/dist/hooks/use-web-analytics.d.mts +1 -2
- package/dist/hooks/use-web-analytics.d.mts.map +1 -1
- package/dist/link/index.d.cts +3 -4
- package/dist/link/index.d.cts.map +1 -1
- package/dist/link/index.d.mts +3 -4
- package/dist/link/index.d.mts.map +1 -1
- package/dist/native/fbsdk.d.cts +1 -2
- package/dist/native/fbsdk.d.cts.map +1 -1
- package/dist/native/fbsdk.d.mts +1 -2
- package/dist/native/fbsdk.d.mts.map +1 -1
- package/dist/native/fingerprint.d.cts +4 -5
- package/dist/native/fingerprint.d.cts.map +1 -1
- package/dist/native/fingerprint.d.mts +4 -5
- package/dist/native/fingerprint.d.mts.map +1 -1
- package/dist/native/firebase.d.cts +1 -2
- package/dist/native/firebase.d.cts.map +1 -1
- package/dist/native/firebase.d.mts +1 -2
- package/dist/native/firebase.d.mts.map +1 -1
- package/dist/native/posthog.d.cts +1 -2
- package/dist/native/posthog.d.cts.map +1 -1
- package/dist/native/posthog.d.mts +1 -2
- package/dist/native/posthog.d.mts.map +1 -1
- package/dist/native/setup.d.cts +4 -5
- package/dist/native/setup.d.cts.map +1 -1
- package/dist/native/setup.d.mts +4 -5
- package/dist/native/setup.d.mts.map +1 -1
- package/dist/next/index.cjs +14 -14
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +1 -2
- package/dist/next/index.d.cts.map +1 -1
- package/dist/next/index.d.mts +1 -2
- package/dist/next/index.d.mts.map +1 -1
- package/dist/next/index.mjs +3 -3
- package/dist/react-router/index.d.cts +1 -2
- package/dist/react-router/index.d.cts.map +1 -1
- package/dist/react-router/index.d.mts +1 -2
- package/dist/react-router/index.d.mts.map +1 -1
- package/dist/schema/index.d.cts +16 -17
- package/dist/schema/index.d.cts.map +1 -1
- package/dist/schema/index.d.mts +16 -17
- package/dist/schema/index.d.mts.map +1 -1
- package/dist/server/action-source.d.cts +3 -4
- package/dist/server/action-source.d.cts.map +1 -1
- package/dist/server/action-source.d.mts +3 -4
- package/dist/server/action-source.d.mts.map +1 -1
- package/dist/server/google-data-manager.d.cts +9 -10
- package/dist/server/google-data-manager.d.cts.map +1 -1
- package/dist/server/google-data-manager.d.mts +9 -10
- package/dist/server/google-data-manager.d.mts.map +1 -1
- package/dist/server/linkedin-conversions-api.d.cts +4 -5
- package/dist/server/linkedin-conversions-api.d.cts.map +1 -1
- package/dist/server/linkedin-conversions-api.d.mts +4 -5
- package/dist/server/linkedin-conversions-api.d.mts.map +1 -1
- package/dist/server/meta-capi.d.cts +5 -6
- package/dist/server/meta-capi.d.cts.map +1 -1
- package/dist/server/meta-capi.d.mts +5 -6
- package/dist/server/meta-capi.d.mts.map +1 -1
- package/dist/server/meta-conversions-api.d.cts +4 -5
- package/dist/server/meta-conversions-api.d.cts.map +1 -1
- package/dist/server/meta-conversions-api.d.mts +4 -5
- package/dist/server/meta-conversions-api.d.mts.map +1 -1
- package/dist/server/microsoft-conversions-api.d.cts +11 -12
- package/dist/server/microsoft-conversions-api.d.cts.map +1 -1
- package/dist/server/microsoft-conversions-api.d.mts +11 -12
- package/dist/server/microsoft-conversions-api.d.mts.map +1 -1
- package/dist/server/openai-conversions-api.d.cts +5 -6
- package/dist/server/openai-conversions-api.d.cts.map +1 -1
- package/dist/server/openai-conversions-api.d.mts +5 -6
- package/dist/server/openai-conversions-api.d.mts.map +1 -1
- package/dist/server/page-location.d.cts +1 -2
- package/dist/server/page-location.d.cts.map +1 -1
- package/dist/server/page-location.d.mts +1 -2
- package/dist/server/page-location.d.mts.map +1 -1
- package/dist/server/reddit-conversions-api.d.cts +4 -5
- package/dist/server/reddit-conversions-api.d.cts.map +1 -1
- package/dist/server/reddit-conversions-api.d.mts +4 -5
- package/dist/server/reddit-conversions-api.d.mts.map +1 -1
- package/dist/setup/index.d.cts +5 -6
- package/dist/setup/index.d.cts.map +1 -1
- package/dist/setup/index.d.mts +5 -6
- package/dist/setup/index.d.mts.map +1 -1
- package/dist/setup/session.d.cts +2 -3
- package/dist/setup/session.d.cts.map +1 -1
- package/dist/setup/session.d.mts +2 -3
- package/dist/setup/session.d.mts.map +1 -1
- package/dist/tanstack/analytics.d.cts +1 -2
- package/dist/tanstack/analytics.d.cts.map +1 -1
- package/dist/tanstack/analytics.d.mts +1 -2
- package/dist/tanstack/analytics.d.mts.map +1 -1
- package/dist/tanstack/middleware.d.cts +3 -4
- package/dist/tanstack/middleware.d.cts.map +1 -1
- package/dist/tanstack/middleware.d.mts +3 -4
- package/dist/tanstack/middleware.d.mts.map +1 -1
- package/dist/test/setup.d.cts +3 -4
- package/dist/test/setup.d.cts.map +1 -1
- package/dist/test/setup.d.mts +3 -4
- package/dist/test/setup.d.mts.map +1 -1
- package/dist/third-parties/google-analytics.d.cts +2 -3
- package/dist/third-parties/google-analytics.d.cts.map +1 -1
- package/dist/third-parties/google-analytics.d.mts +2 -3
- package/dist/third-parties/google-analytics.d.mts.map +1 -1
- package/dist/third-parties/ignored-events.d.cts +1 -2
- package/dist/third-parties/ignored-events.d.cts.map +1 -1
- package/dist/third-parties/ignored-events.d.mts +1 -2
- package/dist/third-parties/ignored-events.d.mts.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.d.cts +3 -4
- package/dist/third-parties/linkedin-insight-tag.d.cts.map +1 -1
- package/dist/third-parties/linkedin-insight-tag.d.mts +3 -4
- package/dist/third-parties/linkedin-insight-tag.d.mts.map +1 -1
- package/dist/third-parties/meta-pixel.d.cts +2 -3
- package/dist/third-parties/meta-pixel.d.cts.map +1 -1
- package/dist/third-parties/meta-pixel.d.mts +2 -3
- package/dist/third-parties/meta-pixel.d.mts.map +1 -1
- package/dist/third-parties/microsoft-uet.d.cts +6 -7
- package/dist/third-parties/microsoft-uet.d.cts.map +1 -1
- package/dist/third-parties/microsoft-uet.d.mts +6 -7
- package/dist/third-parties/microsoft-uet.d.mts.map +1 -1
- package/dist/third-parties/openai-pixel.d.cts +2 -3
- package/dist/third-parties/openai-pixel.d.cts.map +1 -1
- package/dist/third-parties/openai-pixel.d.mts +2 -3
- package/dist/third-parties/openai-pixel.d.mts.map +1 -1
- package/dist/third-parties/posthog.d.cts +2 -3
- package/dist/third-parties/posthog.d.cts.map +1 -1
- package/dist/third-parties/posthog.d.mts +2 -3
- package/dist/third-parties/posthog.d.mts.map +1 -1
- package/dist/third-parties/reddit-pixel.d.cts +2 -3
- package/dist/third-parties/reddit-pixel.d.cts.map +1 -1
- package/dist/third-parties/reddit-pixel.d.mts +2 -3
- package/dist/third-parties/reddit-pixel.d.mts.map +1 -1
- package/dist/track/fbq.d.cts +10 -11
- package/dist/track/fbq.d.cts.map +1 -1
- package/dist/track/fbq.d.mts +10 -11
- package/dist/track/fbq.d.mts.map +1 -1
- package/dist/track/gtag.d.cts +26 -27
- package/dist/track/gtag.d.cts.map +1 -1
- package/dist/track/gtag.d.mts +26 -27
- package/dist/track/gtag.d.mts.map +1 -1
- package/dist/track/index.d.cts +4 -5
- package/dist/track/index.d.cts.map +1 -1
- package/dist/track/index.d.mts +4 -5
- package/dist/track/index.d.mts.map +1 -1
- package/dist/track/lintrk.d.cts +1 -2
- package/dist/track/lintrk.d.cts.map +1 -1
- package/dist/track/lintrk.d.mts +1 -2
- package/dist/track/lintrk.d.mts.map +1 -1
- package/dist/track/oaiq.d.cts +17 -18
- package/dist/track/oaiq.d.cts.map +1 -1
- package/dist/track/oaiq.d.mts +17 -18
- package/dist/track/oaiq.d.mts.map +1 -1
- package/dist/track/rdt.d.cts +10 -11
- package/dist/track/rdt.d.cts.map +1 -1
- package/dist/track/rdt.d.mts +10 -11
- package/dist/track/rdt.d.mts.map +1 -1
- package/dist/track/types.d.cts +20 -21
- package/dist/track/types.d.cts.map +1 -1
- package/dist/track/types.d.mts +20 -21
- package/dist/track/types.d.mts.map +1 -1
- package/dist/track/uetq.d.cts +8 -9
- package/dist/track/uetq.d.cts.map +1 -1
- package/dist/track/uetq.d.mts +8 -9
- package/dist/track/uetq.d.mts.map +1 -1
- package/dist/utils/field.d.cts +1 -2
- package/dist/utils/field.d.cts.map +1 -1
- package/dist/utils/field.d.mts +1 -2
- package/dist/utils/field.d.mts.map +1 -1
- package/dist/utils/sha256.d.cts +1 -2
- package/dist/utils/sha256.d.cts.map +1 -1
- package/dist/utils/sha256.d.mts +1 -2
- package/dist/utils/sha256.d.mts.map +1 -1
- package/dist/utils/stripe.d.cts +2 -3
- package/dist/utils/stripe.d.cts.map +1 -1
- package/dist/utils/stripe.d.mts +2 -3
- package/dist/utils/stripe.d.mts.map +1 -1
- package/dist/visitor/index.d.cts +2 -3
- package/dist/visitor/index.d.cts.map +1 -1
- package/dist/visitor/index.d.mts +2 -3
- package/dist/visitor/index.d.mts.map +1 -1
- package/dist/visitor/types.d.cts +4 -5
- package/dist/visitor/types.d.cts.map +1 -1
- package/dist/visitor/types.d.mts +4 -5
- package/dist/visitor/types.d.mts.map +1 -1
- package/dist/web/index.d.cts +3 -4
- package/dist/web/index.d.cts.map +1 -1
- package/dist/web/index.d.mts +3 -4
- package/dist/web/index.d.mts.map +1 -1
- package/dist/web/page-key.d.cts +1 -2
- package/dist/web/page-key.d.cts.map +1 -1
- package/dist/web/page-key.d.mts +1 -2
- package/dist/web/page-key.d.mts.map +1 -1
- package/package.json +27 -27
package/dist/track/oaiq.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Item } from "./gtag.cjs";
|
|
2
2
|
import { EventName, TrackName, TrackProperties } from "./types.cjs";
|
|
3
3
|
//#region src/track/oaiq.d.ts
|
|
4
|
-
declare const NON_AD_EVENTS: string[];
|
|
4
|
+
export declare const NON_AD_EVENTS: string[];
|
|
5
5
|
/**
|
|
6
6
|
* Content item shared by `contents` and `plan_enrollment` events.
|
|
7
7
|
* https://developers.openai.com/ads/supported-events
|
|
8
8
|
*/
|
|
9
|
-
type ContentItem = {
|
|
9
|
+
export type ContentItem = {
|
|
10
10
|
id?: string;
|
|
11
11
|
name?: string;
|
|
12
12
|
content_type?: string;
|
|
@@ -15,37 +15,37 @@ type ContentItem = {
|
|
|
15
15
|
amount?: number;
|
|
16
16
|
currency?: string;
|
|
17
17
|
};
|
|
18
|
-
type ContentsData = {
|
|
18
|
+
export type ContentsData = {
|
|
19
19
|
type: 'contents';
|
|
20
20
|
/** Monetary value in ISO 4217 minor units (e.g., 12,999 = $129.99 USD). */
|
|
21
21
|
amount?: number;
|
|
22
22
|
currency?: string;
|
|
23
23
|
contents?: ContentItem[];
|
|
24
24
|
};
|
|
25
|
-
type CustomerActionData = {
|
|
25
|
+
export type CustomerActionData = {
|
|
26
26
|
type: 'customer_action';
|
|
27
27
|
amount?: number;
|
|
28
28
|
currency?: string;
|
|
29
29
|
};
|
|
30
|
-
type PlanEnrollmentData = {
|
|
30
|
+
export type PlanEnrollmentData = {
|
|
31
31
|
type: 'plan_enrollment';
|
|
32
32
|
plan_id?: string;
|
|
33
33
|
amount?: number;
|
|
34
34
|
currency?: string;
|
|
35
35
|
contents?: ContentItem[];
|
|
36
36
|
};
|
|
37
|
-
type CustomEventData = {
|
|
37
|
+
export type CustomEventData = {
|
|
38
38
|
type: 'custom';
|
|
39
39
|
amount?: number;
|
|
40
40
|
currency?: string;
|
|
41
41
|
contents?: ContentItem[];
|
|
42
42
|
};
|
|
43
|
-
type EventData = ContentsData | CustomerActionData | PlanEnrollmentData | CustomEventData;
|
|
43
|
+
export type EventData = ContentsData | CustomerActionData | PlanEnrollmentData | CustomEventData;
|
|
44
44
|
/**
|
|
45
45
|
* Standard event names and the `data` shape each one expects.
|
|
46
46
|
* https://developers.openai.com/ads/supported-events
|
|
47
47
|
*/
|
|
48
|
-
type StandardEvents = {
|
|
48
|
+
export type StandardEvents = {
|
|
49
49
|
appointment_scheduled: CustomerActionData;
|
|
50
50
|
checkout_started: ContentsData;
|
|
51
51
|
contents_viewed: ContentsData;
|
|
@@ -57,13 +57,13 @@ type StandardEvents = {
|
|
|
57
57
|
subscription_created: PlanEnrollmentData;
|
|
58
58
|
trial_started: PlanEnrollmentData;
|
|
59
59
|
};
|
|
60
|
-
type StandardEvent = keyof StandardEvents;
|
|
60
|
+
export type StandardEvent = keyof StandardEvents;
|
|
61
61
|
/**
|
|
62
62
|
* Identity fields passed to `oaiq("init", ...)` for conversion matching. Email and external id
|
|
63
63
|
* must be pre-hashed as lowercase 64-char SHA-256 hex strings; the rest are sent as raw values.
|
|
64
64
|
* https://developers.openai.com/ads/measurement-pixel
|
|
65
65
|
*/
|
|
66
|
-
type OAIQUser = {
|
|
66
|
+
export type OAIQUser = {
|
|
67
67
|
email_sha256?: string;
|
|
68
68
|
external_id_sha256?: string;
|
|
69
69
|
/** Two-letter ISO 3166-1 country code (e.g. "US"). */
|
|
@@ -73,7 +73,7 @@ type OAIQUser = {
|
|
|
73
73
|
/** Max 32 characters. */
|
|
74
74
|
zip_code?: string;
|
|
75
75
|
};
|
|
76
|
-
type InitConfig = {
|
|
76
|
+
export type InitConfig = {
|
|
77
77
|
pixelId: string;
|
|
78
78
|
/** Log SDK activity to the browser console. */
|
|
79
79
|
debug?: boolean;
|
|
@@ -83,7 +83,7 @@ type InitConfig = {
|
|
|
83
83
|
* Fourth argument of `oaiq("measure", ...)`. Required for custom events (carries
|
|
84
84
|
* `custom_event_name`); optional for standard events.
|
|
85
85
|
*/
|
|
86
|
-
type MeasureOptions = {
|
|
86
|
+
export type MeasureOptions = {
|
|
87
87
|
/** Shared with the Conversions API to deduplicate the same conversion across browser and server. */
|
|
88
88
|
event_id?: string;
|
|
89
89
|
/** Required for custom events; 1-64 chars of letters, numbers, underscores, or dashes. */
|
|
@@ -91,7 +91,7 @@ type MeasureOptions = {
|
|
|
91
91
|
/** When true, opts the event out of user-level personalization. */
|
|
92
92
|
opt_out?: boolean;
|
|
93
93
|
};
|
|
94
|
-
interface OAIQ {
|
|
94
|
+
export interface OAIQ {
|
|
95
95
|
oaiq(command: 'init', config: InitConfig): void;
|
|
96
96
|
oaiq<T extends StandardEvent>(command: 'measure', event: T, data: StandardEvents[T], options?: MeasureOptions): void;
|
|
97
97
|
oaiq(command: 'measure', event: 'custom', data: CustomEventData, options: MeasureOptions & {
|
|
@@ -99,14 +99,13 @@ interface OAIQ {
|
|
|
99
99
|
}): void;
|
|
100
100
|
}
|
|
101
101
|
/** Convert a major-unit amount (e.g., 129.99) into ISO 4217 minor units (e.g., 12,999). */
|
|
102
|
-
declare function toMinorUnits(value?: number | null, currency?: string): number | undefined;
|
|
103
|
-
declare function mapContents(items?: Item[], currency?: string): ContentItem[] | undefined;
|
|
104
|
-
type MappedOAIEvent = {
|
|
102
|
+
export declare function toMinorUnits(value?: number | null, currency?: string): number | undefined;
|
|
103
|
+
export declare function mapContents(items?: Item[], currency?: string): ContentItem[] | undefined;
|
|
104
|
+
export type MappedOAIEvent = {
|
|
105
105
|
type: StandardEvent | 'custom';
|
|
106
106
|
data: EventData;
|
|
107
107
|
};
|
|
108
108
|
/** Map an internal track event onto an OpenAI standard (or custom) conversion event. */
|
|
109
|
-
declare function mapOAIEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): MappedOAIEvent;
|
|
109
|
+
export declare function mapOAIEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): MappedOAIEvent;
|
|
110
110
|
//#endregion
|
|
111
|
-
export { ContentItem, ContentsData, CustomEventData, CustomerActionData, EventData, InitConfig, MappedOAIEvent, MeasureOptions, NON_AD_EVENTS, OAIQ, OAIQUser, PlanEnrollmentData, StandardEvent, StandardEvents, mapContents, mapOAIEvent, toMinorUnits };
|
|
112
111
|
//# sourceMappingURL=oaiq.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oaiq.d.cts","names":[],"sources":["../../src/track/oaiq.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"oaiq.d.cts","names":[],"sources":["../../src/track/oaiq.ts"],"mappings":";;;qBAGa;;;;;YAiBD;EACV;EACA;EACA;EACA;;EAEA;EACA;;YAGU;EACV;;EAEA;EACA;EACA,WAAW;;YAGD;EACV;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;EACA,WAAW;;YAGD;EACV;EACA;EACA;EACA,WAAW;;YAGD,YAAY,eAAe,qBAAqB,qBAAqB;;;;;YAMrE;EACV,uBAAuB;EACvB,kBAAkB;EAClB,iBAAiB;EACjB,aAAa;EACb,cAAc;EACd,eAAe;EACf,aAAa;EACb,wBAAwB;EACxB,sBAAsB;EACtB,eAAe;;YAGL,sBAAsB;;;;;;YAOtB;EACV;EACA;;EAEA;;EAEA;;EAEA;;YAGU;EACV;;EAEA;EACA,OAAO;;;;;;YAOG;;EAEV;;EAEA;;EAEA;;iBAGe;EACf,KAAK,iBAAiB,QAAQ;EAC9B,KAAK,UAAU,eACb,oBACA,OAAO,GACP,MAAM,eAAe,IACrB,UAAU;EAEZ,KACE,oBACA,iBACA,MAAM,iBACN,SAAS;IAAmB;;;;wBAgChB,aAAa,uBAAuB;wBAYpC,YAAY,QAAQ,QAAQ,oBAAoB;YAkEpD;EACV,MAAM;EACN,MAAM;;;wBAIQ,YAAY,UAAU,WACpC,MAAM,UAAU,IAChB,aAAa,gBAAgB,KAC5B"}
|
package/dist/track/oaiq.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Item } from "./gtag.mjs";
|
|
2
2
|
import { EventName, TrackName, TrackProperties } from "./types.mjs";
|
|
3
3
|
//#region src/track/oaiq.d.ts
|
|
4
|
-
declare const NON_AD_EVENTS: string[];
|
|
4
|
+
export declare const NON_AD_EVENTS: string[];
|
|
5
5
|
/**
|
|
6
6
|
* Content item shared by `contents` and `plan_enrollment` events.
|
|
7
7
|
* https://developers.openai.com/ads/supported-events
|
|
8
8
|
*/
|
|
9
|
-
type ContentItem = {
|
|
9
|
+
export type ContentItem = {
|
|
10
10
|
id?: string;
|
|
11
11
|
name?: string;
|
|
12
12
|
content_type?: string;
|
|
@@ -15,37 +15,37 @@ type ContentItem = {
|
|
|
15
15
|
amount?: number;
|
|
16
16
|
currency?: string;
|
|
17
17
|
};
|
|
18
|
-
type ContentsData = {
|
|
18
|
+
export type ContentsData = {
|
|
19
19
|
type: 'contents';
|
|
20
20
|
/** Monetary value in ISO 4217 minor units (e.g., 12,999 = $129.99 USD). */
|
|
21
21
|
amount?: number;
|
|
22
22
|
currency?: string;
|
|
23
23
|
contents?: ContentItem[];
|
|
24
24
|
};
|
|
25
|
-
type CustomerActionData = {
|
|
25
|
+
export type CustomerActionData = {
|
|
26
26
|
type: 'customer_action';
|
|
27
27
|
amount?: number;
|
|
28
28
|
currency?: string;
|
|
29
29
|
};
|
|
30
|
-
type PlanEnrollmentData = {
|
|
30
|
+
export type PlanEnrollmentData = {
|
|
31
31
|
type: 'plan_enrollment';
|
|
32
32
|
plan_id?: string;
|
|
33
33
|
amount?: number;
|
|
34
34
|
currency?: string;
|
|
35
35
|
contents?: ContentItem[];
|
|
36
36
|
};
|
|
37
|
-
type CustomEventData = {
|
|
37
|
+
export type CustomEventData = {
|
|
38
38
|
type: 'custom';
|
|
39
39
|
amount?: number;
|
|
40
40
|
currency?: string;
|
|
41
41
|
contents?: ContentItem[];
|
|
42
42
|
};
|
|
43
|
-
type EventData = ContentsData | CustomerActionData | PlanEnrollmentData | CustomEventData;
|
|
43
|
+
export type EventData = ContentsData | CustomerActionData | PlanEnrollmentData | CustomEventData;
|
|
44
44
|
/**
|
|
45
45
|
* Standard event names and the `data` shape each one expects.
|
|
46
46
|
* https://developers.openai.com/ads/supported-events
|
|
47
47
|
*/
|
|
48
|
-
type StandardEvents = {
|
|
48
|
+
export type StandardEvents = {
|
|
49
49
|
appointment_scheduled: CustomerActionData;
|
|
50
50
|
checkout_started: ContentsData;
|
|
51
51
|
contents_viewed: ContentsData;
|
|
@@ -57,13 +57,13 @@ type StandardEvents = {
|
|
|
57
57
|
subscription_created: PlanEnrollmentData;
|
|
58
58
|
trial_started: PlanEnrollmentData;
|
|
59
59
|
};
|
|
60
|
-
type StandardEvent = keyof StandardEvents;
|
|
60
|
+
export type StandardEvent = keyof StandardEvents;
|
|
61
61
|
/**
|
|
62
62
|
* Identity fields passed to `oaiq("init", ...)` for conversion matching. Email and external id
|
|
63
63
|
* must be pre-hashed as lowercase 64-char SHA-256 hex strings; the rest are sent as raw values.
|
|
64
64
|
* https://developers.openai.com/ads/measurement-pixel
|
|
65
65
|
*/
|
|
66
|
-
type OAIQUser = {
|
|
66
|
+
export type OAIQUser = {
|
|
67
67
|
email_sha256?: string;
|
|
68
68
|
external_id_sha256?: string;
|
|
69
69
|
/** Two-letter ISO 3166-1 country code (e.g. "US"). */
|
|
@@ -73,7 +73,7 @@ type OAIQUser = {
|
|
|
73
73
|
/** Max 32 characters. */
|
|
74
74
|
zip_code?: string;
|
|
75
75
|
};
|
|
76
|
-
type InitConfig = {
|
|
76
|
+
export type InitConfig = {
|
|
77
77
|
pixelId: string;
|
|
78
78
|
/** Log SDK activity to the browser console. */
|
|
79
79
|
debug?: boolean;
|
|
@@ -83,7 +83,7 @@ type InitConfig = {
|
|
|
83
83
|
* Fourth argument of `oaiq("measure", ...)`. Required for custom events (carries
|
|
84
84
|
* `custom_event_name`); optional for standard events.
|
|
85
85
|
*/
|
|
86
|
-
type MeasureOptions = {
|
|
86
|
+
export type MeasureOptions = {
|
|
87
87
|
/** Shared with the Conversions API to deduplicate the same conversion across browser and server. */
|
|
88
88
|
event_id?: string;
|
|
89
89
|
/** Required for custom events; 1-64 chars of letters, numbers, underscores, or dashes. */
|
|
@@ -91,7 +91,7 @@ type MeasureOptions = {
|
|
|
91
91
|
/** When true, opts the event out of user-level personalization. */
|
|
92
92
|
opt_out?: boolean;
|
|
93
93
|
};
|
|
94
|
-
interface OAIQ {
|
|
94
|
+
export interface OAIQ {
|
|
95
95
|
oaiq(command: 'init', config: InitConfig): void;
|
|
96
96
|
oaiq<T extends StandardEvent>(command: 'measure', event: T, data: StandardEvents[T], options?: MeasureOptions): void;
|
|
97
97
|
oaiq(command: 'measure', event: 'custom', data: CustomEventData, options: MeasureOptions & {
|
|
@@ -99,14 +99,13 @@ interface OAIQ {
|
|
|
99
99
|
}): void;
|
|
100
100
|
}
|
|
101
101
|
/** Convert a major-unit amount (e.g., 129.99) into ISO 4217 minor units (e.g., 12,999). */
|
|
102
|
-
declare function toMinorUnits(value?: number | null, currency?: string): number | undefined;
|
|
103
|
-
declare function mapContents(items?: Item[], currency?: string): ContentItem[] | undefined;
|
|
104
|
-
type MappedOAIEvent = {
|
|
102
|
+
export declare function toMinorUnits(value?: number | null, currency?: string): number | undefined;
|
|
103
|
+
export declare function mapContents(items?: Item[], currency?: string): ContentItem[] | undefined;
|
|
104
|
+
export type MappedOAIEvent = {
|
|
105
105
|
type: StandardEvent | 'custom';
|
|
106
106
|
data: EventData;
|
|
107
107
|
};
|
|
108
108
|
/** Map an internal track event onto an OpenAI standard (or custom) conversion event. */
|
|
109
|
-
declare function mapOAIEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): MappedOAIEvent;
|
|
109
|
+
export declare function mapOAIEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): MappedOAIEvent;
|
|
110
110
|
//#endregion
|
|
111
|
-
export { ContentItem, ContentsData, CustomEventData, CustomerActionData, EventData, InitConfig, MappedOAIEvent, MeasureOptions, NON_AD_EVENTS, OAIQ, OAIQUser, PlanEnrollmentData, StandardEvent, StandardEvents, mapContents, mapOAIEvent, toMinorUnits };
|
|
112
111
|
//# sourceMappingURL=oaiq.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oaiq.d.mts","names":[],"sources":["../../src/track/oaiq.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"oaiq.d.mts","names":[],"sources":["../../src/track/oaiq.ts"],"mappings":";;;qBAGa;;;;;YAiBD;EACV;EACA;EACA;EACA;;EAEA;EACA;;YAGU;EACV;;EAEA;EACA;EACA,WAAW;;YAGD;EACV;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;EACA,WAAW;;YAGD;EACV;EACA;EACA;EACA,WAAW;;YAGD,YAAY,eAAe,qBAAqB,qBAAqB;;;;;YAMrE;EACV,uBAAuB;EACvB,kBAAkB;EAClB,iBAAiB;EACjB,aAAa;EACb,cAAc;EACd,eAAe;EACf,aAAa;EACb,wBAAwB;EACxB,sBAAsB;EACtB,eAAe;;YAGL,sBAAsB;;;;;;YAOtB;EACV;EACA;;EAEA;;EAEA;;EAEA;;YAGU;EACV;;EAEA;EACA,OAAO;;;;;;YAOG;;EAEV;;EAEA;;EAEA;;iBAGe;EACf,KAAK,iBAAiB,QAAQ;EAC9B,KAAK,UAAU,eACb,oBACA,OAAO,GACP,MAAM,eAAe,IACrB,UAAU;EAEZ,KACE,oBACA,iBACA,MAAM,iBACN,SAAS;IAAmB;;;;wBAgChB,aAAa,uBAAuB;wBAYpC,YAAY,QAAQ,QAAQ,oBAAoB;YAkEpD;EACV,MAAM;EACN,MAAM;;;wBAIQ,YAAY,UAAU,WACpC,MAAM,UAAU,IAChB,aAAa,gBAAgB,KAC5B"}
|
package/dist/track/rdt.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { Item } from "./gtag.cjs";
|
|
|
2
2
|
import { EventName, TrackName, TrackProperties } from "./types.cjs";
|
|
3
3
|
//#region src/track/rdt.d.ts
|
|
4
4
|
/** https://business.reddithelp.com/s/article/about-event-metadata */
|
|
5
|
-
type Product = {
|
|
5
|
+
export type Product = {
|
|
6
6
|
/**
|
|
7
7
|
* (Required) Product ID: Either the SKU or GTIN, which represents the variant ID, not the
|
|
8
8
|
* parent ID. If there are no variants, pass the assigned ID for that item.
|
|
@@ -18,7 +18,7 @@ type Product = {
|
|
|
18
18
|
* https://business.reddithelp.com/s/article/about-event-metadata
|
|
19
19
|
* https://business.reddithelp.com/s/article/map-a-catalog-to-a-signal-source
|
|
20
20
|
*/
|
|
21
|
-
type StandardEvents = {
|
|
21
|
+
export type StandardEvents = {
|
|
22
22
|
PageVisit: {
|
|
23
23
|
conversionId?: string;
|
|
24
24
|
products?: Product[];
|
|
@@ -65,15 +65,15 @@ type StandardEvents = {
|
|
|
65
65
|
products?: Product[];
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
type PixelId = `a2_${string}`;
|
|
69
|
-
type MatchKeys = {
|
|
68
|
+
export type PixelId = `a2_${string}`;
|
|
69
|
+
export type MatchKeys = {
|
|
70
70
|
email?: string;
|
|
71
71
|
phoneNumber?: string;
|
|
72
72
|
externalId?: string;
|
|
73
73
|
idfa?: string;
|
|
74
74
|
aaid?: string;
|
|
75
75
|
};
|
|
76
|
-
type CustomEventParams<T extends string = string> = {
|
|
76
|
+
export type CustomEventParams<T extends string = string> = {
|
|
77
77
|
customEventName: T;
|
|
78
78
|
value?: number;
|
|
79
79
|
currency?: string;
|
|
@@ -81,17 +81,16 @@ type CustomEventParams<T extends string = string> = {
|
|
|
81
81
|
conversionId?: string;
|
|
82
82
|
products?: Product[];
|
|
83
83
|
};
|
|
84
|
-
interface RDT {
|
|
84
|
+
export interface RDT {
|
|
85
85
|
rdt(event: 'init', pixelId: PixelId, matchKeys?: MatchKeys): void;
|
|
86
86
|
rdt<T extends keyof StandardEvents>(event: 'track', type: T, params?: StandardEvents[T]): void;
|
|
87
87
|
rdt(event: 'track', type: 'Custom', params: CustomEventParams): void;
|
|
88
88
|
}
|
|
89
89
|
type Mapped<F extends keyof StandardEvents> = [F, StandardEvents[F]];
|
|
90
90
|
type Missed<F extends string> = ['Custom', CustomEventParams<F>];
|
|
91
|
-
declare function mapItems(items?: Item[]): undefined | Product[];
|
|
92
|
-
declare function mapRDTEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, eventId?: string): Mapped<keyof StandardEvents> | Missed<TrackName<T>>;
|
|
93
|
-
type ServerStandardEvent = 'PAGE_VISIT' | 'VIEW_CONTENT' | 'SEARCH' | 'ADD_TO_CART' | 'ADD_TO_WISHLIST' | 'PURCHASE' | 'LEAD' | 'SIGN_UP';
|
|
94
|
-
declare function mapServerStandardEvent(name: keyof StandardEvents): ServerStandardEvent;
|
|
91
|
+
export declare function mapItems(items?: Item[]): undefined | Product[];
|
|
92
|
+
export declare function mapRDTEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, eventId?: string): Mapped<keyof StandardEvents> | Missed<TrackName<T>>;
|
|
93
|
+
export type ServerStandardEvent = 'PAGE_VISIT' | 'VIEW_CONTENT' | 'SEARCH' | 'ADD_TO_CART' | 'ADD_TO_WISHLIST' | 'PURCHASE' | 'LEAD' | 'SIGN_UP';
|
|
94
|
+
export declare function mapServerStandardEvent(name: keyof StandardEvents): ServerStandardEvent;
|
|
95
95
|
//#endregion
|
|
96
|
-
export { CustomEventParams, MatchKeys, PixelId, Product, RDT, ServerStandardEvent, StandardEvents, mapItems, mapRDTEvent, mapServerStandardEvent };
|
|
97
96
|
//# sourceMappingURL=rdt.d.cts.map
|
package/dist/track/rdt.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rdt.d.cts","names":[],"sources":["../../src/track/rdt.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"rdt.d.cts","names":[],"sources":["../../src/track/rdt.ts"],"mappings":";;;;YAIY;;;;;EAKV;;EAGA;;EAGA;;;;;;;YAQU;EACV;IACE;IACA,WAAW;;EAEb;IACE;IACA,WAAW;;EAEb;IACE;IACA,WAAW;;EAEb;IACE;IACA;IACA;IACA;IACA,WAAW;;EAEb;IACE;IACA;IACA;IACA;IACA,WAAW;;EAEb;IACE;IACA;IACA;IACA;IACA,WAAW;;EAEb;IACE;IACA;IACA;IACA,WAAW;;EAEb;IACE;IACA;IACA;IACA,WAAW;;;YAIH;YAEA;EACV;EACA;EACA;EACA;EACA;;YAGU,kBAAkB;EAC5B,iBAAiB;EACjB;EACA;EACA;EACA;EACA,WAAW;;iBAGI;EACf,IAAI,eAAe,SAAS,SAAS,YAAY;EAEjD,IAAI,gBAAgB,gBAAgB,gBAAgB,MAAM,GAAG,SAAS,eAAe;EAErF,IAAI,gBAAgB,gBAAgB,QAAQ;;KAGzC,OAAO,gBAAgB,mBAAmB,GAAG,eAAe;KAC5D,OAAO,+BAA+B,kBAAkB;wBAE7C,SAAS,QAAQ,qBAAqB;wBAStC,YAAY,UAAU,WACpC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B,mBACC,aAAa,kBAAkB,OAAO,UAAU;YAwEvC;wBAUI,uBAAuB,YAAY,iBAAiB"}
|
package/dist/track/rdt.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { Item } from "./gtag.mjs";
|
|
|
2
2
|
import { EventName, TrackName, TrackProperties } from "./types.mjs";
|
|
3
3
|
//#region src/track/rdt.d.ts
|
|
4
4
|
/** https://business.reddithelp.com/s/article/about-event-metadata */
|
|
5
|
-
type Product = {
|
|
5
|
+
export type Product = {
|
|
6
6
|
/**
|
|
7
7
|
* (Required) Product ID: Either the SKU or GTIN, which represents the variant ID, not the
|
|
8
8
|
* parent ID. If there are no variants, pass the assigned ID for that item.
|
|
@@ -18,7 +18,7 @@ type Product = {
|
|
|
18
18
|
* https://business.reddithelp.com/s/article/about-event-metadata
|
|
19
19
|
* https://business.reddithelp.com/s/article/map-a-catalog-to-a-signal-source
|
|
20
20
|
*/
|
|
21
|
-
type StandardEvents = {
|
|
21
|
+
export type StandardEvents = {
|
|
22
22
|
PageVisit: {
|
|
23
23
|
conversionId?: string;
|
|
24
24
|
products?: Product[];
|
|
@@ -65,15 +65,15 @@ type StandardEvents = {
|
|
|
65
65
|
products?: Product[];
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
type PixelId = `a2_${string}`;
|
|
69
|
-
type MatchKeys = {
|
|
68
|
+
export type PixelId = `a2_${string}`;
|
|
69
|
+
export type MatchKeys = {
|
|
70
70
|
email?: string;
|
|
71
71
|
phoneNumber?: string;
|
|
72
72
|
externalId?: string;
|
|
73
73
|
idfa?: string;
|
|
74
74
|
aaid?: string;
|
|
75
75
|
};
|
|
76
|
-
type CustomEventParams<T extends string = string> = {
|
|
76
|
+
export type CustomEventParams<T extends string = string> = {
|
|
77
77
|
customEventName: T;
|
|
78
78
|
value?: number;
|
|
79
79
|
currency?: string;
|
|
@@ -81,17 +81,16 @@ type CustomEventParams<T extends string = string> = {
|
|
|
81
81
|
conversionId?: string;
|
|
82
82
|
products?: Product[];
|
|
83
83
|
};
|
|
84
|
-
interface RDT {
|
|
84
|
+
export interface RDT {
|
|
85
85
|
rdt(event: 'init', pixelId: PixelId, matchKeys?: MatchKeys): void;
|
|
86
86
|
rdt<T extends keyof StandardEvents>(event: 'track', type: T, params?: StandardEvents[T]): void;
|
|
87
87
|
rdt(event: 'track', type: 'Custom', params: CustomEventParams): void;
|
|
88
88
|
}
|
|
89
89
|
type Mapped<F extends keyof StandardEvents> = [F, StandardEvents[F]];
|
|
90
90
|
type Missed<F extends string> = ['Custom', CustomEventParams<F>];
|
|
91
|
-
declare function mapItems(items?: Item[]): undefined | Product[];
|
|
92
|
-
declare function mapRDTEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, eventId?: string): Mapped<keyof StandardEvents> | Missed<TrackName<T>>;
|
|
93
|
-
type ServerStandardEvent = 'PAGE_VISIT' | 'VIEW_CONTENT' | 'SEARCH' | 'ADD_TO_CART' | 'ADD_TO_WISHLIST' | 'PURCHASE' | 'LEAD' | 'SIGN_UP';
|
|
94
|
-
declare function mapServerStandardEvent(name: keyof StandardEvents): ServerStandardEvent;
|
|
91
|
+
export declare function mapItems(items?: Item[]): undefined | Product[];
|
|
92
|
+
export declare function mapRDTEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, eventId?: string): Mapped<keyof StandardEvents> | Missed<TrackName<T>>;
|
|
93
|
+
export type ServerStandardEvent = 'PAGE_VISIT' | 'VIEW_CONTENT' | 'SEARCH' | 'ADD_TO_CART' | 'ADD_TO_WISHLIST' | 'PURCHASE' | 'LEAD' | 'SIGN_UP';
|
|
94
|
+
export declare function mapServerStandardEvent(name: keyof StandardEvents): ServerStandardEvent;
|
|
95
95
|
//#endregion
|
|
96
|
-
export { CustomEventParams, MatchKeys, PixelId, Product, RDT, ServerStandardEvent, StandardEvents, mapItems, mapRDTEvent, mapServerStandardEvent };
|
|
97
96
|
//# sourceMappingURL=rdt.d.mts.map
|
package/dist/track/rdt.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rdt.d.mts","names":[],"sources":["../../src/track/rdt.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"rdt.d.mts","names":[],"sources":["../../src/track/rdt.ts"],"mappings":";;;;YAIY;;;;;EAKV;;EAGA;;EAGA;;;;;;;YAQU;EACV;IACE;IACA,WAAW;;EAEb;IACE;IACA,WAAW;;EAEb;IACE;IACA,WAAW;;EAEb;IACE;IACA;IACA;IACA;IACA,WAAW;;EAEb;IACE;IACA;IACA;IACA;IACA,WAAW;;EAEb;IACE;IACA;IACA;IACA;IACA,WAAW;;EAEb;IACE;IACA;IACA;IACA,WAAW;;EAEb;IACE;IACA;IACA;IACA,WAAW;;;YAIH;YAEA;EACV;EACA;EACA;EACA;EACA;;YAGU,kBAAkB;EAC5B,iBAAiB;EACjB;EACA;EACA;EACA;EACA,WAAW;;iBAGI;EACf,IAAI,eAAe,SAAS,SAAS,YAAY;EAEjD,IAAI,gBAAgB,gBAAgB,gBAAgB,MAAM,GAAG,SAAS,eAAe;EAErF,IAAI,gBAAgB,gBAAgB,QAAQ;;KAGzC,OAAO,gBAAgB,mBAAmB,GAAG,eAAe;KAC5D,OAAO,+BAA+B,kBAAkB;wBAE7C,SAAS,QAAQ,qBAAqB;wBAStC,YAAY,UAAU,WACpC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B,mBACC,aAAa,kBAAkB,OAAO,UAAU;YAwEvC;wBAUI,uBAAuB,YAAY,iBAAiB"}
|
package/dist/track/types.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StandardEvents, UserProvidedData as UserProvidedData$1 } from "./gtag.cjs";
|
|
2
2
|
//#region src/track/types.d.ts
|
|
3
|
-
type AllowedPropertyValues = string | number | boolean | null;
|
|
4
|
-
type EventName = Lowercase<string> | 'CLS' | 'FCP' | 'INP' | 'LCP' | 'TTFB';
|
|
5
|
-
type TrackName<T extends EventName = EventName> = T extends keyof StandardEvents ? T : EventName;
|
|
3
|
+
export type AllowedPropertyValues = string | number | boolean | null;
|
|
4
|
+
export type EventName = Lowercase<string> | 'CLS' | 'FCP' | 'INP' | 'LCP' | 'TTFB';
|
|
5
|
+
export type TrackName<T extends EventName = EventName> = T extends keyof StandardEvents ? T : EventName;
|
|
6
6
|
/**
|
|
7
7
|
* Properties an application defines for its own events, keyed by event name.
|
|
8
8
|
*
|
|
@@ -29,7 +29,7 @@ type TrackName<T extends EventName = EventName> = T extends keyof StandardEvents
|
|
|
29
29
|
* Note what "custom" attaches to: the *properties*, not the event. `begin_checkout` is one
|
|
30
30
|
* of GA4's recommended events and stays one — only the properties added here are custom.
|
|
31
31
|
*/
|
|
32
|
-
interface CustomEventProperties {}
|
|
32
|
+
export interface CustomEventProperties {}
|
|
33
33
|
/**
|
|
34
34
|
* An application's declared properties for one event, or nothing if it declared none.
|
|
35
35
|
*
|
|
@@ -37,10 +37,10 @@ interface CustomEventProperties {}
|
|
|
37
37
|
* no declaration intersects to exactly the type it had before.
|
|
38
38
|
*/
|
|
39
39
|
type CustomPropertiesFor<T> = T extends keyof CustomEventProperties ? CustomEventProperties[T] : unknown;
|
|
40
|
-
type TrackProperties<T extends EventName = EventName> = T extends keyof StandardEvents ? StandardEvents[T] & CustomPropertiesFor<T> : T extends keyof CustomEventProperties ? CustomEventProperties[T] : Record<Lowercase<string>, AllowedPropertyValues>;
|
|
41
|
-
type Platform = 'ios' | 'android' | 'web' | 'macos' | 'windows' | 'linux' | 'unknown';
|
|
42
|
-
type Environment = 'development' | 'production';
|
|
43
|
-
interface UserData {
|
|
40
|
+
export type TrackProperties<T extends EventName = EventName> = T extends keyof StandardEvents ? StandardEvents[T] & CustomPropertiesFor<T> : T extends keyof CustomEventProperties ? CustomEventProperties[T] : Record<Lowercase<string>, AllowedPropertyValues>;
|
|
41
|
+
export type Platform = 'ios' | 'android' | 'web' | 'macos' | 'windows' | 'linux' | 'unknown';
|
|
42
|
+
export type Environment = 'development' | 'production';
|
|
43
|
+
export interface UserData {
|
|
44
44
|
userId: string;
|
|
45
45
|
email?: string;
|
|
46
46
|
firstName?: string;
|
|
@@ -53,7 +53,7 @@ interface UserData {
|
|
|
53
53
|
postal?: string;
|
|
54
54
|
country?: string;
|
|
55
55
|
}
|
|
56
|
-
interface UserProvidedData extends UserProvidedData$1 {
|
|
56
|
+
export interface UserProvidedData extends UserProvidedData$1 {
|
|
57
57
|
user_id?: string;
|
|
58
58
|
ip_address?: string;
|
|
59
59
|
user_agent?: string;
|
|
@@ -66,8 +66,8 @@ interface UserProvidedData extends UserProvidedData$1 {
|
|
|
66
66
|
fb_login_id?: string;
|
|
67
67
|
fb_page_id?: string;
|
|
68
68
|
}
|
|
69
|
-
type ThirdPartyTracker = <T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, event_id?: string) => void;
|
|
70
|
-
interface PlatformInfo {
|
|
69
|
+
export type ThirdPartyTracker = <T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>, event_id?: string) => void;
|
|
70
|
+
export interface PlatformInfo {
|
|
71
71
|
os?: string;
|
|
72
72
|
os_name?: string;
|
|
73
73
|
os_version?: string;
|
|
@@ -75,7 +75,7 @@ interface PlatformInfo {
|
|
|
75
75
|
browser_name?: string;
|
|
76
76
|
browser_version?: string;
|
|
77
77
|
}
|
|
78
|
-
interface DeviceInfo {
|
|
78
|
+
export interface DeviceInfo {
|
|
79
79
|
device?: string;
|
|
80
80
|
device_id?: string;
|
|
81
81
|
device_type?: string;
|
|
@@ -86,12 +86,12 @@ interface DeviceInfo {
|
|
|
86
86
|
screen_height?: number;
|
|
87
87
|
screen_resolution?: `${number}x${number}`;
|
|
88
88
|
}
|
|
89
|
-
interface AppInfo {
|
|
89
|
+
export interface AppInfo {
|
|
90
90
|
/** iOS: IDFA, Android: Android Advertising ID */
|
|
91
91
|
advertising_id?: string;
|
|
92
92
|
install_referrer?: string;
|
|
93
93
|
}
|
|
94
|
-
interface EnvironmentInfo {
|
|
94
|
+
export interface EnvironmentInfo {
|
|
95
95
|
release?: string;
|
|
96
96
|
language?: string;
|
|
97
97
|
time_zone?: string;
|
|
@@ -104,7 +104,7 @@ interface EnvironmentInfo {
|
|
|
104
104
|
* Web only: a native app has no page. Meta's `event_source_url` and OpenAI's `source_url` are
|
|
105
105
|
* both fed from `page_location`.
|
|
106
106
|
*/
|
|
107
|
-
interface PageInfo {
|
|
107
|
+
export interface PageInfo {
|
|
108
108
|
page_location?: string;
|
|
109
109
|
page_referrer?: string;
|
|
110
110
|
page_title?: string;
|
|
@@ -122,7 +122,7 @@ interface PageInfo {
|
|
|
122
122
|
*/
|
|
123
123
|
source_url?: string;
|
|
124
124
|
}
|
|
125
|
-
interface AdvertisingInfo {
|
|
125
|
+
export interface AdvertisingInfo {
|
|
126
126
|
/**
|
|
127
127
|
* Meta pixel fields
|
|
128
128
|
* ref: https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/customer-information-parameters#fbc
|
|
@@ -164,7 +164,7 @@ interface AdvertisingInfo {
|
|
|
164
164
|
* Value unions follow GA4 default channel group definitions:
|
|
165
165
|
* https://support.google.com/analytics/answer/9756891
|
|
166
166
|
*/
|
|
167
|
-
interface UTMParams {
|
|
167
|
+
export interface UTMParams {
|
|
168
168
|
/** Referrer of the traffic, matched against GA4 source lists (search/social/video/shopping sites) */
|
|
169
169
|
utm_source?: 'google' | 'bing' | 'baidu' | 'duckduckgo' | 'yahoo' | 'yandex' | 'meta' | 'facebook' | 'instagram' | 'twitter' | 'x' | 'linkedin' | 'tiktok' | 'pinterest' | 'reddit' | 'snapchat' | 'youtube' | 'vimeo' | 'twitch' | 'newsletter' | 'email' | 'sms' | 'firebase' | '(direct)' | (string & {});
|
|
170
170
|
/**
|
|
@@ -198,11 +198,11 @@ interface UTMParams {
|
|
|
198
198
|
/** Targeting criteria applied to the campaign */
|
|
199
199
|
utm_marketing_tactic?: 'remarketing' | 'prospecting' | (string & {});
|
|
200
200
|
}
|
|
201
|
-
interface TrackTags extends PlatformInfo, DeviceInfo, AppInfo, EnvironmentInfo, PageInfo, AdvertisingInfo, UTMParams {
|
|
201
|
+
export interface TrackTags extends PlatformInfo, DeviceInfo, AppInfo, EnvironmentInfo, PageInfo, AdvertisingInfo, UTMParams {
|
|
202
202
|
idempotency_key?: string;
|
|
203
203
|
[key: string]: string | number | boolean | null | undefined;
|
|
204
204
|
}
|
|
205
|
-
interface TrackEvent<T extends EventName = EventName> {
|
|
205
|
+
export interface TrackEvent<T extends EventName = EventName> {
|
|
206
206
|
id: string;
|
|
207
207
|
name: TrackName<T>;
|
|
208
208
|
tags: TrackTags;
|
|
@@ -213,10 +213,9 @@ interface TrackEvent<T extends EventName = EventName> {
|
|
|
213
213
|
properties?: TrackProperties<T>;
|
|
214
214
|
created_at: string;
|
|
215
215
|
}
|
|
216
|
-
type TrackEventResponse = {
|
|
216
|
+
export type TrackEventResponse = {
|
|
217
217
|
/** track event id: Meta Pixel will use event_id and event_name for deduplication */
|
|
218
218
|
id: string;
|
|
219
219
|
}[];
|
|
220
220
|
//#endregion
|
|
221
|
-
export { AdvertisingInfo, AllowedPropertyValues, AppInfo, CustomEventProperties, DeviceInfo, Environment, EnvironmentInfo, EventName, PageInfo, Platform, PlatformInfo, ThirdPartyTracker, TrackEvent, TrackEventResponse, TrackName, TrackProperties, TrackTags, UTMParams, UserData, UserProvidedData };
|
|
222
221
|
//# sourceMappingURL=types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/track/types.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":["GAUserProvidedData"],"sources":["../../src/track/types.ts"],"mappings":";;YAEY;YACA,YAAY;YAEZ,UAAU,UAAU,YAAY,aAAa,gBAAgB,iBACrE,IACA;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+Ba;;;;;;;KAQZ,oBAAoB,KAAK,gBAAgB,wBAC1C,sBAAsB;YAGd,gBAAgB,UAAU,YAAY,aAAa,gBAAgB,iBAC3E,eAAe,KAAK,oBAAoB,KACxC,gBAAgB,wBACd,sBAAsB,KACtB,OAAO,mBAAmB;YAEpB;YACA;iBAEK;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe,yBAAyBA;EACxC;EACA;EACA;EACA;EACA;IAAa;IAAc;IAAe;;EAE1C;EACA;;YAGU,qBAAqB,UAAU,WACzC,MAAM,UAAU,IAChB,aAAa,gBAAgB,IAC7B;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;;EAEf;EACA;;iBAGe;EACf;EACA;EACA;;;;;;;;;;iBAWe;EACf;EACA;EACA;;;;;;;EAOA;;;;;;EAMA;;iBAGe;;;;;;;EAOf;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;;;;;;;iBAQe;;EAEf;;;;;;;;;;;;EAqCA;;;;;;EAuDA;;EAMA;;EAEA;;EAEA;;EAEA;;EAUA;;EAEA;;iBAGe,kBACP,cAAc,YAAY,SAAS,iBAAiB,UAAU,iBAAiB;EACvF;GACC;;iBAGc,WAAW,UAAU,YAAY;EAChD;EACA,MAAM,UAAU;EAChB,MAAM;EACN;EACA;EACA,UAAU;EACV,aAAa;EACb,aAAa,gBAAgB;EAC7B;;YAGU;;EAEV"}
|