aurea-tracking-sdk 1.5.0 → 1.5.2
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.d.mts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +46 -7
- package/dist/index.mjs +46 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -234,6 +234,21 @@ declare class AureaSDK {
|
|
|
234
234
|
* Get current event category statistics
|
|
235
235
|
*/
|
|
236
236
|
getCategoryStats(): Record<EventCategory, number>;
|
|
237
|
+
/**
|
|
238
|
+
* Get anonymous ID
|
|
239
|
+
* Returns the persistent identifier for this user across sessions
|
|
240
|
+
*/
|
|
241
|
+
getAnonymousId(): string;
|
|
242
|
+
/**
|
|
243
|
+
* Get session ID
|
|
244
|
+
* Returns the unique identifier for this browsing session
|
|
245
|
+
*/
|
|
246
|
+
getSessionId(): string;
|
|
247
|
+
/**
|
|
248
|
+
* Get user ID
|
|
249
|
+
* Returns the identified user ID if user has been identified
|
|
250
|
+
*/
|
|
251
|
+
getUserId(): string | undefined;
|
|
237
252
|
/**
|
|
238
253
|
* Get current funnel stage
|
|
239
254
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -234,6 +234,21 @@ declare class AureaSDK {
|
|
|
234
234
|
* Get current event category statistics
|
|
235
235
|
*/
|
|
236
236
|
getCategoryStats(): Record<EventCategory, number>;
|
|
237
|
+
/**
|
|
238
|
+
* Get anonymous ID
|
|
239
|
+
* Returns the persistent identifier for this user across sessions
|
|
240
|
+
*/
|
|
241
|
+
getAnonymousId(): string;
|
|
242
|
+
/**
|
|
243
|
+
* Get session ID
|
|
244
|
+
* Returns the unique identifier for this browsing session
|
|
245
|
+
*/
|
|
246
|
+
getSessionId(): string;
|
|
247
|
+
/**
|
|
248
|
+
* Get user ID
|
|
249
|
+
* Returns the identified user ID if user has been identified
|
|
250
|
+
*/
|
|
251
|
+
getUserId(): string | undefined;
|
|
237
252
|
/**
|
|
238
253
|
* Get current funnel stage
|
|
239
254
|
*/
|
package/dist/index.js
CHANGED
|
@@ -407,6 +407,27 @@ var AureaSDK = class {
|
|
|
407
407
|
getCategoryStats() {
|
|
408
408
|
return Object.fromEntries(this.eventCategoryStats);
|
|
409
409
|
}
|
|
410
|
+
/**
|
|
411
|
+
* Get anonymous ID
|
|
412
|
+
* Returns the persistent identifier for this user across sessions
|
|
413
|
+
*/
|
|
414
|
+
getAnonymousId() {
|
|
415
|
+
return this.anonymousId;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Get session ID
|
|
419
|
+
* Returns the unique identifier for this browsing session
|
|
420
|
+
*/
|
|
421
|
+
getSessionId() {
|
|
422
|
+
return this.sessionId;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Get user ID
|
|
426
|
+
* Returns the identified user ID if user has been identified
|
|
427
|
+
*/
|
|
428
|
+
getUserId() {
|
|
429
|
+
return this.userId;
|
|
430
|
+
}
|
|
410
431
|
/**
|
|
411
432
|
* Get current funnel stage
|
|
412
433
|
*/
|
|
@@ -798,13 +819,19 @@ var AureaSDK = class {
|
|
|
798
819
|
title: document.title,
|
|
799
820
|
referrer: document.referrer
|
|
800
821
|
} : void 0,
|
|
801
|
-
utm: {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
822
|
+
utm: (() => {
|
|
823
|
+
const utm = {
|
|
824
|
+
source: url.searchParams.get("utm_source") || void 0,
|
|
825
|
+
medium: url.searchParams.get("utm_medium") || void 0,
|
|
826
|
+
campaign: url.searchParams.get("utm_campaign") || void 0,
|
|
827
|
+
term: url.searchParams.get("utm_term") || void 0,
|
|
828
|
+
content: url.searchParams.get("utm_content") || void 0
|
|
829
|
+
};
|
|
830
|
+
if (this.config.debug && (utm.source || utm.medium || utm.campaign)) {
|
|
831
|
+
console.log("[Aurea SDK] UTM params extracted from URL:", utm, "URL:", url.href);
|
|
832
|
+
}
|
|
833
|
+
return utm;
|
|
834
|
+
})(),
|
|
808
835
|
user: {
|
|
809
836
|
userId: this.userId,
|
|
810
837
|
anonymousId: this.anonymousId
|
|
@@ -916,6 +943,18 @@ var AureaSDK = class {
|
|
|
916
943
|
*/
|
|
917
944
|
async sendEvents(events) {
|
|
918
945
|
if (events.length === 0) return;
|
|
946
|
+
if (this.config.debug) {
|
|
947
|
+
events.forEach((evt) => {
|
|
948
|
+
if (evt.eventName === "page_view") {
|
|
949
|
+
console.log("[Aurea SDK] Sending page_view with UTM:", {
|
|
950
|
+
source: evt.context.utm?.source,
|
|
951
|
+
medium: evt.context.utm?.medium,
|
|
952
|
+
campaign: evt.context.utm?.campaign,
|
|
953
|
+
url: evt.context.page?.url
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
}
|
|
919
958
|
try {
|
|
920
959
|
const response = await fetch(`${this.config.apiUrl}/track/events`, {
|
|
921
960
|
method: "POST",
|
package/dist/index.mjs
CHANGED
|
@@ -378,6 +378,27 @@ var AureaSDK = class {
|
|
|
378
378
|
getCategoryStats() {
|
|
379
379
|
return Object.fromEntries(this.eventCategoryStats);
|
|
380
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* Get anonymous ID
|
|
383
|
+
* Returns the persistent identifier for this user across sessions
|
|
384
|
+
*/
|
|
385
|
+
getAnonymousId() {
|
|
386
|
+
return this.anonymousId;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Get session ID
|
|
390
|
+
* Returns the unique identifier for this browsing session
|
|
391
|
+
*/
|
|
392
|
+
getSessionId() {
|
|
393
|
+
return this.sessionId;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Get user ID
|
|
397
|
+
* Returns the identified user ID if user has been identified
|
|
398
|
+
*/
|
|
399
|
+
getUserId() {
|
|
400
|
+
return this.userId;
|
|
401
|
+
}
|
|
381
402
|
/**
|
|
382
403
|
* Get current funnel stage
|
|
383
404
|
*/
|
|
@@ -769,13 +790,19 @@ var AureaSDK = class {
|
|
|
769
790
|
title: document.title,
|
|
770
791
|
referrer: document.referrer
|
|
771
792
|
} : void 0,
|
|
772
|
-
utm: {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
793
|
+
utm: (() => {
|
|
794
|
+
const utm = {
|
|
795
|
+
source: url.searchParams.get("utm_source") || void 0,
|
|
796
|
+
medium: url.searchParams.get("utm_medium") || void 0,
|
|
797
|
+
campaign: url.searchParams.get("utm_campaign") || void 0,
|
|
798
|
+
term: url.searchParams.get("utm_term") || void 0,
|
|
799
|
+
content: url.searchParams.get("utm_content") || void 0
|
|
800
|
+
};
|
|
801
|
+
if (this.config.debug && (utm.source || utm.medium || utm.campaign)) {
|
|
802
|
+
console.log("[Aurea SDK] UTM params extracted from URL:", utm, "URL:", url.href);
|
|
803
|
+
}
|
|
804
|
+
return utm;
|
|
805
|
+
})(),
|
|
779
806
|
user: {
|
|
780
807
|
userId: this.userId,
|
|
781
808
|
anonymousId: this.anonymousId
|
|
@@ -887,6 +914,18 @@ var AureaSDK = class {
|
|
|
887
914
|
*/
|
|
888
915
|
async sendEvents(events) {
|
|
889
916
|
if (events.length === 0) return;
|
|
917
|
+
if (this.config.debug) {
|
|
918
|
+
events.forEach((evt) => {
|
|
919
|
+
if (evt.eventName === "page_view") {
|
|
920
|
+
console.log("[Aurea SDK] Sending page_view with UTM:", {
|
|
921
|
+
source: evt.context.utm?.source,
|
|
922
|
+
medium: evt.context.utm?.medium,
|
|
923
|
+
campaign: evt.context.utm?.campaign,
|
|
924
|
+
url: evt.context.page?.url
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
}
|
|
890
929
|
try {
|
|
891
930
|
const response = await fetch(`${this.config.apiUrl}/track/events`, {
|
|
892
931
|
method: "POST",
|