getu-attribution-v2-sdk 0.1.1 → 0.2.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.ts CHANGED
@@ -11,8 +11,27 @@ declare function trackSignup(tracking_user_id: string, signupData?: Record<strin
11
11
  declare function trackFormSubmit(tracking_user_id?: string, formData?: Record<string, any>): Promise<void>;
12
12
  declare function trackVideoPlay(tracking_user_id?: string, videoData?: Record<string, any>): Promise<void>;
13
13
  declare function trackEmailVerification(tracking_user_id: string, verificationData?: Record<string, any>): Promise<void>;
14
+ declare function trackPurchaseAuto(options: {
15
+ revenue: number;
16
+ currency?: Currency;
17
+ purchaseData?: Record<string, any>;
18
+ tracking_user_id?: string;
19
+ }): Promise<void>;
20
+ declare function trackLoginAuto(options: {
21
+ loginData?: Record<string, any>;
22
+ tracking_user_id?: string;
23
+ }): Promise<void>;
24
+ declare function trackSignupAuto(options: {
25
+ signupData?: Record<string, any>;
26
+ tracking_user_id?: string;
27
+ }): Promise<void>;
28
+ declare function trackEmailVerificationAuto(options: {
29
+ verificationData?: Record<string, any>;
30
+ tracking_user_id?: string;
31
+ }): Promise<void>;
14
32
  declare function trackProductView(tracking_user_id?: string, productData?: Record<string, any>): Promise<void>;
15
33
  declare function trackAddToCart(tracking_user_id?: string, cartData?: Record<string, any>): Promise<void>;
34
+ declare function trackPageClick(tracking_user_id?: string, clickData?: Record<string, any>): Promise<void>;
16
35
  declare function getAttributionData(): AttributionData | null;
17
36
  declare function flush(): Promise<void>;
18
37
  declare function getStatus(): {
@@ -31,6 +50,9 @@ declare function getStatus(): {
31
50
  } | null;
32
51
  declare function addUTMToURL(url: string): string;
33
52
  declare function getCurrentUTMParams(): Record<string, string>;
53
+ declare function setUserId(userId: string): void;
54
+ declare function getUserId(): string | null;
55
+ declare function removeUserId(): void;
34
56
  declare function destroy(): void;
35
57
  declare class AttributionSDKStatic extends AttributionSDK {
36
58
  static init(config: SDKConfig): Promise<AttributionSDK>;
@@ -42,8 +64,27 @@ declare class AttributionSDKStatic extends AttributionSDK {
42
64
  static trackFormSubmit(tracking_user_id?: string, formData?: Record<string, any>): Promise<void>;
43
65
  static trackVideoPlay(tracking_user_id?: string, videoData?: Record<string, any>): Promise<void>;
44
66
  static trackEmailVerification(tracking_user_id: string, verificationData?: Record<string, any>): Promise<void>;
67
+ static trackPurchaseAuto(options: {
68
+ revenue: number;
69
+ currency?: Currency;
70
+ purchaseData?: Record<string, any>;
71
+ tracking_user_id?: string;
72
+ }): Promise<void>;
73
+ static trackLoginAuto(options: {
74
+ loginData?: Record<string, any>;
75
+ tracking_user_id?: string;
76
+ }): Promise<void>;
77
+ static trackSignupAuto(options: {
78
+ signupData?: Record<string, any>;
79
+ tracking_user_id?: string;
80
+ }): Promise<void>;
81
+ static trackEmailVerificationAuto(options: {
82
+ verificationData?: Record<string, any>;
83
+ tracking_user_id?: string;
84
+ }): Promise<void>;
45
85
  static trackProductView(tracking_user_id?: string, productData?: Record<string, any>): Promise<void>;
46
86
  static trackAddToCart(tracking_user_id?: string, cartData?: Record<string, any>): Promise<void>;
87
+ static trackPageClick(tracking_user_id?: string, clickData?: Record<string, any>): Promise<void>;
47
88
  static getAttributionData(): AttributionData | null;
48
89
  static flush(): Promise<void>;
49
90
  static getStatus(): {
@@ -62,12 +103,15 @@ declare class AttributionSDKStatic extends AttributionSDK {
62
103
  } | null;
63
104
  static addUTMToURL(url: string): string;
64
105
  static getCurrentUTMParams(): Record<string, string>;
106
+ static setUserId(userId: string): void;
107
+ static getUserId(): string | null;
108
+ static removeUserId(): void;
65
109
  static destroy(): void;
66
110
  static getSDK(): AttributionSDK | null;
67
111
  static waitForSDK(): Promise<AttributionSDK>;
68
112
  }
69
113
  export { EventType, Currency, type SDKConfig, type EventData, type AttributionData, };
70
- export { init, getSDK, waitForSDK, trackEvent, trackPageView, trackPurchase, trackLogin, trackSignup, trackFormSubmit, trackVideoPlay, trackEmailVerification, trackProductView, trackAddToCart, getAttributionData, flush, getStatus, addUTMToURL, getCurrentUTMParams, destroy, };
114
+ export { init, getSDK, waitForSDK, trackEvent, trackPageView, trackPageClick, trackPurchase, trackLogin, trackSignup, trackFormSubmit, trackVideoPlay, trackEmailVerification, trackProductView, trackAddToCart, trackPurchaseAuto, trackLoginAuto, trackSignupAuto, trackEmailVerificationAuto, getAttributionData, flush, getStatus, addUTMToURL, getCurrentUTMParams, setUserId, getUserId, removeUserId, destroy, };
71
115
  export { AttributionSDKStatic as AttributionSDK };
72
116
  declare const _default: {
73
117
  init: typeof init;
@@ -75,6 +119,7 @@ declare const _default: {
75
119
  waitForSDK: typeof waitForSDK;
76
120
  trackEvent: typeof trackEvent;
77
121
  trackPageView: typeof trackPageView;
122
+ trackPageClick: typeof trackPageClick;
78
123
  trackPurchase: typeof trackPurchase;
79
124
  trackLogin: typeof trackLogin;
80
125
  trackSignup: typeof trackSignup;
@@ -83,11 +128,18 @@ declare const _default: {
83
128
  trackEmailVerification: typeof trackEmailVerification;
84
129
  trackProductView: typeof trackProductView;
85
130
  trackAddToCart: typeof trackAddToCart;
131
+ trackPurchaseAuto: typeof trackPurchaseAuto;
132
+ trackLoginAuto: typeof trackLoginAuto;
133
+ trackSignupAuto: typeof trackSignupAuto;
134
+ trackEmailVerificationAuto: typeof trackEmailVerificationAuto;
86
135
  getAttributionData: typeof getAttributionData;
87
136
  flush: typeof flush;
88
137
  getStatus: typeof getStatus;
89
138
  addUTMToURL: typeof addUTMToURL;
90
139
  getCurrentUTMParams: typeof getCurrentUTMParams;
140
+ setUserId: typeof setUserId;
141
+ getUserId: typeof getUserId;
142
+ removeUserId: typeof removeUserId;
91
143
  destroy: typeof destroy;
92
144
  EventType: typeof EventType;
93
145
  Currency: typeof Currency;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,SAAS,EACT,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,OAAO,EACL,SAAS,EACT,QAAQ,EACR,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,eAAe,GACrB,CAAC;AAGF,OAAO,EACL,IAAI,EACJ,MAAM,EACN,UAAU,EACV,UAAU,EACV,aAAa,EACb,cAAc,EACd,aAAa,EACb,UAAU,EACV,WAAW,EACX,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,0BAA0B,EAC1B,kBAAkB,EAClB,KAAK,EACL,SAAS,EACT,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,SAAS,EACT,YAAY,EACZ,OAAO,GACR,CAAC;AAGF,OAAO,EAAE,oBAAoB,IAAI,cAAc,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2ElD,wBA+BE"}
package/dist/index.esm.js CHANGED
@@ -3,6 +3,7 @@ var EventType;
3
3
  (function (EventType) {
4
4
  // Pre-conversion signals
5
5
  EventType["PAGE_VIEW"] = "page_view";
6
+ EventType["PAGE_CLICK"] = "page_click";
6
7
  EventType["VIDEO_PLAY"] = "video_play";
7
8
  // Registration funnel
8
9
  EventType["FORM_SUBMIT"] = "form_submit";
@@ -549,10 +550,131 @@ class AttributionStorageManager {
549
550
  constructor(logger) {
550
551
  this.UTM_STORAGE_KEY = "attribution_utm_data";
551
552
  this.SESSION_STORAGE_KEY = "attribution_session";
553
+ this.USER_ID_KEY = "getuai_user_id";
554
+ this.USER_ID_COOKIE_EXPIRES = 365; // days
552
555
  this.logger = logger;
553
556
  this.localStorage = new LocalStorageManager(logger);
554
557
  this.indexedDB = new IndexedDBManager(logger);
555
558
  }
559
+ // User ID management - stores in both cookie and localStorage
560
+ setUserId(userId) {
561
+ if (!userId || userId.trim() === "") {
562
+ this.logger.warn("Cannot set empty user ID");
563
+ return;
564
+ }
565
+ const trimmedUserId = userId.trim();
566
+ // Store in cookie
567
+ try {
568
+ this.setCookie(this.USER_ID_KEY, trimmedUserId, this.USER_ID_COOKIE_EXPIRES);
569
+ this.logger.debug(`👤 User ID stored in cookie: ${trimmedUserId}`);
570
+ }
571
+ catch (error) {
572
+ this.logger.error("Failed to store user ID in cookie:", error);
573
+ }
574
+ // Store in localStorage
575
+ try {
576
+ if (typeof localStorage !== "undefined") {
577
+ localStorage.setItem(this.USER_ID_KEY, trimmedUserId);
578
+ this.logger.debug(`👤 User ID stored in localStorage: ${trimmedUserId}`);
579
+ }
580
+ }
581
+ catch (error) {
582
+ this.logger.error("Failed to store user ID in localStorage:", error);
583
+ }
584
+ }
585
+ getUserId() {
586
+ // Try localStorage first
587
+ try {
588
+ if (typeof localStorage !== "undefined") {
589
+ const userId = localStorage.getItem(this.USER_ID_KEY);
590
+ if (userId) {
591
+ return userId;
592
+ }
593
+ }
594
+ }
595
+ catch (error) {
596
+ this.logger.debug("Failed to get user ID from localStorage:", error);
597
+ }
598
+ // Fallback to cookie
599
+ try {
600
+ const userId = this.getCookie(this.USER_ID_KEY);
601
+ if (userId) {
602
+ // Sync back to localStorage if cookie exists but localStorage doesn't
603
+ try {
604
+ if (typeof localStorage !== "undefined") {
605
+ localStorage.setItem(this.USER_ID_KEY, userId);
606
+ }
607
+ }
608
+ catch (error) {
609
+ // Ignore sync errors
610
+ }
611
+ return userId;
612
+ }
613
+ }
614
+ catch (error) {
615
+ this.logger.debug("Failed to get user ID from cookie:", error);
616
+ }
617
+ return null;
618
+ }
619
+ removeUserId() {
620
+ // Remove from cookie
621
+ try {
622
+ this.deleteCookie(this.USER_ID_KEY);
623
+ this.logger.debug("👤 User ID removed from cookie");
624
+ }
625
+ catch (error) {
626
+ this.logger.error("Failed to remove user ID from cookie:", error);
627
+ }
628
+ // Remove from localStorage
629
+ try {
630
+ if (typeof localStorage !== "undefined") {
631
+ localStorage.removeItem(this.USER_ID_KEY);
632
+ this.logger.debug("👤 User ID removed from localStorage");
633
+ }
634
+ }
635
+ catch (error) {
636
+ this.logger.error("Failed to remove user ID from localStorage:", error);
637
+ }
638
+ }
639
+ // Cookie helper methods
640
+ setCookie(name, value, days) {
641
+ try {
642
+ const expires = new Date();
643
+ expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000);
644
+ const cookieValue = `${name}=${encodeURIComponent(value)};expires=${expires.toUTCString()};path=/;SameSite=Lax`;
645
+ document.cookie = cookieValue;
646
+ }
647
+ catch (error) {
648
+ this.logger.error("Failed to set cookie:", error);
649
+ }
650
+ }
651
+ getCookie(name) {
652
+ try {
653
+ const nameEQ = name + "=";
654
+ const ca = document.cookie.split(";");
655
+ for (let i = 0; i < ca.length; i++) {
656
+ let c = ca[i];
657
+ while (c.charAt(0) === " ")
658
+ c = c.substring(1, c.length);
659
+ if (c.indexOf(nameEQ) === 0) {
660
+ return decodeURIComponent(c.substring(nameEQ.length, c.length));
661
+ }
662
+ }
663
+ return null;
664
+ }
665
+ catch (error) {
666
+ this.logger.error("Failed to get cookie:", error);
667
+ return null;
668
+ }
669
+ }
670
+ deleteCookie(name) {
671
+ try {
672
+ document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;`;
673
+ }
674
+ catch (error) {
675
+ this.logger.error("Failed to delete cookie:", error);
676
+ }
677
+ }
556
678
  async init() {
557
679
  await this.indexedDB.init();
558
680
  }
@@ -637,6 +759,12 @@ class AttributionStorageManager {
637
759
  }
638
760
  }
639
761
 
762
+ /**
763
+ * SDK Version
764
+ * This version should match the version in package.json
765
+ */
766
+ const SDK_VERSION = "2.0.0";
767
+
640
768
  class EventQueueManager {
641
769
  constructor(logger, apiKey, apiEndpoint, batchSize = 100, batchInterval = 2000, maxRetries = 3, retryDelay = 1000, sendEvents) {
642
770
  this.queue = [];
@@ -774,7 +902,10 @@ class EventHttpClient {
774
902
  context: event.context || null,
775
903
  timestamp: event.timestamp || getTimestamp(), // Convert to seconds
776
904
  }));
777
- const batchRequest = { events: transformedEvents };
905
+ const batchRequest = {
906
+ events: transformedEvents,
907
+ sdk_version: SDK_VERSION,
908
+ };
778
909
  await retry(async () => {
779
910
  const response = await fetch(`${this.apiEndpoint}/attribution/events`, {
780
911
  method: "POST",
@@ -862,8 +993,17 @@ class AttributionSDK {
862
993
  }
863
994
  try {
864
995
  this.logger.info("Initializing GetuAI Attribution SDK");
865
- // Initialize storage
866
- await this.storage.init();
996
+ // Initialize storage (IndexedDB failure should not block SDK initialization)
997
+ try {
998
+ await this.storage.init();
999
+ }
1000
+ catch (storageError) {
1001
+ this.logger.warn("Storage initialization failed (IndexedDB may be unavailable), continuing with basic features:", storageError);
1002
+ // Continue initialization even if IndexedDB fails
1003
+ // User ID and other features using cookie/localStorage will still work
1004
+ }
1005
+ // Initialize user ID (from config or existing storage)
1006
+ this.initializeUserId();
867
1007
  // Initialize session
868
1008
  this.initializeSession();
869
1009
  // Extract and store UTM data from current URL
@@ -936,10 +1076,12 @@ class AttributionSDK {
936
1076
  last_activity: this.session?.lastActivity,
937
1077
  page_views: this.session?.pageViews,
938
1078
  };
1079
+ // Use provided tracking_user_id or fallback to stored user ID
1080
+ const finalUserId = tracking_user_id || this.getUserId();
939
1081
  const event = {
940
1082
  event_id: generateId(),
941
1083
  event_type: eventType,
942
- tracking_user_id: tracking_user_id,
1084
+ tracking_user_id: finalUserId || undefined,
943
1085
  timestamp: getTimestamp(),
944
1086
  event_data: eventData,
945
1087
  context: { page: pageContext, session: sessionContext },
@@ -1036,6 +1178,42 @@ class AttributionSDK {
1036
1178
  async trackEmailVerification(tracking_user_id, verificationData) {
1037
1179
  await this.trackEvent(EventType.EMAIL_VERIFICATION, verificationData, tracking_user_id);
1038
1180
  }
1181
+ // Track purchase with auto user ID (object parameter format)
1182
+ async trackPurchaseAuto(options) {
1183
+ const userId = options.tracking_user_id || this.getUserId();
1184
+ if (!userId) {
1185
+ this.logger.error("❌ trackPurchaseAuto requires tracking_user_id. Please set user ID using setUserId() or pass it in options.tracking_user_id.");
1186
+ return;
1187
+ }
1188
+ await this.trackEvent(EventType.PURCHASE, options.purchaseData, userId, options.revenue, options.currency || Currency.USD);
1189
+ }
1190
+ // Track login with auto user ID (object parameter format)
1191
+ async trackLoginAuto(options) {
1192
+ const userId = options.tracking_user_id || this.getUserId();
1193
+ if (!userId) {
1194
+ this.logger.error("❌ trackLoginAuto requires tracking_user_id. Please set user ID using setUserId() or pass it in options.tracking_user_id.");
1195
+ return;
1196
+ }
1197
+ await this.trackEvent(EventType.LOGIN, options.loginData, userId);
1198
+ }
1199
+ // Track signup with auto user ID (object parameter format)
1200
+ async trackSignupAuto(options) {
1201
+ const userId = options.tracking_user_id || this.getUserId();
1202
+ if (!userId) {
1203
+ this.logger.error("❌ trackSignupAuto requires tracking_user_id. Please set user ID using setUserId() or pass it in options.tracking_user_id.");
1204
+ return;
1205
+ }
1206
+ await this.trackEvent(EventType.SIGNUP, options.signupData, userId);
1207
+ }
1208
+ // Track email verification with auto user ID (object parameter format)
1209
+ async trackEmailVerificationAuto(options) {
1210
+ const userId = options.tracking_user_id || this.getUserId();
1211
+ if (!userId) {
1212
+ this.logger.error("❌ trackEmailVerificationAuto requires tracking_user_id. Please set user ID using setUserId() or pass it in options.tracking_user_id.");
1213
+ return;
1214
+ }
1215
+ await this.trackEvent(EventType.EMAIL_VERIFICATION, options.verificationData, userId);
1216
+ }
1039
1217
  // Track product view
1040
1218
  async trackProductView(tracking_user_id, productData) {
1041
1219
  await this.trackEvent(EventType.PRODUCT_VIEW, productData, tracking_user_id);
@@ -1044,6 +1222,10 @@ class AttributionSDK {
1044
1222
  async trackAddToCart(tracking_user_id, cartData) {
1045
1223
  await this.trackEvent(EventType.ADD_TO_CART, cartData, tracking_user_id);
1046
1224
  }
1225
+ // Track page click for user click journey
1226
+ async trackPageClick(tracking_user_id, clickData) {
1227
+ await this.trackEvent(EventType.PAGE_CLICK, clickData, tracking_user_id);
1228
+ }
1047
1229
  // Get attribution data
1048
1230
  getAttributionData() {
1049
1231
  return this.storage.getUTMData();
@@ -1117,6 +1299,42 @@ class AttributionSDK {
1117
1299
  this.logger.debug("UTM params for event:", filteredParams);
1118
1300
  return filteredParams;
1119
1301
  }
1302
+ // Initialize user ID
1303
+ initializeUserId() {
1304
+ // If userId is provided in config, set it (will override existing)
1305
+ if (this.config.userId) {
1306
+ this.setUserId(this.config.userId);
1307
+ this.logger.info(`👤 User ID initialized from config: ${this.config.userId}`);
1308
+ }
1309
+ else {
1310
+ // Check if user ID already exists in storage
1311
+ const existingUserId = this.getUserId();
1312
+ if (existingUserId) {
1313
+ this.logger.debug(`👤 Existing user ID found: ${existingUserId}`);
1314
+ }
1315
+ else {
1316
+ this.logger.debug("👤 No user ID found, will be set when user identifies");
1317
+ }
1318
+ }
1319
+ }
1320
+ // Set user ID
1321
+ setUserId(userId) {
1322
+ if (!userId || userId.trim() === "") {
1323
+ this.logger.warn("Cannot set empty user ID");
1324
+ return;
1325
+ }
1326
+ this.storage.setUserId(userId);
1327
+ this.logger.info(`👤 User ID set: ${userId}`);
1328
+ }
1329
+ // Get user ID
1330
+ getUserId() {
1331
+ return this.storage.getUserId();
1332
+ }
1333
+ // Remove user ID
1334
+ removeUserId() {
1335
+ this.storage.removeUserId();
1336
+ this.logger.info("👤 User ID removed");
1337
+ }
1120
1338
  // Initialize user session
1121
1339
  initializeSession() {
1122
1340
  const existingSession = this.storage.getSession();
@@ -1566,6 +1784,7 @@ function autoInit() {
1566
1784
  autoCleanUTM: script.getAttribute("data-auto-clean-utm") !== "false",
1567
1785
  batchSize: parseInt(script.getAttribute("data-batch-size") || "100"),
1568
1786
  batchInterval: parseInt(script.getAttribute("data-batch-interval") || "2000"),
1787
+ userId: script.getAttribute("data-user-id") || undefined,
1569
1788
  };
1570
1789
  // Initialize SDK
1571
1790
  init(config);
@@ -1709,6 +1928,42 @@ async function trackEmailVerification(tracking_user_id, verificationData) {
1709
1928
  }
1710
1929
  await sdk.trackEmailVerification(tracking_user_id, verificationData);
1711
1930
  }
1931
+ // Track purchase with auto user ID (object parameter format)
1932
+ async function trackPurchaseAuto(options) {
1933
+ const sdk = getSDK();
1934
+ if (!sdk) {
1935
+ console.warn("GetuAI SDK: Not initialized. Call init() first.");
1936
+ return;
1937
+ }
1938
+ await sdk.trackPurchaseAuto(options);
1939
+ }
1940
+ // Track login with auto user ID (object parameter format)
1941
+ async function trackLoginAuto(options) {
1942
+ const sdk = getSDK();
1943
+ if (!sdk) {
1944
+ console.warn("GetuAI SDK: Not initialized. Call init() first.");
1945
+ return;
1946
+ }
1947
+ await sdk.trackLoginAuto(options);
1948
+ }
1949
+ // Track signup with auto user ID (object parameter format)
1950
+ async function trackSignupAuto(options) {
1951
+ const sdk = getSDK();
1952
+ if (!sdk) {
1953
+ console.warn("GetuAI SDK: Not initialized. Call init() first.");
1954
+ return;
1955
+ }
1956
+ await sdk.trackSignupAuto(options);
1957
+ }
1958
+ // Track email verification with auto user ID (object parameter format)
1959
+ async function trackEmailVerificationAuto(options) {
1960
+ const sdk = getSDK();
1961
+ if (!sdk) {
1962
+ console.warn("GetuAI SDK: Not initialized. Call init() first.");
1963
+ return;
1964
+ }
1965
+ await sdk.trackEmailVerificationAuto(options);
1966
+ }
1712
1967
  // Track product view
1713
1968
  async function trackProductView(tracking_user_id, productData) {
1714
1969
  const sdk = getSDK();
@@ -1727,6 +1982,15 @@ async function trackAddToCart(tracking_user_id, cartData) {
1727
1982
  }
1728
1983
  await sdk.trackAddToCart(tracking_user_id, cartData);
1729
1984
  }
1985
+ // Track page click for user click journey
1986
+ async function trackPageClick(tracking_user_id, clickData) {
1987
+ const sdk = getSDK();
1988
+ if (!sdk) {
1989
+ console.warn("GetuAI SDK: Not initialized. Call init() first.");
1990
+ return;
1991
+ }
1992
+ await sdk.trackPageClick(tracking_user_id, clickData);
1993
+ }
1730
1994
  // Get attribution data
1731
1995
  function getAttributionData() {
1732
1996
  const sdk = getSDK();
@@ -1769,6 +2033,33 @@ function getCurrentUTMParams() {
1769
2033
  }
1770
2034
  return sdk.getCurrentUTMParams();
1771
2035
  }
2036
+ // Set user ID
2037
+ function setUserId(userId) {
2038
+ const sdk = getSDK();
2039
+ if (!sdk) {
2040
+ console.warn("GetuAI SDK: Not initialized. Call init() first.");
2041
+ return;
2042
+ }
2043
+ sdk.setUserId(userId);
2044
+ }
2045
+ // Get user ID
2046
+ function getUserId() {
2047
+ const sdk = getSDK();
2048
+ if (!sdk) {
2049
+ console.warn("GetuAI SDK: Not initialized. Call init() first.");
2050
+ return null;
2051
+ }
2052
+ return sdk.getUserId();
2053
+ }
2054
+ // Remove user ID
2055
+ function removeUserId() {
2056
+ const sdk = getSDK();
2057
+ if (!sdk) {
2058
+ console.warn("GetuAI SDK: Not initialized. Call init() first.");
2059
+ return;
2060
+ }
2061
+ sdk.removeUserId();
2062
+ }
1772
2063
  // Destroy SDK
1773
2064
  function destroy() {
1774
2065
  if (globalSDK) {
@@ -1815,6 +2106,22 @@ class AttributionSDKStatic extends AttributionSDK {
1815
2106
  static async trackEmailVerification(tracking_user_id, verificationData) {
1816
2107
  return await trackEmailVerification(tracking_user_id, verificationData);
1817
2108
  }
2109
+ // Static method to track purchase with auto user ID
2110
+ static async trackPurchaseAuto(options) {
2111
+ return await trackPurchaseAuto(options);
2112
+ }
2113
+ // Static method to track login with auto user ID
2114
+ static async trackLoginAuto(options) {
2115
+ return await trackLoginAuto(options);
2116
+ }
2117
+ // Static method to track signup with auto user ID
2118
+ static async trackSignupAuto(options) {
2119
+ return await trackSignupAuto(options);
2120
+ }
2121
+ // Static method to track email verification with auto user ID
2122
+ static async trackEmailVerificationAuto(options) {
2123
+ return await trackEmailVerificationAuto(options);
2124
+ }
1818
2125
  // Static method to track product view
1819
2126
  static async trackProductView(tracking_user_id, productData) {
1820
2127
  return await trackProductView(tracking_user_id, productData);
@@ -1823,6 +2130,10 @@ class AttributionSDKStatic extends AttributionSDK {
1823
2130
  static async trackAddToCart(tracking_user_id, cartData) {
1824
2131
  return await trackAddToCart(tracking_user_id, cartData);
1825
2132
  }
2133
+ // Static method to track page click
2134
+ static async trackPageClick(tracking_user_id, clickData) {
2135
+ return await trackPageClick(tracking_user_id, clickData);
2136
+ }
1826
2137
  // Static method to get attribution data
1827
2138
  static getAttributionData() {
1828
2139
  return getAttributionData();
@@ -1843,6 +2154,18 @@ class AttributionSDKStatic extends AttributionSDK {
1843
2154
  static getCurrentUTMParams() {
1844
2155
  return getCurrentUTMParams();
1845
2156
  }
2157
+ // Static method to set user ID
2158
+ static setUserId(userId) {
2159
+ setUserId(userId);
2160
+ }
2161
+ // Static method to get user ID
2162
+ static getUserId() {
2163
+ return getUserId();
2164
+ }
2165
+ // Static method to remove user ID
2166
+ static removeUserId() {
2167
+ removeUserId();
2168
+ }
1846
2169
  // Static method to destroy SDK
1847
2170
  static destroy() {
1848
2171
  destroy();
@@ -1870,6 +2193,7 @@ if (typeof window !== "undefined") {
1870
2193
  waitForSDK,
1871
2194
  trackEvent,
1872
2195
  trackPageView,
2196
+ trackPageClick,
1873
2197
  trackPurchase,
1874
2198
  trackLogin,
1875
2199
  trackSignup,
@@ -1878,11 +2202,18 @@ if (typeof window !== "undefined") {
1878
2202
  trackEmailVerification,
1879
2203
  trackProductView,
1880
2204
  trackAddToCart,
2205
+ trackPurchaseAuto,
2206
+ trackLoginAuto,
2207
+ trackSignupAuto,
2208
+ trackEmailVerificationAuto,
1881
2209
  getAttributionData,
1882
2210
  flush,
1883
2211
  getStatus,
1884
2212
  addUTMToURL,
1885
2213
  getCurrentUTMParams,
2214
+ setUserId,
2215
+ getUserId,
2216
+ removeUserId,
1886
2217
  destroy,
1887
2218
  EventType,
1888
2219
  Currency,
@@ -1893,6 +2224,7 @@ if (typeof window !== "undefined") {
1893
2224
  window.waitForSDK = waitForSDK;
1894
2225
  window.trackEvent = trackEvent;
1895
2226
  window.trackPageView = trackPageView;
2227
+ window.trackPageClick = trackPageClick;
1896
2228
  window.trackPurchase = trackPurchase;
1897
2229
  window.trackLogin = trackLogin;
1898
2230
  window.trackSignup = trackSignup;
@@ -1901,11 +2233,18 @@ if (typeof window !== "undefined") {
1901
2233
  window.trackEmailVerification = trackEmailVerification;
1902
2234
  window.trackProductView = trackProductView;
1903
2235
  window.trackAddToCart = trackAddToCart;
2236
+ window.trackPurchaseAuto = trackPurchaseAuto;
2237
+ window.trackLoginAuto = trackLoginAuto;
2238
+ window.trackSignupAuto = trackSignupAuto;
2239
+ window.trackEmailVerificationAuto = trackEmailVerificationAuto;
1904
2240
  window.getAttributionData = getAttributionData;
1905
2241
  window.flush = flush;
1906
2242
  window.getStatus = getStatus;
1907
2243
  window.addUTMToURL = addUTMToURL;
1908
2244
  window.getCurrentUTMParams = getCurrentUTMParams;
2245
+ window.setUserId = setUserId;
2246
+ window.getUserId = getUserId;
2247
+ window.removeUserId = removeUserId;
1909
2248
  window.destroy = destroy;
1910
2249
  window.AttributionSDK = AttributionSDKStatic; // 直接暴露带静态方法的AttributionSDK类
1911
2250
  }
@@ -1916,6 +2255,7 @@ var index = {
1916
2255
  waitForSDK,
1917
2256
  trackEvent,
1918
2257
  trackPageView,
2258
+ trackPageClick,
1919
2259
  trackPurchase,
1920
2260
  trackLogin,
1921
2261
  trackSignup,
@@ -1924,16 +2264,23 @@ var index = {
1924
2264
  trackEmailVerification,
1925
2265
  trackProductView,
1926
2266
  trackAddToCart,
2267
+ trackPurchaseAuto,
2268
+ trackLoginAuto,
2269
+ trackSignupAuto,
2270
+ trackEmailVerificationAuto,
1927
2271
  getAttributionData,
1928
2272
  flush,
1929
2273
  getStatus,
1930
2274
  addUTMToURL,
1931
2275
  getCurrentUTMParams,
2276
+ setUserId,
2277
+ getUserId,
2278
+ removeUserId,
1932
2279
  destroy,
1933
2280
  EventType,
1934
2281
  Currency,
1935
2282
  AttributionSDK: AttributionSDKStatic, // 包含带静态方法的AttributionSDK类
1936
2283
  };
1937
2284
 
1938
- export { AttributionSDKStatic as AttributionSDK, Currency, EventType, addUTMToURL, index as default, destroy, flush, getAttributionData, getCurrentUTMParams, getSDK, getStatus, init, trackAddToCart, trackEmailVerification, trackEvent, trackFormSubmit, trackLogin, trackPageView, trackProductView, trackPurchase, trackSignup, trackVideoPlay, waitForSDK };
2285
+ export { AttributionSDKStatic as AttributionSDK, Currency, EventType, addUTMToURL, index as default, destroy, flush, getAttributionData, getCurrentUTMParams, getSDK, getStatus, getUserId, init, removeUserId, setUserId, trackAddToCart, trackEmailVerification, trackEmailVerificationAuto, trackEvent, trackFormSubmit, trackLogin, trackLoginAuto, trackPageClick, trackPageView, trackProductView, trackPurchase, trackPurchaseAuto, trackSignup, trackSignupAuto, trackVideoPlay, waitForSDK };
1939
2286
  //# sourceMappingURL=index.esm.js.map