aurea-tracking-sdk 1.5.1 → 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.js +25 -7
- package/dist/index.mjs +25 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -819,13 +819,19 @@ var AureaSDK = class {
|
|
|
819
819
|
title: document.title,
|
|
820
820
|
referrer: document.referrer
|
|
821
821
|
} : void 0,
|
|
822
|
-
utm: {
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
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
|
+
})(),
|
|
829
835
|
user: {
|
|
830
836
|
userId: this.userId,
|
|
831
837
|
anonymousId: this.anonymousId
|
|
@@ -937,6 +943,18 @@ var AureaSDK = class {
|
|
|
937
943
|
*/
|
|
938
944
|
async sendEvents(events) {
|
|
939
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
|
+
}
|
|
940
958
|
try {
|
|
941
959
|
const response = await fetch(`${this.config.apiUrl}/track/events`, {
|
|
942
960
|
method: "POST",
|
package/dist/index.mjs
CHANGED
|
@@ -790,13 +790,19 @@ var AureaSDK = class {
|
|
|
790
790
|
title: document.title,
|
|
791
791
|
referrer: document.referrer
|
|
792
792
|
} : void 0,
|
|
793
|
-
utm: {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
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
|
+
})(),
|
|
800
806
|
user: {
|
|
801
807
|
userId: this.userId,
|
|
802
808
|
anonymousId: this.anonymousId
|
|
@@ -908,6 +914,18 @@ var AureaSDK = class {
|
|
|
908
914
|
*/
|
|
909
915
|
async sendEvents(events) {
|
|
910
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
|
+
}
|
|
911
929
|
try {
|
|
912
930
|
const response = await fetch(`${this.config.apiUrl}/track/events`, {
|
|
913
931
|
method: "POST",
|