@xylabs/pixel 5.0.83 → 5.0.86

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.
Files changed (40) hide show
  1. package/README.md +287 -683
  2. package/dist/browser/Api/Api.d.ts +6 -0
  3. package/dist/browser/Api/Api.d.ts.map +1 -1
  4. package/dist/browser/Api/UserEvent.d.ts +1 -0
  5. package/dist/browser/Api/UserEvent.d.ts.map +1 -1
  6. package/dist/browser/Api/UserEventSystem.d.ts +1 -0
  7. package/dist/browser/Api/UserEventSystem.d.ts.map +1 -1
  8. package/dist/browser/CommonFields.d.ts +1 -0
  9. package/dist/browser/CommonFields.d.ts.map +1 -1
  10. package/dist/browser/ExIds.d.ts +1 -0
  11. package/dist/browser/ExIds.d.ts.map +1 -1
  12. package/dist/browser/FunnelStartedFields.d.ts +1 -0
  13. package/dist/browser/FunnelStartedFields.d.ts.map +1 -1
  14. package/dist/browser/Pixel.d.ts +21 -0
  15. package/dist/browser/Pixel.d.ts.map +1 -1
  16. package/dist/browser/PurchaseFields.d.ts +1 -0
  17. package/dist/browser/PurchaseFields.d.ts.map +1 -1
  18. package/dist/browser/Referrer.d.ts +5 -0
  19. package/dist/browser/Referrer.d.ts.map +1 -1
  20. package/dist/browser/TestStartedFields.d.ts +1 -0
  21. package/dist/browser/TestStartedFields.d.ts.map +1 -1
  22. package/dist/browser/UniqueUserId.d.ts +2 -0
  23. package/dist/browser/UniqueUserId.d.ts.map +1 -1
  24. package/dist/browser/UserClickFields.d.ts +1 -0
  25. package/dist/browser/UserClickFields.d.ts.map +1 -1
  26. package/dist/browser/UserEventHandler.d.ts +5 -0
  27. package/dist/browser/UserEventHandler.d.ts.map +1 -1
  28. package/dist/browser/UtmFields.d.ts +10 -0
  29. package/dist/browser/UtmFields.d.ts.map +1 -1
  30. package/dist/browser/ViewContentFields.d.ts +1 -0
  31. package/dist/browser/ViewContentFields.d.ts.map +1 -1
  32. package/dist/browser/XyLabsTrackingEventJson.d.ts +1 -0
  33. package/dist/browser/XyLabsTrackingEventJson.d.ts.map +1 -1
  34. package/dist/browser/XyUserEventHandler.d.ts +6 -0
  35. package/dist/browser/XyUserEventHandler.d.ts.map +1 -1
  36. package/dist/browser/getSystemInfo.d.ts +5 -0
  37. package/dist/browser/getSystemInfo.d.ts.map +1 -1
  38. package/dist/browser/index.mjs +44 -0
  39. package/dist/browser/index.mjs.map +1 -1
  40. package/package.json +8 -8
package/README.md CHANGED
@@ -15,6 +15,8 @@
15
15
 
16
16
  Event Client for xylabs ESB
17
17
 
18
+
19
+
18
20
  ## Reference
19
21
 
20
22
  **@xylabs/pixel**
@@ -23,28 +25,34 @@ Event Client for xylabs ESB
23
25
 
24
26
  ## Classes
25
27
 
26
- - [PixelApi](#classes/PixelApi)
27
- - [XyPixel](#classes/XyPixel)
28
- - [Referrer](#classes/Referrer)
29
- - [UniqueUserId](#classes/UniqueUserId)
30
- - [UserEventHandler](#classes/UserEventHandler)
31
- - [UtmFields](#classes/UtmFields)
32
- - [XyUserEventHandler](#classes/XyUserEventHandler)
28
+ | Class | Description |
29
+ | ------ | ------ |
30
+ | [PixelApi](#classes/PixelApi) | HTTP client for sending tracking events to the XY Labs pixel API. |
31
+ | [XyPixel](#classes/XyPixel) | Singleton pixel tracker that queues and sends user events to the XY Labs tracking API. |
32
+ | [Referrer](#classes/Referrer) | Tracks and persists the document referrer in both session and local storage. |
33
+ | [UniqueUserId](#classes/UniqueUserId) | Generates and persists a unique user identifier in localStorage. |
34
+ | [UserEventHandler](#classes/UserEventHandler) | Abstract base class for handling user tracking events. |
35
+ | [UtmFields](#classes/UtmFields) | Tracks UTM campaign parameters from query strings, persisting history in localStorage. |
36
+ | [XyUserEventHandler](#classes/XyUserEventHandler) | Concrete event handler that sends tracking events through the XyPixel singleton. |
33
37
 
34
38
  ## Interfaces
35
39
 
36
- - [UserEvent](#interfaces/UserEvent)
37
- - [CommonFields](#interfaces/CommonFields)
38
- - [FunnelStartedFields](#interfaces/FunnelStartedFields)
39
- - [PurchaseFields](#interfaces/PurchaseFields)
40
- - [TestStartedFields](#interfaces/TestStartedFields)
41
- - [UserClickFields](#interfaces/UserClickFields)
42
- - [ViewContentFields](#interfaces/ViewContentFields)
43
- - [XyLabsTrackingEventJson](#interfaces/XyLabsTrackingEventJson)
40
+ | Interface | Description |
41
+ | ------ | ------ |
42
+ | [UserEvent](#interfaces/UserEvent) | Represents a single user tracking event to be sent to the pixel API. |
43
+ | [CommonFields](#interfaces/CommonFields) | Common fields shared across all tracking event types. |
44
+ | [FunnelStartedFields](#interfaces/FunnelStartedFields) | Fields for a funnel-started tracking event. |
45
+ | [PurchaseFields](#interfaces/PurchaseFields) | Fields for a purchase tracking event. |
46
+ | [TestStartedFields](#interfaces/TestStartedFields) | Fields for a test-started tracking event (e.g. A/B test). |
47
+ | [UserClickFields](#interfaces/UserClickFields) | Fields for a user click tracking event. |
48
+ | [ViewContentFields](#interfaces/ViewContentFields) | Fields for a view-content tracking event. |
49
+ | [XyLabsTrackingEventJson](#interfaces/XyLabsTrackingEventJson) | JSON structure for an XY Labs tracking event as stored or transmitted. |
44
50
 
45
51
  ## Type Aliases
46
52
 
47
- - [UserEventSystem](#type-aliases/UserEventSystem)
53
+ | Type Alias | Description |
54
+ | ------ | ------ |
55
+ | [UserEventSystem](#type-aliases/UserEventSystem) | Parsed browser/OS/engine information from the user agent string. |
48
56
 
49
57
  ### classes
50
58
 
@@ -54,19 +62,21 @@ Event Client for xylabs ESB
54
62
 
55
63
  ***
56
64
 
65
+ HTTP client for sending tracking events to the XY Labs pixel API.
66
+
57
67
  ## Constructors
58
68
 
59
69
  ### Constructor
60
70
 
61
71
  ```ts
62
- new PixelApi(baseUri?): PixelApi;
72
+ new PixelApi(baseUri?: string): PixelApi;
63
73
  ```
64
74
 
65
75
  ### Parameters
66
76
 
67
- #### baseUri?
68
-
69
- `string` = `'prod'`
77
+ | Parameter | Type | Default value |
78
+ | ------ | ------ | ------ |
79
+ | `baseUri` | `string` | `'prod'` |
70
80
 
71
81
  ### Returns
72
82
 
@@ -77,25 +87,31 @@ new PixelApi(baseUri?): PixelApi;
77
87
  ### trackEvents()
78
88
 
79
89
  ```ts
80
- trackEvents(events): Promise<any>;
90
+ trackEvents(events: UserEvent[]): Promise<any>;
81
91
  ```
82
92
 
83
- ### Parameters
93
+ Sends an array of user events to the tracking API.
84
94
 
85
- #### events
95
+ ### Parameters
86
96
 
87
- [`UserEvent`](#../interfaces/UserEvent)[]
97
+ | Parameter | Type | Description |
98
+ | ------ | ------ | ------ |
99
+ | `events` | [`UserEvent`](#../interfaces/UserEvent)[] | The events to submit |
88
100
 
89
101
  ### Returns
90
102
 
91
103
  `Promise`\<`any`\>
92
104
 
105
+ The response data from the API
106
+
93
107
  ### <a id="Referrer"></a>Referrer
94
108
 
95
109
  [**@xylabs/pixel**](#../README)
96
110
 
97
111
  ***
98
112
 
113
+ Tracks and persists the document referrer in both session and local storage.
114
+
99
115
  ## Constructors
100
116
 
101
117
  ### Constructor
@@ -110,19 +126,10 @@ new Referrer(): Referrer;
110
126
 
111
127
  ## Properties
112
128
 
113
- ### local
114
-
115
- ```ts
116
- local: string;
117
- ```
118
-
119
- ***
120
-
121
- ### session
122
-
123
- ```ts
124
- session: string;
125
- ```
129
+ | Property | Type |
130
+ | ------ | ------ |
131
+ | <a id="local"></a> `local` | `string` |
132
+ | <a id="session"></a> `session` | `string` |
126
133
 
127
134
  ## Methods
128
135
 
@@ -137,6 +144,8 @@ toJson():
137
144
  | undefined;
138
145
  ```
139
146
 
147
+ Returns the referrer data as a JSON object, or undefined if both values are empty.
148
+
140
149
  ### Returns
141
150
 
142
151
  \| \{
@@ -145,12 +154,16 @@ toJson():
145
154
  \}
146
155
  \| `undefined`
147
156
 
157
+ An object with local and session referrer strings, or undefined
158
+
148
159
  ### <a id="UniqueUserId"></a>UniqueUserId
149
160
 
150
161
  [**@xylabs/pixel**](#../README)
151
162
 
152
163
  ***
153
164
 
165
+ Generates and persists a unique user identifier in localStorage.
166
+
154
167
  ## Constructors
155
168
 
156
169
  ### Constructor
@@ -165,11 +178,9 @@ new UniqueUserId(): UniqueUserId;
165
178
 
166
179
  ## Properties
167
180
 
168
- ### id
169
-
170
- ```ts
171
- id: string;
172
- ```
181
+ | Property | Type |
182
+ | ------ | ------ |
183
+ | <a id="id"></a> `id` | `string` |
173
184
 
174
185
  ## Methods
175
186
 
@@ -179,6 +190,8 @@ id: string;
179
190
  toString(): string;
180
191
  ```
181
192
 
193
+ Returns the unique user ID as a string.
194
+
182
195
  ### Returns
183
196
 
184
197
  `string`
@@ -189,15 +202,17 @@ toString(): string;
189
202
 
190
203
  ***
191
204
 
205
+ Abstract base class for handling user tracking events.
206
+
192
207
  ## Extended by
193
208
 
194
209
  - [`XyUserEventHandler`](#XyUserEventHandler)
195
210
 
196
211
  ## Type Parameters
197
212
 
198
- ### TData
199
-
200
- `TData` *extends* `EmptyObject`
213
+ | Type Parameter |
214
+ | ------ |
215
+ | `TData` *extends* `EmptyObject` |
201
216
 
202
217
  ## Constructors
203
218
 
@@ -216,20 +231,22 @@ new UserEventHandler<TData>(): UserEventHandler<TData>;
216
231
  ### funnelStarted()
217
232
 
218
233
  ```ts
219
- abstract funnelStarted<T>(fields): Promisable<void>;
234
+ abstract funnelStarted<T>(fields: FunnelStartedFields | T): Promisable<void>;
220
235
  ```
221
236
 
222
- ### Type Parameters
237
+ Tracks a funnel-started event.
223
238
 
224
- #### T
239
+ ### Type Parameters
225
240
 
226
- `T` *extends* `object`
241
+ | Type Parameter |
242
+ | ------ |
243
+ | `T` *extends* `object` |
227
244
 
228
245
  ### Parameters
229
246
 
230
- #### fields
231
-
232
- [`FunnelStartedFields`](#../interfaces/FunnelStartedFields) | `T`
247
+ | Parameter | Type |
248
+ | ------ | ------ |
249
+ | `fields` | [`FunnelStartedFields`](#../interfaces/FunnelStartedFields) \| `T` |
233
250
 
234
251
  ### Returns
235
252
 
@@ -240,20 +257,22 @@ abstract funnelStarted<T>(fields): Promisable<void>;
240
257
  ### testStarted()
241
258
 
242
259
  ```ts
243
- abstract testStarted<T>(fields): Promisable<void>;
260
+ abstract testStarted<T>(fields: TestStartedFields | T): Promisable<void>;
244
261
  ```
245
262
 
246
- ### Type Parameters
263
+ Tracks a test-started event.
247
264
 
248
- #### T
265
+ ### Type Parameters
249
266
 
250
- `T` *extends* `object`
267
+ | Type Parameter |
268
+ | ------ |
269
+ | `T` *extends* `object` |
251
270
 
252
271
  ### Parameters
253
272
 
254
- #### fields
255
-
256
- [`TestStartedFields`](#../interfaces/TestStartedFields) | `T`
273
+ | Parameter | Type |
274
+ | ------ | ------ |
275
+ | `fields` | [`TestStartedFields`](#../interfaces/TestStartedFields) \| `T` |
257
276
 
258
277
  ### Returns
259
278
 
@@ -264,20 +283,22 @@ abstract testStarted<T>(fields): Promisable<void>;
264
283
  ### userClick()
265
284
 
266
285
  ```ts
267
- abstract userClick<T>(fields): Promisable<void>;
286
+ abstract userClick<T>(fields: UserClickFields | T): Promisable<void>;
268
287
  ```
269
288
 
270
- ### Type Parameters
289
+ Tracks a user click event.
271
290
 
272
- #### T
291
+ ### Type Parameters
273
292
 
274
- `T` *extends* `object`
293
+ | Type Parameter |
294
+ | ------ |
295
+ | `T` *extends* `object` |
275
296
 
276
297
  ### Parameters
277
298
 
278
- #### fields
279
-
280
- [`UserClickFields`](#../interfaces/UserClickFields) | `T`
299
+ | Parameter | Type |
300
+ | ------ | ------ |
301
+ | `fields` | [`UserClickFields`](#../interfaces/UserClickFields) \| `T` |
281
302
 
282
303
  ### Returns
283
304
 
@@ -288,20 +309,22 @@ abstract userClick<T>(fields): Promisable<void>;
288
309
  ### viewContent()
289
310
 
290
311
  ```ts
291
- abstract viewContent<T>(fields): Promisable<void>;
312
+ abstract viewContent<T>(fields: T | ViewContentFields): Promisable<void>;
292
313
  ```
293
314
 
294
- ### Type Parameters
315
+ Tracks a view-content event.
295
316
 
296
- #### T
317
+ ### Type Parameters
297
318
 
298
- `T` *extends* `object`
319
+ | Type Parameter |
320
+ | ------ |
321
+ | `T` *extends* `object` |
299
322
 
300
323
  ### Parameters
301
324
 
302
- #### fields
303
-
304
- `T` | [`ViewContentFields`](#../interfaces/ViewContentFields)
325
+ | Parameter | Type |
326
+ | ------ | ------ |
327
+ | `fields` | `T` \| [`ViewContentFields`](#../interfaces/ViewContentFields) |
305
328
 
306
329
  ### Returns
307
330
 
@@ -313,6 +336,8 @@ abstract viewContent<T>(fields): Promisable<void>;
313
336
 
314
337
  ***
315
338
 
339
+ Tracks UTM campaign parameters from query strings, persisting history in localStorage.
340
+
316
341
  ## Constructors
317
342
 
318
343
  ### Constructor
@@ -327,11 +352,9 @@ new UtmFields(): UtmFields;
327
352
 
328
353
  ## Properties
329
354
 
330
- ### fields
331
-
332
- ```ts
333
- fields: Record<string, string>[] = [];
334
- ```
355
+ | Property | Type | Default value |
356
+ | ------ | ------ | ------ |
357
+ | <a id="fields"></a> `fields` | `Record`\<`string`, `string`\>[] | `[]` |
335
358
 
336
359
  ## Methods
337
360
 
@@ -341,10 +364,14 @@ fields: Record<string, string>[] = [];
341
364
  getUtmRecord(): Record<string, string> | null;
342
365
  ```
343
366
 
367
+ Parses UTM parameters from the current URL query string.
368
+
344
369
  ### Returns
345
370
 
346
371
  `Record`\<`string`, `string`\> \| `null`
347
372
 
373
+ A record of UTM key-value pairs, or null if none are present
374
+
348
375
  ***
349
376
 
350
377
  ### toString()
@@ -353,6 +380,8 @@ getUtmRecord(): Record<string, string> | null;
353
380
  toString(): string;
354
381
  ```
355
382
 
383
+ Returns the UTM fields history as a JSON string.
384
+
356
385
  ### Returns
357
386
 
358
387
  `string`
@@ -365,71 +394,33 @@ toString(): string;
365
394
  update(): Record<string, string>[];
366
395
  ```
367
396
 
397
+ Checks the query string for new UTM values and appends them to the history if changed.
398
+
368
399
  ### Returns
369
400
 
370
401
  `Record`\<`string`, `string`\>[]
371
402
 
403
+ The current UTM fields array, or undefined if empty
404
+
372
405
  ### <a id="XyPixel"></a>XyPixel
373
406
 
374
407
  [**@xylabs/pixel**](#../README)
375
408
 
376
409
  ***
377
410
 
378
- ## Properties
379
-
380
- ### api
381
-
382
- ```ts
383
- static api: PixelApi;
384
- ```
385
-
386
- ***
387
-
388
- ### cid
389
-
390
- ```ts
391
- cid: string;
392
- ```
393
-
394
- ***
395
-
396
- ### email?
411
+ Singleton pixel tracker that queues and sends user events to the XY Labs tracking API.
397
412
 
398
- ```ts
399
- optional email: string;
400
- ```
401
-
402
- ***
403
-
404
- ### email\_hash?
405
-
406
- ```ts
407
- optional email_hash: string | null;
408
- ```
409
-
410
- ***
411
-
412
- ### exids?
413
-
414
- ```ts
415
- optional exids: ExIds;
416
- ```
417
-
418
- ***
419
-
420
- ### pixelId?
421
-
422
- ```ts
423
- optional pixelId: string;
424
- ```
425
-
426
- ***
413
+ ## Properties
427
414
 
428
- ### queue
429
-
430
- ```ts
431
- queue: UserEvent[] = [];
432
- ```
415
+ | Property | Modifier | Type | Default value |
416
+ | ------ | ------ | ------ | ------ |
417
+ | <a id="api"></a> `api` | `static` | [`PixelApi`](#PixelApi) | `undefined` |
418
+ | <a id="cid"></a> `cid` | `public` | `string` | `undefined` |
419
+ | <a id="email"></a> `email?` | `public` | `string` | `undefined` |
420
+ | <a id="email_hash"></a> `email_hash?` | `public` | `string` \| `null` | `undefined` |
421
+ | <a id="exids"></a> `exids?` | `public` | `ExIds` | `undefined` |
422
+ | <a id="pixelid"></a> `pixelId?` | `public` | `string` | `undefined` |
423
+ | <a id="queue"></a> `queue` | `public` | [`UserEvent`](#../interfaces/UserEvent)[] | `[]` |
433
424
 
434
425
  ## Accessors
435
426
 
@@ -441,6 +432,8 @@ queue: UserEvent[] = [];
441
432
  get static instance(): XyPixel;
442
433
  ```
443
434
 
435
+ Returns the singleton XyPixel instance, throwing if not yet initialized.
436
+
444
437
  #### Returns
445
438
 
446
439
  `XyPixel`
@@ -450,32 +443,38 @@ get static instance(): XyPixel;
450
443
  ### init()
451
444
 
452
445
  ```ts
453
- static init(pixelId): XyPixel;
446
+ static init(pixelId: string): XyPixel;
454
447
  ```
455
448
 
456
- ### Parameters
449
+ Initializes the XyPixel singleton with the given pixel ID.
457
450
 
458
- #### pixelId
451
+ ### Parameters
459
452
 
460
- `string`
453
+ | Parameter | Type | Description |
454
+ | ------ | ------ | ------ |
455
+ | `pixelId` | `string` | The pixel identifier for this tracking instance |
461
456
 
462
457
  ### Returns
463
458
 
464
459
  `XyPixel`
465
460
 
461
+ The newly created XyPixel instance
462
+
466
463
  ***
467
464
 
468
465
  ### selectApi()
469
466
 
470
467
  ```ts
471
- static selectApi(api): void;
468
+ static selectApi(api: PixelApi): void;
472
469
  ```
473
470
 
474
- ### Parameters
471
+ Replaces the default PixelApi instance used for sending events.
475
472
 
476
- #### api
473
+ ### Parameters
477
474
 
478
- [`PixelApi`](#PixelApi)
475
+ | Parameter | Type | Description |
476
+ | ------ | ------ | ------ |
477
+ | `api` | [`PixelApi`](#PixelApi) | The PixelApi instance to use |
479
478
 
480
479
  ### Returns
481
480
 
@@ -486,14 +485,16 @@ static selectApi(api): void;
486
485
  ### identify()
487
486
 
488
487
  ```ts
489
- identify(email?): void;
488
+ identify(email?: string): void;
490
489
  ```
491
490
 
492
- ### Parameters
491
+ Associates an email address with this pixel instance, hashing it for privacy.
493
492
 
494
- #### email?
493
+ ### Parameters
495
494
 
496
- `string`
495
+ | Parameter | Type | Description |
496
+ | ------ | ------ | ------ |
497
+ | `email?` | `string` | The email address to identify the user with |
497
498
 
498
499
  ### Returns
499
500
 
@@ -505,30 +506,26 @@ identify(email?): void;
505
506
 
506
507
  ```ts
507
508
  send<T>(
508
- event,
509
- fields?,
510
- eventId?): Promise<void>;
509
+ event: string,
510
+ fields?: T,
511
+ eventId?: string): Promise<void>;
511
512
  ```
512
513
 
513
- ### Type Parameters
514
+ Queues a tracking event and attempts to flush the queue to the API.
514
515
 
515
- #### T
516
+ ### Type Parameters
516
517
 
517
- `T` *extends* `Record`\<`string`, `unknown`\>
518
+ | Type Parameter |
519
+ | ------ |
520
+ | `T` *extends* `Record`\<`string`, `unknown`\> |
518
521
 
519
522
  ### Parameters
520
523
 
521
- #### event
522
-
523
- `string`
524
-
525
- #### fields?
526
-
527
- `T`
528
-
529
- #### eventId?
530
-
531
- `string`
524
+ | Parameter | Type | Description |
525
+ | ------ | ------ | ------ |
526
+ | `event` | `string` | The event name |
527
+ | `fields?` | `T` | Optional event-specific fields |
528
+ | `eventId?` | `string` | Optional unique event identifier |
532
529
 
533
530
  ### Returns
534
531
 
@@ -540,15 +537,17 @@ eventId?): Promise<void>;
540
537
 
541
538
  ***
542
539
 
540
+ Concrete event handler that sends tracking events through the XyPixel singleton.
541
+
543
542
  ## Extends
544
543
 
545
544
  - [`UserEventHandler`](#UserEventHandler)\<`T`\>
546
545
 
547
546
  ## Type Parameters
548
547
 
549
- ### T
550
-
551
- `T` *extends* `EmptyObject` = `EmptyObject`
548
+ | Type Parameter | Default type |
549
+ | ------ | ------ |
550
+ | `T` *extends* `EmptyObject` | `EmptyObject` |
552
551
 
553
552
  ## Constructors
554
553
 
@@ -571,14 +570,16 @@ new XyUserEventHandler<T>(): XyUserEventHandler<T>;
571
570
  ### funnelStarted()
572
571
 
573
572
  ```ts
574
- funnelStarted(fields): Promise<void>;
573
+ funnelStarted(fields: FunnelStartedFields | T): Promise<void>;
575
574
  ```
576
575
 
577
- ### Parameters
576
+ Sends a funnel-started event via the pixel API.
578
577
 
579
- #### fields
578
+ ### Parameters
580
579
 
581
- [`FunnelStartedFields`](#../interfaces/FunnelStartedFields) | `T`
580
+ | Parameter | Type |
581
+ | ------ | ------ |
582
+ | `fields` | [`FunnelStartedFields`](#../interfaces/FunnelStartedFields) \| `T` |
582
583
 
583
584
  ### Returns
584
585
 
@@ -593,14 +594,16 @@ funnelStarted(fields): Promise<void>;
593
594
  ### purchase()
594
595
 
595
596
  ```ts
596
- purchase(fields): Promise<void>;
597
+ purchase(fields: PurchaseFields | T): Promise<void>;
597
598
  ```
598
599
 
599
- ### Parameters
600
+ Sends a purchase event via the pixel API.
600
601
 
601
- #### fields
602
+ ### Parameters
602
603
 
603
- [`PurchaseFields`](#../interfaces/PurchaseFields) | `T`
604
+ | Parameter | Type |
605
+ | ------ | ------ |
606
+ | `fields` | [`PurchaseFields`](#../interfaces/PurchaseFields) \| `T` |
604
607
 
605
608
  ### Returns
606
609
 
@@ -611,14 +614,16 @@ purchase(fields): Promise<void>;
611
614
  ### testStarted()
612
615
 
613
616
  ```ts
614
- testStarted(fields): Promise<void>;
617
+ testStarted(fields: TestStartedFields | T): Promise<void>;
615
618
  ```
616
619
 
617
- ### Parameters
620
+ Sends a test-started event via the pixel API.
618
621
 
619
- #### fields
622
+ ### Parameters
620
623
 
621
- [`TestStartedFields`](#../interfaces/TestStartedFields) | `T`
624
+ | Parameter | Type |
625
+ | ------ | ------ |
626
+ | `fields` | [`TestStartedFields`](#../interfaces/TestStartedFields) \| `T` |
622
627
 
623
628
  ### Returns
624
629
 
@@ -633,14 +638,16 @@ testStarted(fields): Promise<void>;
633
638
  ### userClick()
634
639
 
635
640
  ```ts
636
- userClick(fields): Promise<void>;
641
+ userClick(fields: UserClickFields | T): Promise<void>;
637
642
  ```
638
643
 
639
- ### Parameters
644
+ Sends a user click event via the pixel API.
640
645
 
641
- #### fields
646
+ ### Parameters
642
647
 
643
- [`UserClickFields`](#../interfaces/UserClickFields) | `T`
648
+ | Parameter | Type |
649
+ | ------ | ------ |
650
+ | `fields` | [`UserClickFields`](#../interfaces/UserClickFields) \| `T` |
644
651
 
645
652
  ### Returns
646
653
 
@@ -655,14 +662,16 @@ userClick(fields): Promise<void>;
655
662
  ### viewContent()
656
663
 
657
664
  ```ts
658
- viewContent(fields): Promise<void>;
665
+ viewContent(fields: ViewContentFields | T): Promise<void>;
659
666
  ```
660
667
 
661
- ### Parameters
668
+ Sends a view-content event via the pixel API.
662
669
 
663
- #### fields
670
+ ### Parameters
664
671
 
665
- [`ViewContentFields`](#../interfaces/ViewContentFields) | `T`
672
+ | Parameter | Type |
673
+ | ------ | ------ |
674
+ | `fields` | [`ViewContentFields`](#../interfaces/ViewContentFields) \| `T` |
666
675
 
667
676
  ### Returns
668
677
 
@@ -680,6 +689,8 @@ viewContent(fields): Promise<void>;
680
689
 
681
690
  ***
682
691
 
692
+ Common fields shared across all tracking event types.
693
+
683
694
  ## Extended by
684
695
 
685
696
  - [`FunnelStartedFields`](#FunnelStartedFields)
@@ -690,19 +701,10 @@ viewContent(fields): Promise<void>;
690
701
 
691
702
  ## Properties
692
703
 
693
- ### funnel?
694
-
695
- ```ts
696
- optional funnel: string;
697
- ```
698
-
699
- ***
700
-
701
- ### testData?
702
-
703
- ```ts
704
- optional testData: string;
705
- ```
704
+ | Property | Type |
705
+ | ------ | ------ |
706
+ | <a id="funnel"></a> `funnel?` | `string` |
707
+ | <a id="testdata"></a> `testData?` | `string` |
706
708
 
707
709
  ### <a id="FunnelStartedFields"></a>FunnelStartedFields
708
710
 
@@ -710,41 +712,19 @@ optional testData: string;
710
712
 
711
713
  ***
712
714
 
715
+ Fields for a funnel-started tracking event.
716
+
713
717
  ## Extends
714
718
 
715
719
  - [`CommonFields`](#CommonFields)
716
720
 
717
721
  ## Properties
718
722
 
719
- ### funnel?
720
-
721
- ```ts
722
- optional funnel: string;
723
- ```
724
-
725
- ### Inherited from
726
-
727
- [`CommonFields`](#CommonFields).[`funnel`](CommonFields.md#funnel)
728
-
729
- ***
730
-
731
- ### testData?
732
-
733
- ```ts
734
- optional testData: string;
735
- ```
736
-
737
- ### Inherited from
738
-
739
- [`CommonFields`](#CommonFields).[`testData`](CommonFields.md#testdata)
740
-
741
- ***
742
-
743
- ### name
744
-
745
- ```ts
746
- name: string;
747
- ```
723
+ | Property | Type | Inherited from |
724
+ | ------ | ------ | ------ |
725
+ | <a id="funnel"></a> `funnel?` | `string` | [`CommonFields`](#CommonFields).[`funnel`](CommonFields.md#funnel) |
726
+ | <a id="testdata"></a> `testData?` | `string` | [`CommonFields`](#CommonFields).[`testData`](CommonFields.md#testdata) |
727
+ | <a id="name"></a> `name` | `string` | - |
748
728
 
749
729
  ### <a id="PurchaseFields"></a>PurchaseFields
750
730
 
@@ -752,65 +732,22 @@ name: string;
752
732
 
753
733
  ***
754
734
 
735
+ Fields for a purchase tracking event.
736
+
755
737
  ## Extends
756
738
 
757
739
  - [`CommonFields`](#CommonFields)
758
740
 
759
741
  ## Properties
760
742
 
761
- ### funnel?
762
-
763
- ```ts
764
- optional funnel: string;
765
- ```
766
-
767
- ### Inherited from
768
-
769
- [`CommonFields`](#CommonFields).[`funnel`](CommonFields.md#funnel)
770
-
771
- ***
772
-
773
- ### testData?
774
-
775
- ```ts
776
- optional testData: string;
777
- ```
778
-
779
- ### Inherited from
780
-
781
- [`CommonFields`](#CommonFields).[`testData`](CommonFields.md#testdata)
782
-
783
- ***
784
-
785
- ### id
786
-
787
- ```ts
788
- id: string;
789
- ```
790
-
791
- ***
792
-
793
- ### name?
794
-
795
- ```ts
796
- optional name: string;
797
- ```
798
-
799
- ***
800
-
801
- ### price?
802
-
803
- ```ts
804
- optional price: number;
805
- ```
806
-
807
- ***
808
-
809
- ### value?
810
-
811
- ```ts
812
- optional value: number;
813
- ```
743
+ | Property | Type | Inherited from |
744
+ | ------ | ------ | ------ |
745
+ | <a id="funnel"></a> `funnel?` | `string` | [`CommonFields`](#CommonFields).[`funnel`](CommonFields.md#funnel) |
746
+ | <a id="testdata"></a> `testData?` | `string` | [`CommonFields`](#CommonFields).[`testData`](CommonFields.md#testdata) |
747
+ | <a id="id"></a> `id` | `string` | - |
748
+ | <a id="name"></a> `name?` | `string` | - |
749
+ | <a id="price"></a> `price?` | `number` | - |
750
+ | <a id="value"></a> `value?` | `number` | - |
814
751
 
815
752
  ### <a id="TestStartedFields"></a>TestStartedFields
816
753
 
@@ -818,41 +755,19 @@ optional value: number;
818
755
 
819
756
  ***
820
757
 
758
+ Fields for a test-started tracking event (e.g. A/B test).
759
+
821
760
  ## Extends
822
761
 
823
762
  - [`CommonFields`](#CommonFields)
824
763
 
825
764
  ## Properties
826
765
 
827
- ### funnel?
828
-
829
- ```ts
830
- optional funnel: string;
831
- ```
832
-
833
- ### Inherited from
834
-
835
- [`CommonFields`](#CommonFields).[`funnel`](CommonFields.md#funnel)
836
-
837
- ***
838
-
839
- ### testData?
840
-
841
- ```ts
842
- optional testData: string;
843
- ```
844
-
845
- ### Inherited from
846
-
847
- [`CommonFields`](#CommonFields).[`testData`](CommonFields.md#testdata)
848
-
849
- ***
850
-
851
- ### name
852
-
853
- ```ts
854
- name: string;
855
- ```
766
+ | Property | Type | Inherited from |
767
+ | ------ | ------ | ------ |
768
+ | <a id="funnel"></a> `funnel?` | `string` | [`CommonFields`](#CommonFields).[`funnel`](CommonFields.md#funnel) |
769
+ | <a id="testdata"></a> `testData?` | `string` | [`CommonFields`](#CommonFields).[`testData`](CommonFields.md#testdata) |
770
+ | <a id="name"></a> `name` | `string` | - |
856
771
 
857
772
  ### <a id="UserClickFields"></a>UserClickFields
858
773
 
@@ -860,65 +775,22 @@ name: string;
860
775
 
861
776
  ***
862
777
 
778
+ Fields for a user click tracking event.
779
+
863
780
  ## Extends
864
781
 
865
782
  - [`CommonFields`](#CommonFields)
866
783
 
867
784
  ## Properties
868
785
 
869
- ### funnel?
870
-
871
- ```ts
872
- optional funnel: string;
873
- ```
874
-
875
- ### Inherited from
876
-
877
- [`CommonFields`](#CommonFields).[`funnel`](CommonFields.md#funnel)
878
-
879
- ***
880
-
881
- ### testData?
882
-
883
- ```ts
884
- optional testData: string;
885
- ```
886
-
887
- ### Inherited from
888
-
889
- [`CommonFields`](#CommonFields).[`testData`](CommonFields.md#testdata)
890
-
891
- ***
892
-
893
- ### elementName
894
-
895
- ```ts
896
- elementName: string;
897
- ```
898
-
899
- ***
900
-
901
- ### elementType
902
-
903
- ```ts
904
- elementType: string;
905
- ```
906
-
907
- ***
908
-
909
- ### intent?
910
-
911
- ```ts
912
- optional intent: string;
913
- ```
914
-
915
- ***
916
-
917
- ### placement?
918
-
919
- ```ts
920
- optional placement: string;
921
- ```
786
+ | Property | Type | Inherited from |
787
+ | ------ | ------ | ------ |
788
+ | <a id="funnel"></a> `funnel?` | `string` | [`CommonFields`](#CommonFields).[`funnel`](CommonFields.md#funnel) |
789
+ | <a id="testdata"></a> `testData?` | `string` | [`CommonFields`](#CommonFields).[`testData`](CommonFields.md#testdata) |
790
+ | <a id="elementname"></a> `elementName` | `string` | - |
791
+ | <a id="elementtype"></a> `elementType` | `string` | - |
792
+ | <a id="intent"></a> `intent?` | `string` | - |
793
+ | <a id="placement"></a> `placement?` | `string` | - |
922
794
 
923
795
  ### <a id="UserEvent"></a>UserEvent
924
796
 
@@ -926,153 +798,31 @@ optional placement: string;
926
798
 
927
799
  ***
928
800
 
929
- ## Properties
930
-
931
- ### cid
932
-
933
- ```ts
934
- cid: string;
935
- ```
936
-
937
- ***
938
-
939
- ### create\_time?
940
-
941
- ```ts
942
- optional create_time: number;
943
- ```
944
-
945
- ***
946
-
947
- ### email?
801
+ Represents a single user tracking event to be sent to the pixel API.
948
802
 
949
- ```ts
950
- optional email: string;
951
- ```
952
-
953
- ***
954
-
955
- ### email\_hash?
956
-
957
- ```ts
958
- optional email_hash: string;
959
- ```
960
-
961
- ***
962
-
963
- ### event?
964
-
965
- ```ts
966
- optional event: string;
967
- ```
968
-
969
- ***
970
-
971
- ### event\_id?
972
-
973
- ```ts
974
- optional event_id: string;
975
- ```
976
-
977
- ***
978
-
979
- ### exids?
980
-
981
- ```ts
982
- optional exids: ExIds;
983
- ```
984
-
985
- ***
986
-
987
- ### fields?
988
-
989
- ```ts
990
- optional fields: Record<string, unknown>;
991
- ```
992
-
993
- ***
994
-
995
- ### host?
996
-
997
- ```ts
998
- optional host: string;
999
- ```
1000
-
1001
- ***
1002
-
1003
- ### pathname?
1004
-
1005
- ```ts
1006
- optional pathname: string;
1007
- ```
1008
-
1009
- ***
1010
-
1011
- ### pixel?
1012
-
1013
- ```ts
1014
- optional pixel: string;
1015
- ```
1016
-
1017
- ***
1018
-
1019
- ### receive\_time?
1020
-
1021
- ```ts
1022
- optional receive_time: number;
1023
- ```
1024
-
1025
- ***
1026
-
1027
- ### referrer?
1028
-
1029
- ```ts
1030
- optional referrer: object;
1031
- ```
1032
-
1033
- ### local
1034
-
1035
- ```ts
1036
- local: string;
1037
- ```
1038
-
1039
- ### session
1040
-
1041
- ```ts
1042
- session: string;
1043
- ```
1044
-
1045
- ***
1046
-
1047
- ### rid?
1048
-
1049
- ```ts
1050
- optional rid: string;
1051
- ```
1052
-
1053
- ***
1054
-
1055
- ### system?
1056
-
1057
- ```ts
1058
- optional system: ParsedResult;
1059
- ```
1060
-
1061
- ***
1062
-
1063
- ### uid?
1064
-
1065
- ```ts
1066
- optional uid: string;
1067
- ```
1068
-
1069
- ***
1070
-
1071
- ### utm?
803
+ ## Properties
1072
804
 
1073
- ```ts
1074
- optional utm: Record<string, string>[] | Record<string, string[]>;
1075
- ```
805
+ | Property | Type |
806
+ | ------ | ------ |
807
+ | <a id="cid"></a> `cid` | `string` |
808
+ | <a id="create_time"></a> `create_time?` | `number` |
809
+ | <a id="email"></a> `email?` | `string` |
810
+ | <a id="email_hash"></a> `email_hash?` | `string` |
811
+ | <a id="event"></a> `event?` | `string` |
812
+ | <a id="event_id"></a> `event_id?` | `string` |
813
+ | <a id="exids"></a> `exids?` | `ExIds` |
814
+ | <a id="fields"></a> `fields?` | `Record`\<`string`, `unknown`\> |
815
+ | <a id="host"></a> `host?` | `string` |
816
+ | <a id="pathname"></a> `pathname?` | `string` |
817
+ | <a id="pixel"></a> `pixel?` | `string` |
818
+ | <a id="receive_time"></a> `receive_time?` | `number` |
819
+ | <a id="referrer"></a> `referrer?` | \{ `local`: `string`; `session`: `string`; \} |
820
+ | `referrer.local` | `string` |
821
+ | `referrer.session` | `string` |
822
+ | <a id="rid"></a> `rid?` | `string` |
823
+ | <a id="system"></a> `system?` | `ParsedResult` |
824
+ | <a id="uid"></a> `uid?` | `string` |
825
+ | <a id="utm"></a> `utm?` | `Record`\<`string`, `string`\>[] \| `Record`\<`string`, `string`[]\> |
1076
826
 
1077
827
  ### <a id="ViewContentFields"></a>ViewContentFields
1078
828
 
@@ -1080,49 +830,20 @@ optional utm: Record<string, string>[] | Record<string, string[]>;
1080
830
 
1081
831
  ***
1082
832
 
833
+ Fields for a view-content tracking event.
834
+
1083
835
  ## Extends
1084
836
 
1085
837
  - [`CommonFields`](#CommonFields)
1086
838
 
1087
839
  ## Properties
1088
840
 
1089
- ### funnel?
1090
-
1091
- ```ts
1092
- optional funnel: string;
1093
- ```
1094
-
1095
- ### Inherited from
1096
-
1097
- [`CommonFields`](#CommonFields).[`funnel`](CommonFields.md#funnel)
1098
-
1099
- ***
1100
-
1101
- ### testData?
1102
-
1103
- ```ts
1104
- optional testData: string;
1105
- ```
1106
-
1107
- ### Inherited from
1108
-
1109
- [`CommonFields`](#CommonFields).[`testData`](CommonFields.md#testdata)
1110
-
1111
- ***
1112
-
1113
- ### name
1114
-
1115
- ```ts
1116
- name: string;
1117
- ```
1118
-
1119
- ***
1120
-
1121
- ### path
1122
-
1123
- ```ts
1124
- path: string;
1125
- ```
841
+ | Property | Type | Inherited from |
842
+ | ------ | ------ | ------ |
843
+ | <a id="funnel"></a> `funnel?` | `string` | [`CommonFields`](#CommonFields).[`funnel`](CommonFields.md#funnel) |
844
+ | <a id="testdata"></a> `testData?` | `string` | [`CommonFields`](#CommonFields).[`testData`](CommonFields.md#testdata) |
845
+ | <a id="name"></a> `name` | `string` | - |
846
+ | <a id="path"></a> `path` | `string` | - |
1126
847
 
1127
848
  ### <a id="XyLabsTrackingEventJson"></a>XyLabsTrackingEventJson
1128
849
 
@@ -1130,149 +851,30 @@ path: string;
1130
851
 
1131
852
  ***
1132
853
 
1133
- ## Properties
1134
-
1135
- ### cid
1136
-
1137
- ```ts
1138
- cid: string;
1139
- ```
1140
-
1141
- ***
1142
-
1143
- ### create\_time?
1144
-
1145
- ```ts
1146
- optional create_time: number;
1147
- ```
1148
-
1149
- ***
1150
-
1151
- ### email?
1152
-
1153
- ```ts
1154
- optional email: string;
1155
- ```
1156
-
1157
- ***
1158
-
1159
- ### email\_hash?
1160
-
1161
- ```ts
1162
- optional email_hash: string;
1163
- ```
1164
-
1165
- ***
1166
-
1167
- ### event?
1168
-
1169
- ```ts
1170
- optional event: string;
1171
- ```
1172
-
1173
- ***
1174
-
1175
- ### event\_id?
1176
-
1177
- ```ts
1178
- optional event_id: string;
1179
- ```
1180
-
1181
- ***
1182
-
1183
- ### exids?
1184
-
1185
- ```ts
1186
- optional exids: Record<string, string>;
1187
- ```
1188
-
1189
- ***
1190
-
1191
- ### fields?
1192
-
1193
- ```ts
1194
- optional fields: Record<string, unknown>;
1195
- ```
854
+ JSON structure for an XY Labs tracking event as stored or transmitted.
1196
855
 
1197
- ***
1198
-
1199
- ### host?
1200
-
1201
- ```ts
1202
- optional host: string;
1203
- ```
1204
-
1205
- ***
1206
-
1207
- ### ip?
1208
-
1209
- ```ts
1210
- optional ip: string;
1211
- ```
1212
-
1213
- ***
1214
-
1215
- ### pathname?
1216
-
1217
- ```ts
1218
- optional pathname: string;
1219
- ```
1220
-
1221
- ***
1222
-
1223
- ### pixel?
1224
-
1225
- ```ts
1226
- optional pixel: string;
1227
- ```
1228
-
1229
- ***
1230
-
1231
- ### receive\_time?
1232
-
1233
- ```ts
1234
- optional receive_time: number;
1235
- ```
1236
-
1237
- ***
1238
-
1239
- ### rid?
1240
-
1241
- ```ts
1242
- optional rid: string;
1243
- ```
1244
-
1245
- ***
1246
-
1247
- ### system?
1248
-
1249
- ```ts
1250
- optional system: unknown;
1251
- ```
1252
-
1253
- ***
1254
-
1255
- ### ua?
1256
-
1257
- ```ts
1258
- optional ua: string;
1259
- ```
1260
-
1261
- ***
1262
-
1263
- ### uid?
1264
-
1265
- ```ts
1266
- optional uid: string;
1267
- ```
1268
-
1269
- ***
856
+ ## Properties
1270
857
 
1271
- ### utm?
1272
-
1273
- ```ts
1274
- optional utm: Record<string, string>[] | Record<string, string[]>;
1275
- ```
858
+ | Property | Type |
859
+ | ------ | ------ |
860
+ | <a id="cid"></a> `cid` | `string` |
861
+ | <a id="create_time"></a> `create_time?` | `number` |
862
+ | <a id="email"></a> `email?` | `string` |
863
+ | <a id="email_hash"></a> `email_hash?` | `string` |
864
+ | <a id="event"></a> `event?` | `string` |
865
+ | <a id="event_id"></a> `event_id?` | `string` |
866
+ | <a id="exids"></a> `exids?` | `Record`\<`string`, `string`\> |
867
+ | <a id="fields"></a> `fields?` | `Record`\<`string`, `unknown`\> |
868
+ | <a id="host"></a> `host?` | `string` |
869
+ | <a id="ip"></a> `ip?` | `string` |
870
+ | <a id="pathname"></a> `pathname?` | `string` |
871
+ | <a id="pixel"></a> `pixel?` | `string` |
872
+ | <a id="receive_time"></a> `receive_time?` | `number` |
873
+ | <a id="rid"></a> `rid?` | `string` |
874
+ | <a id="system"></a> `system?` | `unknown` |
875
+ | <a id="ua"></a> `ua?` | `string` |
876
+ | <a id="uid"></a> `uid?` | `string` |
877
+ | <a id="utm"></a> `utm?` | `Record`\<`string`, `string`\>[] \| `Record`\<`string`, `string`[]\> |
1276
878
 
1277
879
  ### type-aliases
1278
880
 
@@ -1286,6 +888,8 @@ optional utm: Record<string, string>[] | Record<string, string[]>;
1286
888
  type UserEventSystem = Bowser.Parser.ParsedResult;
1287
889
  ```
1288
890
 
891
+ Parsed browser/OS/engine information from the user agent string.
892
+
1289
893
 
1290
894
  Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
1291
895