@shware/analytics 0.1.15 → 0.1.16
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/index.cjs +17 -182
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -501
- package/dist/index.d.ts +7 -501
- package/dist/index.mjs +5 -158
- package/dist/index.mjs.map +1 -1
- package/dist/next/index.cjs +3 -3
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.mjs +1 -1
- package/dist/next/index.mjs.map +1 -1
- package/dist/react-router/index.cjs +3 -3
- package/dist/react-router/index.cjs.map +1 -1
- package/dist/react-router/index.mjs +1 -1
- package/dist/react-router/index.mjs.map +1 -1
- package/dist/schema/index.cjs +85 -0
- package/dist/schema/index.cjs.map +1 -0
- package/dist/schema/index.d.cts +177 -0
- package/dist/schema/index.d.ts +177 -0
- package/dist/schema/index.mjs +58 -0
- package/dist/schema/index.mjs.map +1 -0
- package/dist/setup/index.cjs +63 -0
- package/dist/setup/index.cjs.map +1 -0
- package/dist/setup/index.d.cts +29 -0
- package/dist/setup/index.d.ts +29 -0
- package/dist/setup/index.mjs +27 -0
- package/dist/setup/index.mjs.map +1 -0
- package/dist/track/ga.cjs +102 -0
- package/dist/track/ga.cjs.map +1 -0
- package/dist/track/ga.d.cts +4 -0
- package/dist/track/ga.d.ts +4 -0
- package/dist/track/ga.mjs +76 -0
- package/dist/track/ga.mjs.map +1 -0
- package/dist/track/index.cjs +65 -0
- package/dist/track/index.cjs.map +1 -0
- package/dist/track/index.d.cts +10 -0
- package/dist/track/index.d.ts +10 -0
- package/dist/track/index.mjs +40 -0
- package/dist/track/index.mjs.map +1 -0
- package/dist/types/index.cjs +19 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +327 -0
- package/dist/types/index.d.ts +327 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/visitor/index.cjs +77 -0
- package/dist/visitor/index.cjs.map +1 -0
- package/dist/visitor/index.d.cts +6 -0
- package/dist/visitor/index.d.ts +6 -0
- package/dist/visitor/index.mjs +51 -0
- package/dist/visitor/index.mjs.map +1 -0
- package/dist/web/index.d.cts +1 -50
- package/dist/web/index.d.ts +1 -50
- package/package.json +1 -1
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
interface Item {
|
|
2
|
+
item_brand?: string;
|
|
3
|
+
item_id?: string;
|
|
4
|
+
item_name?: string;
|
|
5
|
+
item_category?: string;
|
|
6
|
+
item_category2?: string;
|
|
7
|
+
item_category3?: string;
|
|
8
|
+
item_category4?: string;
|
|
9
|
+
item_category5?: string;
|
|
10
|
+
item_list_id?: string;
|
|
11
|
+
item_list_name?: string;
|
|
12
|
+
item_location_id?: string;
|
|
13
|
+
item_variant?: string;
|
|
14
|
+
quantity?: number;
|
|
15
|
+
price?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ref: https://developers.google.com/analytics/devguides/collection/ga4/reference/events?client_type=gtag
|
|
19
|
+
* ref: https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event
|
|
20
|
+
* */
|
|
21
|
+
type StandardEventProperties = {
|
|
22
|
+
add_payment_info: {
|
|
23
|
+
items?: Item[];
|
|
24
|
+
currency?: string;
|
|
25
|
+
value?: number;
|
|
26
|
+
coupon?: string;
|
|
27
|
+
payment_type?: string;
|
|
28
|
+
};
|
|
29
|
+
add_shipping_info: {
|
|
30
|
+
items?: Item[];
|
|
31
|
+
currency?: string;
|
|
32
|
+
value?: number;
|
|
33
|
+
coupon?: string;
|
|
34
|
+
shipping_tier?: string;
|
|
35
|
+
};
|
|
36
|
+
add_to_cart: {
|
|
37
|
+
items?: Item[];
|
|
38
|
+
currency?: string;
|
|
39
|
+
value?: number;
|
|
40
|
+
};
|
|
41
|
+
add_to_wishlist: {
|
|
42
|
+
items?: Item[];
|
|
43
|
+
currency?: string;
|
|
44
|
+
value?: number;
|
|
45
|
+
};
|
|
46
|
+
begin_checkout: {
|
|
47
|
+
currency?: string;
|
|
48
|
+
value?: number;
|
|
49
|
+
coupon?: string;
|
|
50
|
+
items?: Item[];
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
};
|
|
53
|
+
close_convert_lead: {
|
|
54
|
+
currency: string;
|
|
55
|
+
value: number;
|
|
56
|
+
};
|
|
57
|
+
close_unconvert_lead: {
|
|
58
|
+
currency: string;
|
|
59
|
+
value: number;
|
|
60
|
+
unconvert_lead_reason?: string;
|
|
61
|
+
};
|
|
62
|
+
disqualify_lead: {
|
|
63
|
+
currency: string;
|
|
64
|
+
value: number;
|
|
65
|
+
disqualified_lead_reason?: string;
|
|
66
|
+
};
|
|
67
|
+
earn_virtual_currency: {
|
|
68
|
+
virtual_currency_name: string;
|
|
69
|
+
value: number;
|
|
70
|
+
};
|
|
71
|
+
generate_lead: {
|
|
72
|
+
currency?: string;
|
|
73
|
+
value?: number;
|
|
74
|
+
};
|
|
75
|
+
join_group: {
|
|
76
|
+
group_id: string;
|
|
77
|
+
};
|
|
78
|
+
level_end: {
|
|
79
|
+
level: number;
|
|
80
|
+
success?: string;
|
|
81
|
+
};
|
|
82
|
+
level_start: {
|
|
83
|
+
level: number;
|
|
84
|
+
};
|
|
85
|
+
level_up: {
|
|
86
|
+
level: number;
|
|
87
|
+
character?: string;
|
|
88
|
+
};
|
|
89
|
+
login: {
|
|
90
|
+
method: string;
|
|
91
|
+
};
|
|
92
|
+
post_score: {
|
|
93
|
+
score: number;
|
|
94
|
+
level?: number;
|
|
95
|
+
character?: string;
|
|
96
|
+
};
|
|
97
|
+
purchase: {
|
|
98
|
+
affiliation?: string;
|
|
99
|
+
coupon?: string;
|
|
100
|
+
currency?: string;
|
|
101
|
+
items?: Item[];
|
|
102
|
+
shipping?: number;
|
|
103
|
+
tax?: number;
|
|
104
|
+
value?: number;
|
|
105
|
+
transaction_id?: string;
|
|
106
|
+
[key: string]: any;
|
|
107
|
+
};
|
|
108
|
+
qualify_lead: {
|
|
109
|
+
currency: string;
|
|
110
|
+
value: number;
|
|
111
|
+
};
|
|
112
|
+
refund: {
|
|
113
|
+
affiliation?: string;
|
|
114
|
+
coupon?: string;
|
|
115
|
+
currency?: string;
|
|
116
|
+
items?: Item[];
|
|
117
|
+
shipping?: number;
|
|
118
|
+
tax?: number;
|
|
119
|
+
value?: number;
|
|
120
|
+
transaction_id?: string;
|
|
121
|
+
};
|
|
122
|
+
remove_from_cart: {
|
|
123
|
+
items?: Item[];
|
|
124
|
+
value?: number;
|
|
125
|
+
currency?: string;
|
|
126
|
+
};
|
|
127
|
+
search: {
|
|
128
|
+
search_term: string;
|
|
129
|
+
number_of_nights?: number;
|
|
130
|
+
number_of_rooms?: number;
|
|
131
|
+
number_of_passengers?: number;
|
|
132
|
+
origin?: string;
|
|
133
|
+
destination?: string;
|
|
134
|
+
start_date?: string;
|
|
135
|
+
end_date?: string;
|
|
136
|
+
travel_class?: string;
|
|
137
|
+
};
|
|
138
|
+
select_content: {
|
|
139
|
+
content_type: string;
|
|
140
|
+
item_id: string;
|
|
141
|
+
};
|
|
142
|
+
select_item: {
|
|
143
|
+
items?: Item[];
|
|
144
|
+
content_type: string;
|
|
145
|
+
item_list_id: string;
|
|
146
|
+
item_list_name: string;
|
|
147
|
+
};
|
|
148
|
+
select_promotion: {
|
|
149
|
+
creative_name: string;
|
|
150
|
+
creative_slot: string;
|
|
151
|
+
items?: Item[];
|
|
152
|
+
location_id: string;
|
|
153
|
+
promotion_id: string;
|
|
154
|
+
promotion_name: string;
|
|
155
|
+
};
|
|
156
|
+
share: {
|
|
157
|
+
content_type: string;
|
|
158
|
+
item_id: string;
|
|
159
|
+
method: string;
|
|
160
|
+
activity_type?: string | null;
|
|
161
|
+
post_id?: string;
|
|
162
|
+
};
|
|
163
|
+
sign_up: {
|
|
164
|
+
method: string;
|
|
165
|
+
};
|
|
166
|
+
spend_virtual_currency: {
|
|
167
|
+
item_name: string;
|
|
168
|
+
virtual_currency_name: string;
|
|
169
|
+
value: number;
|
|
170
|
+
};
|
|
171
|
+
tutorial_begin: undefined;
|
|
172
|
+
tutorial_complete: undefined;
|
|
173
|
+
unlock_achievement: {
|
|
174
|
+
achievement_id: string;
|
|
175
|
+
};
|
|
176
|
+
view_cart: {
|
|
177
|
+
items?: Item[];
|
|
178
|
+
currency?: string;
|
|
179
|
+
value?: number;
|
|
180
|
+
};
|
|
181
|
+
view_item: {
|
|
182
|
+
items?: Item[];
|
|
183
|
+
currency?: string;
|
|
184
|
+
value?: number;
|
|
185
|
+
};
|
|
186
|
+
view_item_list: {
|
|
187
|
+
items?: Item[];
|
|
188
|
+
item_list_id?: string;
|
|
189
|
+
item_list_name?: string;
|
|
190
|
+
};
|
|
191
|
+
view_promotion: {
|
|
192
|
+
items?: Item[];
|
|
193
|
+
location_id?: string;
|
|
194
|
+
creative_name?: string;
|
|
195
|
+
creative_slot?: string;
|
|
196
|
+
promotion_id?: string;
|
|
197
|
+
promotion_name?: string;
|
|
198
|
+
};
|
|
199
|
+
working_lead: {
|
|
200
|
+
currency: string;
|
|
201
|
+
value: number;
|
|
202
|
+
lead_status?: string;
|
|
203
|
+
};
|
|
204
|
+
ad_impression: {
|
|
205
|
+
value?: number;
|
|
206
|
+
currency?: string;
|
|
207
|
+
ad_format?: string;
|
|
208
|
+
ad_platform?: string;
|
|
209
|
+
ad_source?: string;
|
|
210
|
+
ad_unit_name?: string;
|
|
211
|
+
};
|
|
212
|
+
app_open: undefined;
|
|
213
|
+
campaign_details: {
|
|
214
|
+
source: string;
|
|
215
|
+
medium: string;
|
|
216
|
+
campaign: string;
|
|
217
|
+
term?: string;
|
|
218
|
+
content?: string;
|
|
219
|
+
aclid?: string;
|
|
220
|
+
cp1?: string;
|
|
221
|
+
};
|
|
222
|
+
screen_view: {
|
|
223
|
+
screen_name?: string;
|
|
224
|
+
screen_class?: string;
|
|
225
|
+
};
|
|
226
|
+
view_search_results: {
|
|
227
|
+
search_term: string;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
type AllowedPropertyValues = string | number | boolean | null;
|
|
231
|
+
type EventName = Lowercase<string>;
|
|
232
|
+
type CustomEventProperties = Record<Lowercase<string>, AllowedPropertyValues>;
|
|
233
|
+
type TrackProperties<T extends EventName = EventName> = T extends keyof StandardEventProperties ? StandardEventProperties[T] : CustomEventProperties;
|
|
234
|
+
interface UserData {
|
|
235
|
+
userId: string;
|
|
236
|
+
email?: string;
|
|
237
|
+
firstName?: string;
|
|
238
|
+
lastName?: string;
|
|
239
|
+
phone?: string;
|
|
240
|
+
dateOfBirth?: string;
|
|
241
|
+
gender?: string;
|
|
242
|
+
city?: string;
|
|
243
|
+
state?: string;
|
|
244
|
+
postal?: string;
|
|
245
|
+
country?: string;
|
|
246
|
+
}
|
|
247
|
+
type ThirdPartyTracker = <T extends EventName = EventName>(name: T, properties?: TrackProperties<T>, event_id?: string) => void;
|
|
248
|
+
interface PlatformInfo {
|
|
249
|
+
os?: string;
|
|
250
|
+
os_name?: string;
|
|
251
|
+
os_version?: string;
|
|
252
|
+
browser?: string;
|
|
253
|
+
browser_name?: string;
|
|
254
|
+
browser_version?: string;
|
|
255
|
+
platform?: 'ios' | 'android' | 'web' | 'macos' | 'windows' | 'linux' | 'unknown';
|
|
256
|
+
}
|
|
257
|
+
interface DeviceInfo {
|
|
258
|
+
device?: string;
|
|
259
|
+
device_id?: string;
|
|
260
|
+
device_type?: string;
|
|
261
|
+
device_vendor?: string;
|
|
262
|
+
device_pixel_ratio?: string;
|
|
263
|
+
screen_resolution?: `${number}x${number}`;
|
|
264
|
+
}
|
|
265
|
+
interface EnvironmentInfo {
|
|
266
|
+
release?: string;
|
|
267
|
+
language?: string;
|
|
268
|
+
timezone?: string;
|
|
269
|
+
environment?: 'development' | 'production';
|
|
270
|
+
}
|
|
271
|
+
interface SourceInfo {
|
|
272
|
+
source_url?: string;
|
|
273
|
+
source?: 'app' | 'web' | 'offline';
|
|
274
|
+
}
|
|
275
|
+
interface ThirdPartyFields {
|
|
276
|
+
/**
|
|
277
|
+
* Meta pixel fields
|
|
278
|
+
* ref: https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/customer-information-parameters#fbc
|
|
279
|
+
* Stored in the _fbc/_fbp browser cookie under your domain
|
|
280
|
+
*/
|
|
281
|
+
fbc?: string;
|
|
282
|
+
fbp?: string;
|
|
283
|
+
/**
|
|
284
|
+
* Google Analytics fields
|
|
285
|
+
*/
|
|
286
|
+
gclid?: string;
|
|
287
|
+
}
|
|
288
|
+
interface UTMParams {
|
|
289
|
+
utm_source?: string;
|
|
290
|
+
utm_medium?: string;
|
|
291
|
+
utm_campaign?: string;
|
|
292
|
+
utm_term?: string;
|
|
293
|
+
utm_content?: string;
|
|
294
|
+
}
|
|
295
|
+
interface TrackTags extends PlatformInfo, DeviceInfo, EnvironmentInfo, SourceInfo, ThirdPartyFields, UTMParams {
|
|
296
|
+
[key: string]: string | undefined;
|
|
297
|
+
}
|
|
298
|
+
interface CreateTrackEventDTO<T extends EventName = EventName> {
|
|
299
|
+
name: string;
|
|
300
|
+
tags: TrackTags;
|
|
301
|
+
visitor_id: string;
|
|
302
|
+
properties?: TrackProperties<T>;
|
|
303
|
+
timestamp: string;
|
|
304
|
+
}
|
|
305
|
+
interface TrackEventResponse {
|
|
306
|
+
/**
|
|
307
|
+
* track event id
|
|
308
|
+
* some tracking system will use event_id and event_name for deduplication
|
|
309
|
+
* */
|
|
310
|
+
id: string;
|
|
311
|
+
}
|
|
312
|
+
type VisitorProperties = Record<Lowercase<string>, AllowedPropertyValues>;
|
|
313
|
+
interface Visitor {
|
|
314
|
+
id: string;
|
|
315
|
+
device_id: string;
|
|
316
|
+
properties: VisitorProperties;
|
|
317
|
+
}
|
|
318
|
+
interface CreateVisitorDTO {
|
|
319
|
+
device_id: string;
|
|
320
|
+
properties?: VisitorProperties;
|
|
321
|
+
}
|
|
322
|
+
interface UpdateVisitorDTO {
|
|
323
|
+
properties: VisitorProperties;
|
|
324
|
+
}
|
|
325
|
+
type ThirdPartyUserSetter = (properties: VisitorProperties) => void;
|
|
326
|
+
|
|
327
|
+
export type { AllowedPropertyValues, CreateTrackEventDTO, CreateVisitorDTO, CustomEventProperties, DeviceInfo, EnvironmentInfo, EventName, Item, PlatformInfo, SourceInfo, StandardEventProperties, ThirdPartyFields, ThirdPartyTracker, ThirdPartyUserSetter, TrackEventResponse, TrackProperties, TrackTags, UTMParams, UpdateVisitorDTO, UserData, Visitor, VisitorProperties };
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
interface Item {
|
|
2
|
+
item_brand?: string;
|
|
3
|
+
item_id?: string;
|
|
4
|
+
item_name?: string;
|
|
5
|
+
item_category?: string;
|
|
6
|
+
item_category2?: string;
|
|
7
|
+
item_category3?: string;
|
|
8
|
+
item_category4?: string;
|
|
9
|
+
item_category5?: string;
|
|
10
|
+
item_list_id?: string;
|
|
11
|
+
item_list_name?: string;
|
|
12
|
+
item_location_id?: string;
|
|
13
|
+
item_variant?: string;
|
|
14
|
+
quantity?: number;
|
|
15
|
+
price?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ref: https://developers.google.com/analytics/devguides/collection/ga4/reference/events?client_type=gtag
|
|
19
|
+
* ref: https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event
|
|
20
|
+
* */
|
|
21
|
+
type StandardEventProperties = {
|
|
22
|
+
add_payment_info: {
|
|
23
|
+
items?: Item[];
|
|
24
|
+
currency?: string;
|
|
25
|
+
value?: number;
|
|
26
|
+
coupon?: string;
|
|
27
|
+
payment_type?: string;
|
|
28
|
+
};
|
|
29
|
+
add_shipping_info: {
|
|
30
|
+
items?: Item[];
|
|
31
|
+
currency?: string;
|
|
32
|
+
value?: number;
|
|
33
|
+
coupon?: string;
|
|
34
|
+
shipping_tier?: string;
|
|
35
|
+
};
|
|
36
|
+
add_to_cart: {
|
|
37
|
+
items?: Item[];
|
|
38
|
+
currency?: string;
|
|
39
|
+
value?: number;
|
|
40
|
+
};
|
|
41
|
+
add_to_wishlist: {
|
|
42
|
+
items?: Item[];
|
|
43
|
+
currency?: string;
|
|
44
|
+
value?: number;
|
|
45
|
+
};
|
|
46
|
+
begin_checkout: {
|
|
47
|
+
currency?: string;
|
|
48
|
+
value?: number;
|
|
49
|
+
coupon?: string;
|
|
50
|
+
items?: Item[];
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
};
|
|
53
|
+
close_convert_lead: {
|
|
54
|
+
currency: string;
|
|
55
|
+
value: number;
|
|
56
|
+
};
|
|
57
|
+
close_unconvert_lead: {
|
|
58
|
+
currency: string;
|
|
59
|
+
value: number;
|
|
60
|
+
unconvert_lead_reason?: string;
|
|
61
|
+
};
|
|
62
|
+
disqualify_lead: {
|
|
63
|
+
currency: string;
|
|
64
|
+
value: number;
|
|
65
|
+
disqualified_lead_reason?: string;
|
|
66
|
+
};
|
|
67
|
+
earn_virtual_currency: {
|
|
68
|
+
virtual_currency_name: string;
|
|
69
|
+
value: number;
|
|
70
|
+
};
|
|
71
|
+
generate_lead: {
|
|
72
|
+
currency?: string;
|
|
73
|
+
value?: number;
|
|
74
|
+
};
|
|
75
|
+
join_group: {
|
|
76
|
+
group_id: string;
|
|
77
|
+
};
|
|
78
|
+
level_end: {
|
|
79
|
+
level: number;
|
|
80
|
+
success?: string;
|
|
81
|
+
};
|
|
82
|
+
level_start: {
|
|
83
|
+
level: number;
|
|
84
|
+
};
|
|
85
|
+
level_up: {
|
|
86
|
+
level: number;
|
|
87
|
+
character?: string;
|
|
88
|
+
};
|
|
89
|
+
login: {
|
|
90
|
+
method: string;
|
|
91
|
+
};
|
|
92
|
+
post_score: {
|
|
93
|
+
score: number;
|
|
94
|
+
level?: number;
|
|
95
|
+
character?: string;
|
|
96
|
+
};
|
|
97
|
+
purchase: {
|
|
98
|
+
affiliation?: string;
|
|
99
|
+
coupon?: string;
|
|
100
|
+
currency?: string;
|
|
101
|
+
items?: Item[];
|
|
102
|
+
shipping?: number;
|
|
103
|
+
tax?: number;
|
|
104
|
+
value?: number;
|
|
105
|
+
transaction_id?: string;
|
|
106
|
+
[key: string]: any;
|
|
107
|
+
};
|
|
108
|
+
qualify_lead: {
|
|
109
|
+
currency: string;
|
|
110
|
+
value: number;
|
|
111
|
+
};
|
|
112
|
+
refund: {
|
|
113
|
+
affiliation?: string;
|
|
114
|
+
coupon?: string;
|
|
115
|
+
currency?: string;
|
|
116
|
+
items?: Item[];
|
|
117
|
+
shipping?: number;
|
|
118
|
+
tax?: number;
|
|
119
|
+
value?: number;
|
|
120
|
+
transaction_id?: string;
|
|
121
|
+
};
|
|
122
|
+
remove_from_cart: {
|
|
123
|
+
items?: Item[];
|
|
124
|
+
value?: number;
|
|
125
|
+
currency?: string;
|
|
126
|
+
};
|
|
127
|
+
search: {
|
|
128
|
+
search_term: string;
|
|
129
|
+
number_of_nights?: number;
|
|
130
|
+
number_of_rooms?: number;
|
|
131
|
+
number_of_passengers?: number;
|
|
132
|
+
origin?: string;
|
|
133
|
+
destination?: string;
|
|
134
|
+
start_date?: string;
|
|
135
|
+
end_date?: string;
|
|
136
|
+
travel_class?: string;
|
|
137
|
+
};
|
|
138
|
+
select_content: {
|
|
139
|
+
content_type: string;
|
|
140
|
+
item_id: string;
|
|
141
|
+
};
|
|
142
|
+
select_item: {
|
|
143
|
+
items?: Item[];
|
|
144
|
+
content_type: string;
|
|
145
|
+
item_list_id: string;
|
|
146
|
+
item_list_name: string;
|
|
147
|
+
};
|
|
148
|
+
select_promotion: {
|
|
149
|
+
creative_name: string;
|
|
150
|
+
creative_slot: string;
|
|
151
|
+
items?: Item[];
|
|
152
|
+
location_id: string;
|
|
153
|
+
promotion_id: string;
|
|
154
|
+
promotion_name: string;
|
|
155
|
+
};
|
|
156
|
+
share: {
|
|
157
|
+
content_type: string;
|
|
158
|
+
item_id: string;
|
|
159
|
+
method: string;
|
|
160
|
+
activity_type?: string | null;
|
|
161
|
+
post_id?: string;
|
|
162
|
+
};
|
|
163
|
+
sign_up: {
|
|
164
|
+
method: string;
|
|
165
|
+
};
|
|
166
|
+
spend_virtual_currency: {
|
|
167
|
+
item_name: string;
|
|
168
|
+
virtual_currency_name: string;
|
|
169
|
+
value: number;
|
|
170
|
+
};
|
|
171
|
+
tutorial_begin: undefined;
|
|
172
|
+
tutorial_complete: undefined;
|
|
173
|
+
unlock_achievement: {
|
|
174
|
+
achievement_id: string;
|
|
175
|
+
};
|
|
176
|
+
view_cart: {
|
|
177
|
+
items?: Item[];
|
|
178
|
+
currency?: string;
|
|
179
|
+
value?: number;
|
|
180
|
+
};
|
|
181
|
+
view_item: {
|
|
182
|
+
items?: Item[];
|
|
183
|
+
currency?: string;
|
|
184
|
+
value?: number;
|
|
185
|
+
};
|
|
186
|
+
view_item_list: {
|
|
187
|
+
items?: Item[];
|
|
188
|
+
item_list_id?: string;
|
|
189
|
+
item_list_name?: string;
|
|
190
|
+
};
|
|
191
|
+
view_promotion: {
|
|
192
|
+
items?: Item[];
|
|
193
|
+
location_id?: string;
|
|
194
|
+
creative_name?: string;
|
|
195
|
+
creative_slot?: string;
|
|
196
|
+
promotion_id?: string;
|
|
197
|
+
promotion_name?: string;
|
|
198
|
+
};
|
|
199
|
+
working_lead: {
|
|
200
|
+
currency: string;
|
|
201
|
+
value: number;
|
|
202
|
+
lead_status?: string;
|
|
203
|
+
};
|
|
204
|
+
ad_impression: {
|
|
205
|
+
value?: number;
|
|
206
|
+
currency?: string;
|
|
207
|
+
ad_format?: string;
|
|
208
|
+
ad_platform?: string;
|
|
209
|
+
ad_source?: string;
|
|
210
|
+
ad_unit_name?: string;
|
|
211
|
+
};
|
|
212
|
+
app_open: undefined;
|
|
213
|
+
campaign_details: {
|
|
214
|
+
source: string;
|
|
215
|
+
medium: string;
|
|
216
|
+
campaign: string;
|
|
217
|
+
term?: string;
|
|
218
|
+
content?: string;
|
|
219
|
+
aclid?: string;
|
|
220
|
+
cp1?: string;
|
|
221
|
+
};
|
|
222
|
+
screen_view: {
|
|
223
|
+
screen_name?: string;
|
|
224
|
+
screen_class?: string;
|
|
225
|
+
};
|
|
226
|
+
view_search_results: {
|
|
227
|
+
search_term: string;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
type AllowedPropertyValues = string | number | boolean | null;
|
|
231
|
+
type EventName = Lowercase<string>;
|
|
232
|
+
type CustomEventProperties = Record<Lowercase<string>, AllowedPropertyValues>;
|
|
233
|
+
type TrackProperties<T extends EventName = EventName> = T extends keyof StandardEventProperties ? StandardEventProperties[T] : CustomEventProperties;
|
|
234
|
+
interface UserData {
|
|
235
|
+
userId: string;
|
|
236
|
+
email?: string;
|
|
237
|
+
firstName?: string;
|
|
238
|
+
lastName?: string;
|
|
239
|
+
phone?: string;
|
|
240
|
+
dateOfBirth?: string;
|
|
241
|
+
gender?: string;
|
|
242
|
+
city?: string;
|
|
243
|
+
state?: string;
|
|
244
|
+
postal?: string;
|
|
245
|
+
country?: string;
|
|
246
|
+
}
|
|
247
|
+
type ThirdPartyTracker = <T extends EventName = EventName>(name: T, properties?: TrackProperties<T>, event_id?: string) => void;
|
|
248
|
+
interface PlatformInfo {
|
|
249
|
+
os?: string;
|
|
250
|
+
os_name?: string;
|
|
251
|
+
os_version?: string;
|
|
252
|
+
browser?: string;
|
|
253
|
+
browser_name?: string;
|
|
254
|
+
browser_version?: string;
|
|
255
|
+
platform?: 'ios' | 'android' | 'web' | 'macos' | 'windows' | 'linux' | 'unknown';
|
|
256
|
+
}
|
|
257
|
+
interface DeviceInfo {
|
|
258
|
+
device?: string;
|
|
259
|
+
device_id?: string;
|
|
260
|
+
device_type?: string;
|
|
261
|
+
device_vendor?: string;
|
|
262
|
+
device_pixel_ratio?: string;
|
|
263
|
+
screen_resolution?: `${number}x${number}`;
|
|
264
|
+
}
|
|
265
|
+
interface EnvironmentInfo {
|
|
266
|
+
release?: string;
|
|
267
|
+
language?: string;
|
|
268
|
+
timezone?: string;
|
|
269
|
+
environment?: 'development' | 'production';
|
|
270
|
+
}
|
|
271
|
+
interface SourceInfo {
|
|
272
|
+
source_url?: string;
|
|
273
|
+
source?: 'app' | 'web' | 'offline';
|
|
274
|
+
}
|
|
275
|
+
interface ThirdPartyFields {
|
|
276
|
+
/**
|
|
277
|
+
* Meta pixel fields
|
|
278
|
+
* ref: https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/customer-information-parameters#fbc
|
|
279
|
+
* Stored in the _fbc/_fbp browser cookie under your domain
|
|
280
|
+
*/
|
|
281
|
+
fbc?: string;
|
|
282
|
+
fbp?: string;
|
|
283
|
+
/**
|
|
284
|
+
* Google Analytics fields
|
|
285
|
+
*/
|
|
286
|
+
gclid?: string;
|
|
287
|
+
}
|
|
288
|
+
interface UTMParams {
|
|
289
|
+
utm_source?: string;
|
|
290
|
+
utm_medium?: string;
|
|
291
|
+
utm_campaign?: string;
|
|
292
|
+
utm_term?: string;
|
|
293
|
+
utm_content?: string;
|
|
294
|
+
}
|
|
295
|
+
interface TrackTags extends PlatformInfo, DeviceInfo, EnvironmentInfo, SourceInfo, ThirdPartyFields, UTMParams {
|
|
296
|
+
[key: string]: string | undefined;
|
|
297
|
+
}
|
|
298
|
+
interface CreateTrackEventDTO<T extends EventName = EventName> {
|
|
299
|
+
name: string;
|
|
300
|
+
tags: TrackTags;
|
|
301
|
+
visitor_id: string;
|
|
302
|
+
properties?: TrackProperties<T>;
|
|
303
|
+
timestamp: string;
|
|
304
|
+
}
|
|
305
|
+
interface TrackEventResponse {
|
|
306
|
+
/**
|
|
307
|
+
* track event id
|
|
308
|
+
* some tracking system will use event_id and event_name for deduplication
|
|
309
|
+
* */
|
|
310
|
+
id: string;
|
|
311
|
+
}
|
|
312
|
+
type VisitorProperties = Record<Lowercase<string>, AllowedPropertyValues>;
|
|
313
|
+
interface Visitor {
|
|
314
|
+
id: string;
|
|
315
|
+
device_id: string;
|
|
316
|
+
properties: VisitorProperties;
|
|
317
|
+
}
|
|
318
|
+
interface CreateVisitorDTO {
|
|
319
|
+
device_id: string;
|
|
320
|
+
properties?: VisitorProperties;
|
|
321
|
+
}
|
|
322
|
+
interface UpdateVisitorDTO {
|
|
323
|
+
properties: VisitorProperties;
|
|
324
|
+
}
|
|
325
|
+
type ThirdPartyUserSetter = (properties: VisitorProperties) => void;
|
|
326
|
+
|
|
327
|
+
export type { AllowedPropertyValues, CreateTrackEventDTO, CreateVisitorDTO, CustomEventProperties, DeviceInfo, EnvironmentInfo, EventName, Item, PlatformInfo, SourceInfo, StandardEventProperties, ThirdPartyFields, ThirdPartyTracker, ThirdPartyUserSetter, TrackEventResponse, TrackProperties, TrackTags, UTMParams, UpdateVisitorDTO, UserData, Visitor, VisitorProperties };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|