@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.
- package/README.md +287 -683
- package/dist/browser/Api/Api.d.ts +6 -0
- package/dist/browser/Api/Api.d.ts.map +1 -1
- package/dist/browser/Api/UserEvent.d.ts +1 -0
- package/dist/browser/Api/UserEvent.d.ts.map +1 -1
- package/dist/browser/Api/UserEventSystem.d.ts +1 -0
- package/dist/browser/Api/UserEventSystem.d.ts.map +1 -1
- package/dist/browser/CommonFields.d.ts +1 -0
- package/dist/browser/CommonFields.d.ts.map +1 -1
- package/dist/browser/ExIds.d.ts +1 -0
- package/dist/browser/ExIds.d.ts.map +1 -1
- package/dist/browser/FunnelStartedFields.d.ts +1 -0
- package/dist/browser/FunnelStartedFields.d.ts.map +1 -1
- package/dist/browser/Pixel.d.ts +21 -0
- package/dist/browser/Pixel.d.ts.map +1 -1
- package/dist/browser/PurchaseFields.d.ts +1 -0
- package/dist/browser/PurchaseFields.d.ts.map +1 -1
- package/dist/browser/Referrer.d.ts +5 -0
- package/dist/browser/Referrer.d.ts.map +1 -1
- package/dist/browser/TestStartedFields.d.ts +1 -0
- package/dist/browser/TestStartedFields.d.ts.map +1 -1
- package/dist/browser/UniqueUserId.d.ts +2 -0
- package/dist/browser/UniqueUserId.d.ts.map +1 -1
- package/dist/browser/UserClickFields.d.ts +1 -0
- package/dist/browser/UserClickFields.d.ts.map +1 -1
- package/dist/browser/UserEventHandler.d.ts +5 -0
- package/dist/browser/UserEventHandler.d.ts.map +1 -1
- package/dist/browser/UtmFields.d.ts +10 -0
- package/dist/browser/UtmFields.d.ts.map +1 -1
- package/dist/browser/ViewContentFields.d.ts +1 -0
- package/dist/browser/ViewContentFields.d.ts.map +1 -1
- package/dist/browser/XyLabsTrackingEventJson.d.ts +1 -0
- package/dist/browser/XyLabsTrackingEventJson.d.ts.map +1 -1
- package/dist/browser/XyUserEventHandler.d.ts +6 -0
- package/dist/browser/XyUserEventHandler.d.ts.map +1 -1
- package/dist/browser/getSystemInfo.d.ts +5 -0
- package/dist/browser/getSystemInfo.d.ts.map +1 -1
- package/dist/browser/index.mjs +44 -0
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +8 -8
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { UserEvent } from './UserEvent.ts';
|
|
2
|
+
/** HTTP client for sending tracking events to the XY Labs pixel API. */
|
|
2
3
|
export declare class PixelApi {
|
|
3
4
|
private endPoint;
|
|
4
5
|
constructor(baseUri?: string);
|
|
6
|
+
/**
|
|
7
|
+
* Sends an array of user events to the tracking API.
|
|
8
|
+
* @param events - The events to submit
|
|
9
|
+
* @returns The response data from the API
|
|
10
|
+
*/
|
|
5
11
|
trackEvents(events: UserEvent[]): Promise<any>;
|
|
6
12
|
}
|
|
7
13
|
//# sourceMappingURL=Api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../../src/Api/Api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAQ/C,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAQ;gBAGZ,OAAO,SAAS;
|
|
1
|
+
{"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../../src/Api/Api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAQ/C,wEAAwE;AACxE,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAQ;gBAGZ,OAAO,SAAS;IAI5B;;;;OAIG;IACG,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE;CAGtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserEvent.d.ts","sourceRoot":"","sources":["../../../src/Api/UserEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,M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,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,eAAe,CAAA;IACxB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;CAC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserEventSystem.d.ts","sourceRoot":"","sources":["../../../src/Api/UserEventSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"UserEventSystem.d.ts","sourceRoot":"","sources":["../../../src/Api/UserEventSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAEhC,uEAAuE;AACvE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonFields.d.ts","sourceRoot":"","sources":["../../src/CommonFields.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
|
|
1
|
+
{"version":3,"file":"CommonFields.d.ts","sourceRoot":"","sources":["../../src/CommonFields.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
|
package/dist/browser/ExIds.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExIds.d.ts","sourceRoot":"","sources":["../../src/ExIds.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB"}
|
|
1
|
+
{"version":3,"file":"ExIds.d.ts","sourceRoot":"","sources":["../../src/ExIds.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,MAAM,WAAW,KAAK;IACpB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunnelStartedFields.d.ts","sourceRoot":"","sources":["../../src/FunnelStartedFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACvD,IAAI,EAAE,MAAM,CAAA;CACb"}
|
|
1
|
+
{"version":3,"file":"FunnelStartedFields.d.ts","sourceRoot":"","sources":["../../src/FunnelStartedFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,kDAAkD;AAClD,MAAM,WAAW,mBAAoB,SAAQ,YAAY;IACvD,IAAI,EAAE,MAAM,CAAA;CACb"}
|
package/dist/browser/Pixel.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { JsonObject } from '@xylabs/object';
|
|
|
2
2
|
import type { UserEvent } from './Api/index.ts';
|
|
3
3
|
import { PixelApi } from './Api/index.ts';
|
|
4
4
|
import type { ExIds } from './ExIds.ts';
|
|
5
|
+
/** Singleton pixel tracker that queues and sends user events to the XY Labs tracking API. */
|
|
5
6
|
export declare class XyPixel {
|
|
6
7
|
static api: PixelApi;
|
|
7
8
|
private static _instance?;
|
|
@@ -14,11 +15,31 @@ export declare class XyPixel {
|
|
|
14
15
|
queue: UserEvent[];
|
|
15
16
|
private queueMutex;
|
|
16
17
|
private constructor();
|
|
18
|
+
/** Returns the singleton XyPixel instance, throwing if not yet initialized. */
|
|
17
19
|
static get instance(): XyPixel;
|
|
20
|
+
/**
|
|
21
|
+
* Initializes the XyPixel singleton with the given pixel ID.
|
|
22
|
+
* @param pixelId - The pixel identifier for this tracking instance
|
|
23
|
+
* @returns The newly created XyPixel instance
|
|
24
|
+
*/
|
|
18
25
|
static init(pixelId: string): XyPixel;
|
|
26
|
+
/**
|
|
27
|
+
* Replaces the default PixelApi instance used for sending events.
|
|
28
|
+
* @param api - The PixelApi instance to use
|
|
29
|
+
*/
|
|
19
30
|
static selectApi(api: PixelApi): void;
|
|
20
31
|
private static utmFields;
|
|
32
|
+
/**
|
|
33
|
+
* Associates an email address with this pixel instance, hashing it for privacy.
|
|
34
|
+
* @param email - The email address to identify the user with
|
|
35
|
+
*/
|
|
21
36
|
identify(email?: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Queues a tracking event and attempts to flush the queue to the API.
|
|
39
|
+
* @param event - The event name
|
|
40
|
+
* @param fields - Optional event-specific fields
|
|
41
|
+
* @param eventId - Optional unique event identifier
|
|
42
|
+
*/
|
|
22
43
|
send<T extends JsonObject>(event: string, fields?: T, eventId?: string): Promise<void>;
|
|
23
44
|
private tryFlushQueue;
|
|
24
45
|
private updateFbId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pixel.d.ts","sourceRoot":"","sources":["../../src/Pixel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAKhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAQvC,qBAAa,OAAO;IAClB,MAAM,CAAC,GAAG,WAAiB;IAE3B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAS;IAClC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAW;IAEtC,GAAG,SAAwB;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,KAAK,EAAE,SAAS,EAAE,CAAK;IAEvB,OAAO,CAAC,UAAU,CAAc;IAEhC,OAAO;IAKP,MAAM,KAAK,QAAQ,IAAI,OAAO,CAE7B;IAED,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM;IAK3B,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,QAAQ;IAI9B,OAAO,CAAC,MAAM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,CAAC,UAAU;CAWnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PurchaseFields.d.ts","sourceRoot":"","sources":["../../src/PurchaseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
|
|
1
|
+
{"version":3,"file":"PurchaseFields.d.ts","sourceRoot":"","sources":["../../src/PurchaseFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,4CAA4C;AAC5C,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
/** Tracks and persists the document referrer in both session and local storage. */
|
|
1
2
|
export declare class Referrer {
|
|
2
3
|
private static storageId;
|
|
3
4
|
local: string;
|
|
4
5
|
session: string;
|
|
5
6
|
constructor();
|
|
7
|
+
/**
|
|
8
|
+
* Returns the referrer data as a JSON object, or undefined if both values are empty.
|
|
9
|
+
* @returns An object with local and session referrer strings, or undefined
|
|
10
|
+
*/
|
|
6
11
|
toJson(): {
|
|
7
12
|
local: string;
|
|
8
13
|
session: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Referrer.d.ts","sourceRoot":"","sources":["../../src/Referrer.ts"],"names":[],"mappings":"AAAA,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAmB;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;;IAQf,MAAM;;;;IASN,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,cAAc;CAMvB"}
|
|
1
|
+
{"version":3,"file":"Referrer.d.ts","sourceRoot":"","sources":["../../src/Referrer.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,qBAAa,QAAQ;IACnB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAmB;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;;IAQf;;;OAGG;IACH,MAAM;;;;IASN,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,cAAc;CAMvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestStartedFields.d.ts","sourceRoot":"","sources":["../../src/TestStartedFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,IAAI,EAAE,MAAM,CAAA;CACb"}
|
|
1
|
+
{"version":3,"file":"TestStartedFields.d.ts","sourceRoot":"","sources":["../../src/TestStartedFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,gEAAgE;AAChE,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,IAAI,EAAE,MAAM,CAAA;CACb"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/** Generates and persists a unique user identifier in localStorage. */
|
|
1
2
|
export declare class UniqueUserId {
|
|
2
3
|
private static localStorageId;
|
|
3
4
|
id: string;
|
|
4
5
|
constructor();
|
|
6
|
+
/** Returns the unique user ID as a string. */
|
|
5
7
|
toString(): string;
|
|
6
8
|
private generateId;
|
|
7
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UniqueUserId.d.ts","sourceRoot":"","sources":["../../src/UniqueUserId.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAc;IAC3C,EAAE,EAAE,MAAM,CAAA;;IAOV,QAAQ;IAIR,OAAO,CAAC,UAAU;CAGnB"}
|
|
1
|
+
{"version":3,"file":"UniqueUserId.d.ts","sourceRoot":"","sources":["../../src/UniqueUserId.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAc;IAC3C,EAAE,EAAE,MAAM,CAAA;;IAOV,8CAA8C;IAC9C,QAAQ;IAIR,OAAO,CAAC,UAAU;CAGnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserClickFields.d.ts","sourceRoot":"","sources":["../../src/UserClickFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
|
1
|
+
{"version":3,"file":"UserClickFields.d.ts","sourceRoot":"","sources":["../../src/UserClickFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,8CAA8C;AAC9C,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
|
|
@@ -4,10 +4,15 @@ import type { FunnelStartedFields } from './FunnelStartedFields.ts';
|
|
|
4
4
|
import type { TestStartedFields } from './TestStartedFields.ts';
|
|
5
5
|
import type { UserClickFields } from './UserClickFields.ts';
|
|
6
6
|
import type { ViewContentFields } from './ViewContentFields.ts';
|
|
7
|
+
/** Abstract base class for handling user tracking events. */
|
|
7
8
|
export declare abstract class UserEventHandler<TData extends EmptyObject> {
|
|
9
|
+
/** Tracks a funnel-started event. */
|
|
8
10
|
abstract funnelStarted<T extends TData>(fields: T | FunnelStartedFields): Promisable<void>;
|
|
11
|
+
/** Tracks a test-started event. */
|
|
9
12
|
abstract testStarted<T extends TData>(fields: T | TestStartedFields): Promisable<void>;
|
|
13
|
+
/** Tracks a user click event. */
|
|
10
14
|
abstract userClick<T extends TData>(fields: T | UserClickFields): Promisable<void>;
|
|
15
|
+
/** Tracks a view-content event. */
|
|
11
16
|
abstract viewContent<T extends TData>(fields: T | ViewContentFields): Promisable<void>;
|
|
12
17
|
}
|
|
13
18
|
//# sourceMappingURL=UserEventHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserEventHandler.d.ts","sourceRoot":"","sources":["../../src/UserEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,8BAAsB,gBAAgB,CAAC,KAAK,SAAS,WAAW;IAC9D,QAAQ,CAAC,aAAa,CAAC,CAAC,SAAS,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,mBAAmB,GAAG,UAAU,CAAC,IAAI,CAAC;IAC1F,QAAQ,CAAC,WAAW,CAAC,CAAC,SAAS,KAAK,EAAE,MAAM,EAAE,CAAC,G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AC,SAAS,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,iBAAiB,GAAG,UAAU,CAAC,IAAI,CAAC;CACvF"}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
+
/** Tracks UTM campaign parameters from query strings, persisting history in localStorage. */
|
|
1
2
|
export declare class UtmFields {
|
|
2
3
|
private static localStorageId;
|
|
3
4
|
fields: Record<string, string>[];
|
|
4
5
|
constructor();
|
|
6
|
+
/**
|
|
7
|
+
* Parses UTM parameters from the current URL query string.
|
|
8
|
+
* @returns A record of UTM key-value pairs, or null if none are present
|
|
9
|
+
*/
|
|
5
10
|
getUtmRecord: () => Record<string, string> | null;
|
|
11
|
+
/** Returns the UTM fields history as a JSON string. */
|
|
6
12
|
toString(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Checks the query string for new UTM values and appends them to the history if changed.
|
|
15
|
+
* @returns The current UTM fields array, or undefined if empty
|
|
16
|
+
*/
|
|
7
17
|
update(): Record<string, string>[];
|
|
8
18
|
}
|
|
9
19
|
//# sourceMappingURL=UtmFields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtmFields.d.ts","sourceRoot":"","sources":["../../src/UtmFields.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAc;IAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAK;;IAgBrC,YAAY,sCAWX;IAED,QAAQ;
|
|
1
|
+
{"version":3,"file":"UtmFields.d.ts","sourceRoot":"","sources":["../../src/UtmFields.ts"],"names":[],"mappings":"AAEA,6FAA6F;AAC7F,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAc;IAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAK;;IAgBrC;;;OAGG;IACH,YAAY,sCAWX;IAED,uDAAuD;IACvD,QAAQ;IAIR;;;OAGG;IAEH,MAAM;CAOP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewContentFields.d.ts","sourceRoot":"","sources":["../../src/ViewContentFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb"}
|
|
1
|
+
{"version":3,"file":"ViewContentFields.d.ts","sourceRoot":"","sources":["../../src/ViewContentFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,gDAAgD;AAChD,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XyLabsTrackingEventJson.d.ts","sourceRoot":"","sources":["../../src/XyLabsTrackingEventJson.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;I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 import type { TestStartedFields } from './TestStartedFields.ts';
|
|
|
5
5
|
import type { UserClickFields } from './UserClickFields.ts';
|
|
6
6
|
import { UserEventHandler } from './UserEventHandler.ts';
|
|
7
7
|
import type { ViewContentFields } from './ViewContentFields.ts';
|
|
8
|
+
/** Concrete event handler that sends tracking events through the XyPixel singleton. */
|
|
8
9
|
export declare class XyUserEventHandler<T extends EmptyObject = EmptyObject> extends UserEventHandler<T> {
|
|
9
10
|
constructor();
|
|
11
|
+
/** Sends a funnel-started event via the pixel API. */
|
|
10
12
|
funnelStarted(fields: T | FunnelStartedFields): Promise<void>;
|
|
13
|
+
/** Sends a purchase event via the pixel API. */
|
|
11
14
|
purchase(fields: T | PurchaseFields): Promise<void>;
|
|
15
|
+
/** Sends a test-started event via the pixel API. */
|
|
12
16
|
testStarted(fields: T | TestStartedFields): Promise<void>;
|
|
17
|
+
/** Sends a user click event via the pixel API. */
|
|
13
18
|
userClick(fields: T | UserClickFields): Promise<void>;
|
|
19
|
+
/** Sends a view-content event via the pixel API. */
|
|
14
20
|
viewContent(fields: T | ViewContentFields): Promise<void>;
|
|
15
21
|
}
|
|
16
22
|
//# sourceMappingURL=XyUserEventHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XyUserEventHandler.d.ts","sourceRoot":"","sources":["../../src/XyUserEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,gBAAgB,CAAA;AAEnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,qBAAa,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,CAAE,SAAQ,gBAAgB,CAAC,CAAC,CAAC;;
|
|
1
|
+
{"version":3,"file":"XyUserEventHandler.d.ts","sourceRoot":"","sources":["../../src/XyUserEventHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,gBAAgB,CAAA;AAEnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,uFAAuF;AACvF,qBAAa,kBAAkB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,CAAE,SAAQ,gBAAgB,CAAC,CAAC,CAAC;;IAK9F,sDAAsD;IAChD,aAAa,CAAC,MAAM,EAAE,CAAC,GAAG,mBAAmB;IAInD,gDAAgD;IAC1C,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAG,cAAc;IAIzC,oDAAoD;IAC9C,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,iBAAiB;IAI/C,kDAAkD;IAC5C,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,eAAe;IAI3C,oDAAoD;IAC9C,WAAW,CAAC,MAAM,EAAE,CAAC,GAAG,iBAAiB;CAGhD"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import Bowser from 'bowser';
|
|
2
|
+
/**
|
|
3
|
+
* Returns parsed browser, OS, and engine information from the user agent string.
|
|
4
|
+
* Results are cached after the first call.
|
|
5
|
+
* @returns The parsed system info, or undefined if parsing fails
|
|
6
|
+
*/
|
|
2
7
|
export declare const getSystemInfo: () => Bowser.Parser.ParsedResult | undefined;
|
|
3
8
|
//# sourceMappingURL=getSystemInfo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSystemInfo.d.ts","sourceRoot":"","sources":["../../src/getSystemInfo.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAM3B,eAAO,MAAM,aAAa,8CAQzB,CAAA"}
|
|
1
|
+
{"version":3,"file":"getSystemInfo.d.ts","sourceRoot":"","sources":["../../src/getSystemInfo.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAM3B;;;;GAIG;AACH,eAAO,MAAM,aAAa,8CAQzB,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -12,6 +12,11 @@ var PixelApi = class {
|
|
|
12
12
|
constructor(baseUri = "prod") {
|
|
13
13
|
this.endPoint = isUndefined(apiBaseUri[baseUri]) ? baseUri : `${apiBaseUri[baseUri]}/t/event/queue`;
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Sends an array of user events to the tracking API.
|
|
17
|
+
* @param events - The events to submit
|
|
18
|
+
* @returns The response data from the API
|
|
19
|
+
*/
|
|
15
20
|
async trackEvents(events) {
|
|
16
21
|
return (await axios.post(this.endPoint, events)).data;
|
|
17
22
|
}
|
|
@@ -46,6 +51,10 @@ var Referrer = class _Referrer {
|
|
|
46
51
|
this.local = this.getFromLocal() ?? document.referrer;
|
|
47
52
|
globalThis.localStorage.setItem(_Referrer.storageId, this.local);
|
|
48
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns the referrer data as a JSON object, or undefined if both values are empty.
|
|
56
|
+
* @returns An object with local and session referrer strings, or undefined
|
|
57
|
+
*/
|
|
49
58
|
toJson() {
|
|
50
59
|
if (this.local.length > 0 || this.session.length > 0) {
|
|
51
60
|
return {
|
|
@@ -76,6 +85,7 @@ var UniqueUserId = class _UniqueUserId {
|
|
|
76
85
|
this.id = globalThis.localStorage.getItem(_UniqueUserId.localStorageId) ?? this.generateId();
|
|
77
86
|
globalThis.localStorage.setItem(_UniqueUserId.localStorageId, this.id);
|
|
78
87
|
}
|
|
88
|
+
/** Returns the unique user ID as a string. */
|
|
79
89
|
toString() {
|
|
80
90
|
return this.id;
|
|
81
91
|
}
|
|
@@ -102,6 +112,10 @@ var UtmFields = class _UtmFields {
|
|
|
102
112
|
this.update();
|
|
103
113
|
globalThis.localStorage.setItem(_UtmFields.localStorageId, JSON.stringify(this.fields));
|
|
104
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Parses UTM parameters from the current URL query string.
|
|
117
|
+
* @returns A record of UTM key-value pairs, or null if none are present
|
|
118
|
+
*/
|
|
105
119
|
getUtmRecord = () => {
|
|
106
120
|
const record = {};
|
|
107
121
|
const parsedQueryString = document.location.search.split("?")[1]?.split("&") ?? [];
|
|
@@ -114,9 +128,14 @@ var UtmFields = class _UtmFields {
|
|
|
114
128
|
}
|
|
115
129
|
return Object.keys(record).length > 0 ? record : null;
|
|
116
130
|
};
|
|
131
|
+
/** Returns the UTM fields history as a JSON string. */
|
|
117
132
|
toString() {
|
|
118
133
|
return JSON.stringify(this.fields);
|
|
119
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Checks the query string for new UTM values and appends them to the history if changed.
|
|
137
|
+
* @returns The current UTM fields array, or undefined if empty
|
|
138
|
+
*/
|
|
120
139
|
// check the query string and if there an new/updated utm values, add them to the fields
|
|
121
140
|
update() {
|
|
122
141
|
const record = this.getUtmRecord();
|
|
@@ -144,13 +163,23 @@ var XyPixel = class _XyPixel {
|
|
|
144
163
|
this.pixelId = pixelId;
|
|
145
164
|
this.email_hash = localStorage.getItem(emailHashLocalStorageName);
|
|
146
165
|
}
|
|
166
|
+
/** Returns the singleton XyPixel instance, throwing if not yet initialized. */
|
|
147
167
|
static get instance() {
|
|
148
168
|
return assertEx(this._instance, () => "XyPixel uninitialized");
|
|
149
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Initializes the XyPixel singleton with the given pixel ID.
|
|
172
|
+
* @param pixelId - The pixel identifier for this tracking instance
|
|
173
|
+
* @returns The newly created XyPixel instance
|
|
174
|
+
*/
|
|
150
175
|
static init(pixelId) {
|
|
151
176
|
this._instance = new _XyPixel(pixelId);
|
|
152
177
|
return this._instance;
|
|
153
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Replaces the default PixelApi instance used for sending events.
|
|
181
|
+
* @param api - The PixelApi instance to use
|
|
182
|
+
*/
|
|
154
183
|
static selectApi(api) {
|
|
155
184
|
this.api = api;
|
|
156
185
|
}
|
|
@@ -160,6 +189,10 @@ var XyPixel = class _XyPixel {
|
|
|
160
189
|
}
|
|
161
190
|
return this.utmFieldsObj;
|
|
162
191
|
};
|
|
192
|
+
/**
|
|
193
|
+
* Associates an email address with this pixel instance, hashing it for privacy.
|
|
194
|
+
* @param email - The email address to identify the user with
|
|
195
|
+
*/
|
|
163
196
|
identify(email) {
|
|
164
197
|
this.email = email;
|
|
165
198
|
this.email_hash = email !== void 0 && email.length > 0 ? md5.hash(email, true) : void 0;
|
|
@@ -167,6 +200,12 @@ var XyPixel = class _XyPixel {
|
|
|
167
200
|
localStorage.setItem(emailHashLocalStorageName, this.email_hash);
|
|
168
201
|
}
|
|
169
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Queues a tracking event and attempts to flush the queue to the API.
|
|
205
|
+
* @param event - The event name
|
|
206
|
+
* @param fields - Optional event-specific fields
|
|
207
|
+
* @param eventId - Optional unique event identifier
|
|
208
|
+
*/
|
|
170
209
|
async send(event, fields, eventId) {
|
|
171
210
|
this.updateFbId();
|
|
172
211
|
const utm = _XyPixel.utmFields().update();
|
|
@@ -229,18 +268,23 @@ var XyUserEventHandler = class extends UserEventHandler {
|
|
|
229
268
|
constructor() {
|
|
230
269
|
super();
|
|
231
270
|
}
|
|
271
|
+
/** Sends a funnel-started event via the pixel API. */
|
|
232
272
|
async funnelStarted(fields) {
|
|
233
273
|
return await XyPixel.instance.send("FunnelStarted", toSafeJsonObject(fields, [], 10));
|
|
234
274
|
}
|
|
275
|
+
/** Sends a purchase event via the pixel API. */
|
|
235
276
|
async purchase(fields) {
|
|
236
277
|
return await XyPixel.instance.send("Purchase", toSafeJsonObject(fields, [], 10));
|
|
237
278
|
}
|
|
279
|
+
/** Sends a test-started event via the pixel API. */
|
|
238
280
|
async testStarted(fields) {
|
|
239
281
|
return await XyPixel.instance.send("TestStarted", toSafeJsonObject(fields, [], 10));
|
|
240
282
|
}
|
|
283
|
+
/** Sends a user click event via the pixel API. */
|
|
241
284
|
async userClick(fields) {
|
|
242
285
|
return await XyPixel.instance.send("ViewPage", toSafeJsonObject(fields, [], 10));
|
|
243
286
|
}
|
|
287
|
+
/** Sends a view-content event via the pixel API. */
|
|
244
288
|
async viewContent(fields) {
|
|
245
289
|
return await XyPixel.instance.send("ViewContent", toSafeJsonObject(fields, [], 10));
|
|
246
290
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Api/Api.ts","../../src/Pixel.ts","../../src/getSystemInfo.ts","../../src/Referrer.ts","../../src/UniqueUserId.ts","../../src/UtmFields.ts","../../src/UserEventHandler.ts","../../src/XyUserEventHandler.ts"],"sourcesContent":["import { isUndefined } from '@xylabs/typeof'\nimport axios from 'axios'\n\nimport type { UserEvent } from './UserEvent.ts'\n\nconst apiBaseUri: Record<string, string> = {\n beta: 'https://pixel.xylabs.com',\n local: 'http://localhost:3030',\n prod: 'https://pixel.xylabs.com',\n}\n\nexport class PixelApi {\n private endPoint: string\n\n /* baseUri can either be a preset (prod, beta, local), or a specific uri */\n constructor(baseUri = 'prod') {\n this.endPoint = isUndefined(apiBaseUri[baseUri]) ? baseUri : `${apiBaseUri[baseUri]}/t/event/queue`\n }\n\n async trackEvents(events: UserEvent[]) {\n return (await axios.post(this.endPoint, events)).data\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { JsonObject } from '@xylabs/object'\nimport { Mutex } from 'async-mutex'\nimport Cookies from 'js-cookie'\nimport md5 from 'spark-md5'\n\nimport type { UserEvent } from './Api/index.ts'\nimport { PixelApi } from './Api/index.ts'\nimport type { ExIds } from './ExIds.ts'\nimport { getSystemInfo } from './getSystemInfo.ts'\nimport { Referrer } from './Referrer.ts'\nimport { UniqueUserId } from './UniqueUserId.ts'\nimport { UtmFields } from './UtmFields.ts'\n\nconst emailHashLocalStorageName = 'xy_email_hash'\n\nexport class XyPixel {\n static api = new PixelApi()\n\n private static _instance?: XyPixel\n private static utmFieldsObj: UtmFields\n\n cid = new UniqueUserId().id\n email?: string\n email_hash?: string | null\n exids?: ExIds\n pixelId?: string\n\n queue: UserEvent[] = []\n\n private queueMutex = new Mutex()\n\n private constructor(pixelId: string) {\n this.pixelId = pixelId\n this.email_hash = localStorage.getItem(emailHashLocalStorageName)\n }\n\n static get instance(): XyPixel {\n return assertEx(this._instance, () => 'XyPixel uninitialized')\n }\n\n static init(pixelId: string) {\n this._instance = new XyPixel(pixelId)\n return this._instance\n }\n\n static selectApi(api: PixelApi) {\n this.api = api\n }\n\n private static utmFields = () => {\n if (this.utmFieldsObj === undefined) {\n this.utmFieldsObj = new UtmFields()\n }\n return this.utmFieldsObj\n }\n\n identify(email?: string) {\n this.email = email\n this.email_hash = (email !== undefined && email.length > 0) ? md5.hash(email, true) : undefined\n if (this.email_hash !== undefined) {\n localStorage.setItem(emailHashLocalStorageName, this.email_hash)\n }\n }\n\n async send<T extends JsonObject>(event: string, fields?: T, eventId?: string) {\n this.updateFbId()\n const utm = XyPixel.utmFields().update()\n const referrer = new Referrer()\n this.queue.push({\n cid: this.cid,\n create_time: Date.now(),\n email_hash: this.email_hash ?? undefined,\n event,\n event_id: eventId,\n exids: this.exids,\n fields,\n host: document.location.host,\n pathname: document.location.pathname,\n pixel: this.pixelId,\n referrer: referrer.toJson(),\n system: getSystemInfo(),\n utm,\n })\n await this.tryFlushQueue()\n }\n\n private async tryFlushQueue() {\n await this.queueMutex.runExclusive(async () => {\n if (this.queue.length === 0) return\n const api = XyPixel.api\n if (api !== undefined) {\n const events = this.queue\n this.queue = []\n try {\n await api.trackEvents(events)\n } catch (ex) {\n if (events !== undefined) {\n // put it back since it failed\n this.queue = [...this.queue, ...events]\n }\n // eslint-disable-next-line no-console\n console.error(ex)\n }\n }\n })\n }\n\n private updateFbId() {\n this.exids = {\n fbc: Cookies.get('_fbc'),\n fbp: Cookies.get('_fbp'),\n ga: Cookies.get('_ga'),\n gclid: Cookies.get('_gcl_aw'),\n rdt_uid: Cookies.get('rdt_uid'),\n scid: Cookies.get('_scid'),\n tt_sessionId: sessionStorage.getItem('tt_sessionId') ?? undefined,\n }\n }\n}\n","import Bowser from 'bowser'\n\nimport type { UserEventSystem } from './Api/index.ts'\n\nlet systemInfo: UserEventSystem | undefined\n\nexport const getSystemInfo = () => {\n try {\n systemInfo = systemInfo || Bowser.getParser(globalThis.navigator.userAgent).getResult()\n } catch (ex) {\n // eslint-disable-next-line no-console\n console.log(`getSystemInfo Error: ${ex}`)\n }\n return systemInfo\n}\n","export class Referrer {\n private static storageId = '_coin_referrer'\n local: string\n session: string\n constructor() {\n this.session = this.getFromSession() ?? document.referrer\n sessionStorage.setItem(Referrer.storageId, this.session)\n this.local = this.getFromLocal() ?? document.referrer\n globalThis.localStorage.setItem(Referrer.storageId, this.local)\n }\n\n toJson() {\n if ((this.local.length > 0) || (this.session.length > 0)) {\n return {\n local: this.local,\n session: this.session,\n }\n }\n }\n\n private getFromLocal() {\n const value = globalThis.localStorage.getItem(Referrer.storageId)\n if (value !== null && value.length > 0) {\n return value\n }\n }\n\n private getFromSession() {\n const value = sessionStorage.getItem(Referrer.storageId)\n if (value !== null && value.length > 0) {\n return value\n }\n }\n}\n","export class UniqueUserId {\n private static localStorageId = '_coin_cid'\n id: string\n\n constructor() {\n this.id = globalThis.localStorage.getItem(UniqueUserId.localStorageId) ?? this.generateId()\n globalThis.localStorage.setItem(UniqueUserId.localStorageId, this.id)\n }\n\n toString() {\n return this.id\n }\n\n private generateId() {\n return crypto.randomUUID()\n }\n}\n","import isEqual from 'fast-deep-equal'\n\nexport class UtmFields {\n private static localStorageId = '_coin_utm'\n fields: Record<string, string>[] = []\n constructor() {\n const storedString = globalThis.localStorage.getItem(UtmFields.localStorageId) ?? '[]'\n try {\n this.fields = JSON.parse(storedString)\n } catch {\n this.fields = []\n }\n // this clears the old object version if needed\n if (!Array.isArray(this.fields)) {\n this.fields = []\n }\n this.update()\n globalThis.localStorage.setItem(UtmFields.localStorageId, JSON.stringify(this.fields))\n }\n\n getUtmRecord = () => {\n const record: Record<string, string> = {}\n const parsedQueryString = document.location.search.split('?')[1]?.split('&') ?? []\n for (const item of parsedQueryString) {\n const [fullKey, value] = item.split('=')\n const [keyCategory, keyName] = fullKey.split('_')\n if (keyCategory === 'utm') {\n record[keyName] = value\n }\n }\n return Object.keys(record).length > 0 ? record : null\n }\n\n toString() {\n return JSON.stringify(this.fields)\n }\n\n // check the query string and if there an new/updated utm values, add them to the fields\n update() {\n const record = this.getUtmRecord()\n if (record && !isEqual(this.fields.at(-1), record)) {\n this.fields.push(record)\n }\n return this.fields ?? undefined\n }\n}\n","import type { EmptyObject } from '@xylabs/object'\nimport type { Promisable } from '@xylabs/promise'\n\nimport type { FunnelStartedFields } from './FunnelStartedFields.ts'\nimport type { TestStartedFields } from './TestStartedFields.ts'\nimport type { UserClickFields } from './UserClickFields.ts'\nimport type { ViewContentFields } from './ViewContentFields.ts'\n\nexport abstract class UserEventHandler<TData extends EmptyObject> {\n abstract funnelStarted<T extends TData>(fields: T | FunnelStartedFields): Promisable<void>\n abstract testStarted<T extends TData>(fields: T | TestStartedFields): Promisable<void>\n abstract userClick<T extends TData>(fields: T | UserClickFields): Promisable<void>\n abstract viewContent<T extends TData>(fields: T | ViewContentFields): Promisable<void>\n}\n","import { type EmptyObject, toSafeJsonObject } from '@xylabs/object'\n\nimport type { FunnelStartedFields } from './FunnelStartedFields.ts'\nimport { XyPixel } from './Pixel.ts'\nimport type { PurchaseFields } from './PurchaseFields.ts'\nimport type { TestStartedFields } from './TestStartedFields.ts'\nimport type { UserClickFields } from './UserClickFields.ts'\nimport { UserEventHandler } from './UserEventHandler.ts'\nimport type { ViewContentFields } from './ViewContentFields.ts'\n\nexport class XyUserEventHandler<T extends EmptyObject = EmptyObject> extends UserEventHandler<T> {\n constructor() {\n super()\n }\n\n async funnelStarted(fields: T | FunnelStartedFields) {\n return await XyPixel.instance.send('FunnelStarted', toSafeJsonObject(fields, [], 10))\n }\n\n async purchase(fields: T | PurchaseFields) {\n return await XyPixel.instance.send('Purchase', toSafeJsonObject(fields, [], 10))\n }\n\n async testStarted(fields: T | TestStartedFields) {\n return await XyPixel.instance.send('TestStarted', toSafeJsonObject(fields, [], 10))\n }\n\n async userClick(fields: T | UserClickFields) {\n return await XyPixel.instance.send('ViewPage', toSafeJsonObject(fields, [], 10))\n }\n\n async viewContent(fields: T | ViewContentFields) {\n return await XyPixel.instance.send('ViewContent', toSafeJsonObject(fields, [], 10))\n }\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,OAAO,WAAW;AAIlB,IAAM,aAAqC;AAAA,EACzC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AACR;AAEO,IAAM,WAAN,MAAe;AAAA,EACZ;AAAA;AAAA,EAGR,YAAY,UAAU,QAAQ;AAC5B,SAAK,WAAW,YAAY,WAAW,OAAO,CAAC,IAAI,UAAU,GAAG,WAAW,OAAO,CAAC;AAAA,EACrF;AAAA,EAEA,MAAM,YAAY,QAAqB;AACrC,YAAQ,MAAM,MAAM,KAAK,KAAK,UAAU,MAAM,GAAG;AAAA,EACnD;AACF;;;ACtBA,SAAS,gBAAgB;AAEzB,SAAS,aAAa;AACtB,OAAO,aAAa;AACpB,OAAO,SAAS;;;ACJhB,OAAO,YAAY;AAInB,IAAI;AAEG,IAAM,gBAAgB,MAAM;AACjC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S,QAA4B;AACzC,WAAO,MAAM,QAAQ,SAAS,KAAK,YAAY,iBAAiB,QAAQ,CAAC,GAAG,EAAE,CAAC;AAAA,EACjF;AAAA,EAEA,MAAM,YAAY,QAA+B;AAC/C,WAAO,MAAM,QAAQ,SAAS,KAAK,eAAe,iBAAiB,QAAQ,CAAC,GAAG,EAAE,CAAC;AAAA,EACpF;AAAA,EAEA,MAAM,UAAU,QAA6B;AAC3C,WAAO,MAAM,QAAQ,SAAS,KAAK,YAAY,iBAAiB,QAAQ,CAAC,GAAG,EAAE,CAAC;AAAA,EACjF;AAAA,EAEA,MAAM,YAAY,QAA+B;AAC/C,WAAO,MAAM,QAAQ,SAAS,KAAK,eAAe,iBAAiB,QAAQ,CAAC,GAAG,EAAE,CAAC;AAAA,EACpF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/Api/Api.ts","../../src/Pixel.ts","../../src/getSystemInfo.ts","../../src/Referrer.ts","../../src/UniqueUserId.ts","../../src/UtmFields.ts","../../src/UserEventHandler.ts","../../src/XyUserEventHandler.ts"],"sourcesContent":["import { isUndefined } from '@xylabs/typeof'\nimport axios from 'axios'\n\nimport type { UserEvent } from './UserEvent.ts'\n\nconst apiBaseUri: Record<string, string> = {\n beta: 'https://pixel.xylabs.com',\n local: 'http://localhost:3030',\n prod: 'https://pixel.xylabs.com',\n}\n\n/** HTTP client for sending tracking events to the XY Labs pixel API. */\nexport class PixelApi {\n private endPoint: string\n\n /* baseUri can either be a preset (prod, beta, local), or a specific uri */\n constructor(baseUri = 'prod') {\n this.endPoint = isUndefined(apiBaseUri[baseUri]) ? baseUri : `${apiBaseUri[baseUri]}/t/event/queue`\n }\n\n /**\n * Sends an array of user events to the tracking API.\n * @param events - The events to submit\n * @returns The response data from the API\n */\n async trackEvents(events: UserEvent[]) {\n return (await axios.post(this.endPoint, events)).data\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { JsonObject } from '@xylabs/object'\nimport { Mutex } from 'async-mutex'\nimport Cookies from 'js-cookie'\nimport md5 from 'spark-md5'\n\nimport type { UserEvent } from './Api/index.ts'\nimport { PixelApi } from './Api/index.ts'\nimport type { ExIds } from './ExIds.ts'\nimport { getSystemInfo } from './getSystemInfo.ts'\nimport { Referrer } from './Referrer.ts'\nimport { UniqueUserId } from './UniqueUserId.ts'\nimport { UtmFields } from './UtmFields.ts'\n\nconst emailHashLocalStorageName = 'xy_email_hash'\n\n/** Singleton pixel tracker that queues and sends user events to the XY Labs tracking API. */\nexport class XyPixel {\n static api = new PixelApi()\n\n private static _instance?: XyPixel\n private static utmFieldsObj: UtmFields\n\n cid = new UniqueUserId().id\n email?: string\n email_hash?: string | null\n exids?: ExIds\n pixelId?: string\n\n queue: UserEvent[] = []\n\n private queueMutex = new Mutex()\n\n private constructor(pixelId: string) {\n this.pixelId = pixelId\n this.email_hash = localStorage.getItem(emailHashLocalStorageName)\n }\n\n /** Returns the singleton XyPixel instance, throwing if not yet initialized. */\n static get instance(): XyPixel {\n return assertEx(this._instance, () => 'XyPixel uninitialized')\n }\n\n /**\n * Initializes the XyPixel singleton with the given pixel ID.\n * @param pixelId - The pixel identifier for this tracking instance\n * @returns The newly created XyPixel instance\n */\n static init(pixelId: string) {\n this._instance = new XyPixel(pixelId)\n return this._instance\n }\n\n /**\n * Replaces the default PixelApi instance used for sending events.\n * @param api - The PixelApi instance to use\n */\n static selectApi(api: PixelApi) {\n this.api = api\n }\n\n private static utmFields = () => {\n if (this.utmFieldsObj === undefined) {\n this.utmFieldsObj = new UtmFields()\n }\n return this.utmFieldsObj\n }\n\n /**\n * Associates an email address with this pixel instance, hashing it for privacy.\n * @param email - The email address to identify the user with\n */\n identify(email?: string) {\n this.email = email\n this.email_hash = (email !== undefined && email.length > 0) ? md5.hash(email, true) : undefined\n if (this.email_hash !== undefined) {\n localStorage.setItem(emailHashLocalStorageName, this.email_hash)\n }\n }\n\n /**\n * Queues a tracking event and attempts to flush the queue to the API.\n * @param event - The event name\n * @param fields - Optional event-specific fields\n * @param eventId - Optional unique event identifier\n */\n async send<T extends JsonObject>(event: string, fields?: T, eventId?: string) {\n this.updateFbId()\n const utm = XyPixel.utmFields().update()\n const referrer = new Referrer()\n this.queue.push({\n cid: this.cid,\n create_time: Date.now(),\n email_hash: this.email_hash ?? undefined,\n event,\n event_id: eventId,\n exids: this.exids,\n fields,\n host: document.location.host,\n pathname: document.location.pathname,\n pixel: this.pixelId,\n referrer: referrer.toJson(),\n system: getSystemInfo(),\n utm,\n })\n await this.tryFlushQueue()\n }\n\n private async tryFlushQueue() {\n await this.queueMutex.runExclusive(async () => {\n if (this.queue.length === 0) return\n const api = XyPixel.api\n if (api !== undefined) {\n const events = this.queue\n this.queue = []\n try {\n await api.trackEvents(events)\n } catch (ex) {\n if (events !== undefined) {\n // put it back since it failed\n this.queue = [...this.queue, ...events]\n }\n // eslint-disable-next-line no-console\n console.error(ex)\n }\n }\n })\n }\n\n private updateFbId() {\n this.exids = {\n fbc: Cookies.get('_fbc'),\n fbp: Cookies.get('_fbp'),\n ga: Cookies.get('_ga'),\n gclid: Cookies.get('_gcl_aw'),\n rdt_uid: Cookies.get('rdt_uid'),\n scid: Cookies.get('_scid'),\n tt_sessionId: sessionStorage.getItem('tt_sessionId') ?? undefined,\n }\n }\n}\n","import Bowser from 'bowser'\n\nimport type { UserEventSystem } from './Api/index.ts'\n\nlet systemInfo: UserEventSystem | undefined\n\n/**\n * Returns parsed browser, OS, and engine information from the user agent string.\n * Results are cached after the first call.\n * @returns The parsed system info, or undefined if parsing fails\n */\nexport const getSystemInfo = () => {\n try {\n systemInfo = systemInfo || Bowser.getParser(globalThis.navigator.userAgent).getResult()\n } catch (ex) {\n // eslint-disable-next-line no-console\n console.log(`getSystemInfo Error: ${ex}`)\n }\n return systemInfo\n}\n","/** Tracks and persists the document referrer in both session and local storage. */\nexport class Referrer {\n private static storageId = '_coin_referrer'\n local: string\n session: string\n constructor() {\n this.session = this.getFromSession() ?? document.referrer\n sessionStorage.setItem(Referrer.storageId, this.session)\n this.local = this.getFromLocal() ?? document.referrer\n globalThis.localStorage.setItem(Referrer.storageId, this.local)\n }\n\n /**\n * Returns the referrer data as a JSON object, or undefined if both values are empty.\n * @returns An object with local and session referrer strings, or undefined\n */\n toJson() {\n if ((this.local.length > 0) || (this.session.length > 0)) {\n return {\n local: this.local,\n session: this.session,\n }\n }\n }\n\n private getFromLocal() {\n const value = globalThis.localStorage.getItem(Referrer.storageId)\n if (value !== null && value.length > 0) {\n return value\n }\n }\n\n private getFromSession() {\n const value = sessionStorage.getItem(Referrer.storageId)\n if (value !== null && value.length > 0) {\n return value\n }\n }\n}\n","/** Generates and persists a unique user identifier in localStorage. */\nexport class UniqueUserId {\n private static localStorageId = '_coin_cid'\n id: string\n\n constructor() {\n this.id = globalThis.localStorage.getItem(UniqueUserId.localStorageId) ?? this.generateId()\n globalThis.localStorage.setItem(UniqueUserId.localStorageId, this.id)\n }\n\n /** Returns the unique user ID as a string. */\n toString() {\n return this.id\n }\n\n private generateId() {\n return crypto.randomUUID()\n }\n}\n","import isEqual from 'fast-deep-equal'\n\n/** Tracks UTM campaign parameters from query strings, persisting history in localStorage. */\nexport class UtmFields {\n private static localStorageId = '_coin_utm'\n fields: Record<string, string>[] = []\n constructor() {\n const storedString = globalThis.localStorage.getItem(UtmFields.localStorageId) ?? '[]'\n try {\n this.fields = JSON.parse(storedString)\n } catch {\n this.fields = []\n }\n // this clears the old object version if needed\n if (!Array.isArray(this.fields)) {\n this.fields = []\n }\n this.update()\n globalThis.localStorage.setItem(UtmFields.localStorageId, JSON.stringify(this.fields))\n }\n\n /**\n * Parses UTM parameters from the current URL query string.\n * @returns A record of UTM key-value pairs, or null if none are present\n */\n getUtmRecord = () => {\n const record: Record<string, string> = {}\n const parsedQueryString = document.location.search.split('?')[1]?.split('&') ?? []\n for (const item of parsedQueryString) {\n const [fullKey, value] = item.split('=')\n const [keyCategory, keyName] = fullKey.split('_')\n if (keyCategory === 'utm') {\n record[keyName] = value\n }\n }\n return Object.keys(record).length > 0 ? record : null\n }\n\n /** Returns the UTM fields history as a JSON string. */\n toString() {\n return JSON.stringify(this.fields)\n }\n\n /**\n * Checks the query string for new UTM values and appends them to the history if changed.\n * @returns The current UTM fields array, or undefined if empty\n */\n // check the query string and if there an new/updated utm values, add them to the fields\n update() {\n const record = this.getUtmRecord()\n if (record && !isEqual(this.fields.at(-1), record)) {\n this.fields.push(record)\n }\n return this.fields ?? undefined\n }\n}\n","import type { EmptyObject } from '@xylabs/object'\nimport type { Promisable } from '@xylabs/promise'\n\nimport type { FunnelStartedFields } from './FunnelStartedFields.ts'\nimport type { TestStartedFields } from './TestStartedFields.ts'\nimport type { UserClickFields } from './UserClickFields.ts'\nimport type { ViewContentFields } from './ViewContentFields.ts'\n\n/** Abstract base class for handling user tracking events. */\nexport abstract class UserEventHandler<TData extends EmptyObject> {\n /** Tracks a funnel-started event. */\n abstract funnelStarted<T extends TData>(fields: T | FunnelStartedFields): Promisable<void>\n /** Tracks a test-started event. */\n abstract testStarted<T extends TData>(fields: T | TestStartedFields): Promisable<void>\n /** Tracks a user click event. */\n abstract userClick<T extends TData>(fields: T | UserClickFields): Promisable<void>\n /** Tracks a view-content event. */\n abstract viewContent<T extends TData>(fields: T | ViewContentFields): Promisable<void>\n}\n","import { type EmptyObject, toSafeJsonObject } from '@xylabs/object'\n\nimport type { FunnelStartedFields } from './FunnelStartedFields.ts'\nimport { XyPixel } from './Pixel.ts'\nimport type { PurchaseFields } from './PurchaseFields.ts'\nimport type { TestStartedFields } from './TestStartedFields.ts'\nimport type { UserClickFields } from './UserClickFields.ts'\nimport { UserEventHandler } from './UserEventHandler.ts'\nimport type { ViewContentFields } from './ViewContentFields.ts'\n\n/** Concrete event handler that sends tracking events through the XyPixel singleton. */\nexport class XyUserEventHandler<T extends EmptyObject = EmptyObject> extends UserEventHandler<T> {\n constructor() {\n super()\n }\n\n /** Sends a funnel-started event via the pixel API. */\n async funnelStarted(fields: T | FunnelStartedFields) {\n return await XyPixel.instance.send('FunnelStarted', toSafeJsonObject(fields, [], 10))\n }\n\n /** Sends a purchase event via the pixel API. */\n async purchase(fields: T | PurchaseFields) {\n return await XyPixel.instance.send('Purchase', toSafeJsonObject(fields, [], 10))\n }\n\n /** Sends a test-started event via the pixel API. */\n async testStarted(fields: T | TestStartedFields) {\n return await XyPixel.instance.send('TestStarted', toSafeJsonObject(fields, [], 10))\n }\n\n /** Sends a user click event via the pixel API. */\n async userClick(fields: T | UserClickFields) {\n return await XyPixel.instance.send('ViewPage', toSafeJsonObject(fields, [], 10))\n }\n\n /** Sends a view-content event via the pixel API. */\n async viewContent(fields: T | ViewContentFields) {\n return await XyPixel.instance.send('ViewContent', toSafeJsonObject(fields, [], 10))\n }\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,OAAO,WAAW;AAIlB,IAAM,aAAqC;AAAA,EACzC,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AACR;AAGO,IAAM,WAAN,MAAe;AAAA,EACZ;AAAA;AAAA,EAGR,YAAY,UAAU,QAAQ;AAC5B,SAAK,WAAW,YAAY,WAAW,OAAO,CAAC,IAAI,UAAU,GAAG,WAAW,OAAO,CAAC;AAAA,EACrF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,YAAY,QAAqB;AACrC,YAAQ,MAAM,MAAM,KAAK,KAAK,UAAU,MAAM,GAAG;AAAA,EACnD;AACF;;;AC5BA,SAAS,gBAAgB;AAEzB,SAAS,aAAa;AACtB,OAAO,aAAa;AACpB,OAAO,SAAS;;;ACJhB,OAAO,YAAY;AAInB,IAAI;AAOG,IAAM,gBAAgB,MAAM;AACjC,MAAI;AACF,iBAAa,cAAc,OAAO,UAAU,WAAW,UAAU,SAAS,EAAE,UAAU;AAAA,EACxF,SAAS,IAAI;AAEX,YAAQ,IAAI,wBAAwB,EAAE,EAAE;AAAA,EAC1C;AACA,SAAO;AACT;;;AClBO,IAAM,WAAN,MAAM,UAAS;AAAA,EACpB,OAAe,YAAY;AA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A4B;AACzC,WAAO,MAAM,QAAQ,SAAS,KAAK,YAAY,iBAAiB,QAAQ,CAAC,GAAG,EAAE,CAAC;AAAA,EACjF;AAAA;AAAA,EAGA,MAAM,YAAY,QAA+B;AAC/C,WAAO,MAAM,QAAQ,SAAS,KAAK,eAAe,iBAAiB,QAAQ,CAAC,GAAG,EAAE,CAAC;AAAA,EACpF;AAAA;AAAA,EAGA,MAAM,UAAU,QAA6B;AAC3C,WAAO,MAAM,QAAQ,SAAS,KAAK,YAAY,iBAAiB,QAAQ,CAAC,GAAG,EAAE,CAAC;AAAA,EACjF;AAAA;AAAA,EAGA,MAAM,YAAY,QAA+B;AAC/C,WAAO,MAAM,QAAQ,SAAS,KAAK,eAAe,iBAAiB,QAAQ,CAAC,GAAG,EAAE,CAAC;AAAA,EACpF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/pixel",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.86",
|
|
4
4
|
"description": "Event Client for xylabs ESB",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"!**/*.test.*"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@xylabs/assert": "~5.0.
|
|
39
|
-
"@xylabs/object": "~5.0.
|
|
40
|
-
"@xylabs/promise": "~5.0.
|
|
41
|
-
"@xylabs/typeof": "~5.0.
|
|
38
|
+
"@xylabs/assert": "~5.0.86",
|
|
39
|
+
"@xylabs/object": "~5.0.86",
|
|
40
|
+
"@xylabs/promise": "~5.0.86",
|
|
41
|
+
"@xylabs/typeof": "~5.0.86",
|
|
42
42
|
"async-mutex": "~0.5.0",
|
|
43
43
|
"bowser": "2.14.1",
|
|
44
44
|
"fast-deep-equal": "~3.1.3",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"@types/js-cookie": "~3.0.6",
|
|
50
50
|
"@types/node": "~25.4.0",
|
|
51
51
|
"@types/spark-md5": "~3.0.5",
|
|
52
|
-
"@xylabs/ts-scripts-yarn3": "~7.4.
|
|
53
|
-
"@xylabs/tsconfig": "~7.4.
|
|
54
|
-
"@xylabs/tsconfig-dom": "~7.4.
|
|
52
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.16",
|
|
53
|
+
"@xylabs/tsconfig": "~7.4.16",
|
|
54
|
+
"@xylabs/tsconfig-dom": "~7.4.16",
|
|
55
55
|
"axios": "^1.13.6",
|
|
56
56
|
"typescript": "~5.9.3",
|
|
57
57
|
"vitest": "~4.0.18"
|