getu-attribution-v2-sdk 0.2.1 → 0.2.3
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 +209 -13
- package/dist/core/AttributionSDK.d.ts +23 -0
- package/dist/core/AttributionSDK.d.ts.map +1 -1
- package/dist/core/AttributionSDK.js +90 -3
- package/dist/getuai-attribution.min.js +1 -1
- package/dist/index.d.ts +51 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +338 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +338 -4
- package/dist/storage/index.d.ts +8 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +121 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
39
39
|
"default": () => (/* binding */ src)
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
// UNUSED EXPORTS: AttributionSDK, Currency, EventType, addUTMToURL, destroy, flush, getAttributionData, getCurrentUTMParams, getSDK, getStatus, init, trackAddToCart, trackEmailVerification, trackEvent, trackFormSubmit, trackLogin, trackPageClick, trackPageView, trackProductView, trackPurchase, trackSignup, trackVideoPlay, waitForSDK
|
|
42
|
+
// UNUSED EXPORTS: AttributionSDK, Currency, EventType, addUTMToURL, destroy, flush, getAttributionData, getCurrentUTMParams, getSDK, getStatus, getUserId, init, removeUserId, setUserId, trackAddToCart, trackAuditApproved, trackEmailVerification, trackEmailVerificationAuto, trackEvent, trackFormSubmit, trackLogin, trackLoginAuto, trackPageClick, trackPageView, trackProductView, trackPurchase, trackPurchaseAuto, trackSignup, trackSignupAuto, trackVideoPlay, waitForSDK
|
|
43
43
|
|
|
44
44
|
;// ./src/types/index.ts
|
|
45
45
|
// Event types matching server-side enum exactly
|
|
@@ -60,6 +60,8 @@ var EventType;
|
|
|
60
60
|
EventType["PRODUCT_VIEW"] = "product_view";
|
|
61
61
|
EventType["ADD_TO_CART"] = "add_to_cart";
|
|
62
62
|
EventType["PURCHASE"] = "purchase";
|
|
63
|
+
// Post-conversion / back-office conversion
|
|
64
|
+
EventType["AUDIT_APPROVED"] = "audit_approved";
|
|
63
65
|
})(EventType || (EventType = {}));
|
|
64
66
|
// Currency types
|
|
65
67
|
var Currency;
|
|
@@ -74,6 +76,7 @@ const IMMEDIATE_EVENTS = [
|
|
|
74
76
|
EventType.SIGNUP,
|
|
75
77
|
EventType.FORM_SUBMIT,
|
|
76
78
|
EventType.EMAIL_VERIFICATION,
|
|
79
|
+
EventType.AUDIT_APPROVED,
|
|
77
80
|
];
|
|
78
81
|
|
|
79
82
|
;// ./src/utils/index.ts
|
|
@@ -652,10 +655,131 @@ class AttributionStorageManager {
|
|
|
652
655
|
constructor(logger) {
|
|
653
656
|
this.UTM_STORAGE_KEY = "attribution_utm_data";
|
|
654
657
|
this.SESSION_STORAGE_KEY = "attribution_session";
|
|
658
|
+
this.USER_ID_KEY = "getuai_user_id";
|
|
659
|
+
this.USER_ID_COOKIE_EXPIRES = 365; // days
|
|
655
660
|
this.logger = logger;
|
|
656
661
|
this.localStorage = new LocalStorageManager(logger);
|
|
657
662
|
this.indexedDB = new IndexedDBManager(logger);
|
|
658
663
|
}
|
|
664
|
+
// User ID management - stores in both cookie and localStorage
|
|
665
|
+
setUserId(userId) {
|
|
666
|
+
if (!userId || userId.trim() === "") {
|
|
667
|
+
this.logger.warn("Cannot set empty user ID");
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
const trimmedUserId = userId.trim();
|
|
671
|
+
// Store in cookie
|
|
672
|
+
try {
|
|
673
|
+
this.setCookie(this.USER_ID_KEY, trimmedUserId, this.USER_ID_COOKIE_EXPIRES);
|
|
674
|
+
this.logger.debug(`👤 User ID stored in cookie: ${trimmedUserId}`);
|
|
675
|
+
}
|
|
676
|
+
catch (error) {
|
|
677
|
+
this.logger.error("Failed to store user ID in cookie:", error);
|
|
678
|
+
}
|
|
679
|
+
// Store in localStorage
|
|
680
|
+
try {
|
|
681
|
+
if (typeof localStorage !== "undefined") {
|
|
682
|
+
localStorage.setItem(this.USER_ID_KEY, trimmedUserId);
|
|
683
|
+
this.logger.debug(`👤 User ID stored in localStorage: ${trimmedUserId}`);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
catch (error) {
|
|
687
|
+
this.logger.error("Failed to store user ID in localStorage:", error);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
getUserId() {
|
|
691
|
+
// Try localStorage first
|
|
692
|
+
try {
|
|
693
|
+
if (typeof localStorage !== "undefined") {
|
|
694
|
+
const userId = localStorage.getItem(this.USER_ID_KEY);
|
|
695
|
+
if (userId) {
|
|
696
|
+
return userId;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
catch (error) {
|
|
701
|
+
this.logger.debug("Failed to get user ID from localStorage:", error);
|
|
702
|
+
}
|
|
703
|
+
// Fallback to cookie
|
|
704
|
+
try {
|
|
705
|
+
const userId = this.getCookie(this.USER_ID_KEY);
|
|
706
|
+
if (userId) {
|
|
707
|
+
// Sync back to localStorage if cookie exists but localStorage doesn't
|
|
708
|
+
try {
|
|
709
|
+
if (typeof localStorage !== "undefined") {
|
|
710
|
+
localStorage.setItem(this.USER_ID_KEY, userId);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
catch (error) {
|
|
714
|
+
// Ignore sync errors
|
|
715
|
+
}
|
|
716
|
+
return userId;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
catch (error) {
|
|
720
|
+
this.logger.debug("Failed to get user ID from cookie:", error);
|
|
721
|
+
}
|
|
722
|
+
return null;
|
|
723
|
+
}
|
|
724
|
+
removeUserId() {
|
|
725
|
+
// Remove from cookie
|
|
726
|
+
try {
|
|
727
|
+
this.deleteCookie(this.USER_ID_KEY);
|
|
728
|
+
this.logger.debug("👤 User ID removed from cookie");
|
|
729
|
+
}
|
|
730
|
+
catch (error) {
|
|
731
|
+
this.logger.error("Failed to remove user ID from cookie:", error);
|
|
732
|
+
}
|
|
733
|
+
// Remove from localStorage
|
|
734
|
+
try {
|
|
735
|
+
if (typeof localStorage !== "undefined") {
|
|
736
|
+
localStorage.removeItem(this.USER_ID_KEY);
|
|
737
|
+
this.logger.debug("👤 User ID removed from localStorage");
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
catch (error) {
|
|
741
|
+
this.logger.error("Failed to remove user ID from localStorage:", error);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
// Cookie helper methods
|
|
745
|
+
setCookie(name, value, days) {
|
|
746
|
+
try {
|
|
747
|
+
const expires = new Date();
|
|
748
|
+
expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000);
|
|
749
|
+
const cookieValue = `${name}=${encodeURIComponent(value)};expires=${expires.toUTCString()};path=/;SameSite=Lax`;
|
|
750
|
+
document.cookie = cookieValue;
|
|
751
|
+
}
|
|
752
|
+
catch (error) {
|
|
753
|
+
this.logger.error("Failed to set cookie:", error);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
getCookie(name) {
|
|
757
|
+
try {
|
|
758
|
+
const nameEQ = name + "=";
|
|
759
|
+
const ca = document.cookie.split(";");
|
|
760
|
+
for (let i = 0; i < ca.length; i++) {
|
|
761
|
+
let c = ca[i];
|
|
762
|
+
while (c.charAt(0) === " ")
|
|
763
|
+
c = c.substring(1, c.length);
|
|
764
|
+
if (c.indexOf(nameEQ) === 0) {
|
|
765
|
+
return decodeURIComponent(c.substring(nameEQ.length, c.length));
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
return null;
|
|
769
|
+
}
|
|
770
|
+
catch (error) {
|
|
771
|
+
this.logger.error("Failed to get cookie:", error);
|
|
772
|
+
return null;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
deleteCookie(name) {
|
|
776
|
+
try {
|
|
777
|
+
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;`;
|
|
778
|
+
}
|
|
779
|
+
catch (error) {
|
|
780
|
+
this.logger.error("Failed to delete cookie:", error);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
659
783
|
async init() {
|
|
660
784
|
await this.indexedDB.init();
|
|
661
785
|
}
|
|
@@ -1020,8 +1144,17 @@ class AttributionSDK {
|
|
|
1020
1144
|
}
|
|
1021
1145
|
try {
|
|
1022
1146
|
this.logger.info("Initializing GetuAI Attribution SDK");
|
|
1023
|
-
// Initialize storage
|
|
1024
|
-
|
|
1147
|
+
// Initialize storage (IndexedDB failure should not block SDK initialization)
|
|
1148
|
+
try {
|
|
1149
|
+
await this.storage.init();
|
|
1150
|
+
}
|
|
1151
|
+
catch (storageError) {
|
|
1152
|
+
this.logger.warn("Storage initialization failed (IndexedDB may be unavailable), continuing with basic features:", storageError);
|
|
1153
|
+
// Continue initialization even if IndexedDB fails
|
|
1154
|
+
// User ID and other features using cookie/localStorage will still work
|
|
1155
|
+
}
|
|
1156
|
+
// Initialize user ID (from config or existing storage)
|
|
1157
|
+
this.initializeUserId();
|
|
1025
1158
|
// Initialize session
|
|
1026
1159
|
this.initializeSession();
|
|
1027
1160
|
// Extract and store UTM data from current URL
|
|
@@ -1094,10 +1227,12 @@ class AttributionSDK {
|
|
|
1094
1227
|
last_activity: this.session?.lastActivity,
|
|
1095
1228
|
page_views: this.session?.pageViews,
|
|
1096
1229
|
};
|
|
1230
|
+
// Use provided tracking_user_id or fallback to stored user ID
|
|
1231
|
+
const finalUserId = tracking_user_id || this.getUserId();
|
|
1097
1232
|
const event = {
|
|
1098
1233
|
event_id: generateId(),
|
|
1099
1234
|
event_type: eventType,
|
|
1100
|
-
tracking_user_id:
|
|
1235
|
+
tracking_user_id: finalUserId || undefined,
|
|
1101
1236
|
timestamp: getTimestamp(),
|
|
1102
1237
|
event_data: eventData,
|
|
1103
1238
|
context: { page: pageContext, session: sessionContext },
|
|
@@ -1194,6 +1329,46 @@ class AttributionSDK {
|
|
|
1194
1329
|
async trackEmailVerification(tracking_user_id, verificationData) {
|
|
1195
1330
|
await this.trackEvent(EventType.EMAIL_VERIFICATION, verificationData, tracking_user_id);
|
|
1196
1331
|
}
|
|
1332
|
+
// Track audit approved (conversion)
|
|
1333
|
+
async trackAuditApproved(tracking_user_id, auditData) {
|
|
1334
|
+
await this.trackEvent(EventType.AUDIT_APPROVED, auditData, tracking_user_id);
|
|
1335
|
+
}
|
|
1336
|
+
// Track purchase with auto user ID (object parameter format)
|
|
1337
|
+
async trackPurchaseAuto(options) {
|
|
1338
|
+
const userId = options.tracking_user_id || this.getUserId();
|
|
1339
|
+
if (!userId) {
|
|
1340
|
+
this.logger.error("❌ trackPurchaseAuto requires tracking_user_id. Please set user ID using setUserId() or pass it in options.tracking_user_id.");
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
await this.trackEvent(EventType.PURCHASE, options.purchaseData, userId, options.revenue, options.currency || Currency.USD);
|
|
1344
|
+
}
|
|
1345
|
+
// Track login with auto user ID (object parameter format)
|
|
1346
|
+
async trackLoginAuto(options) {
|
|
1347
|
+
const userId = options.tracking_user_id || this.getUserId();
|
|
1348
|
+
if (!userId) {
|
|
1349
|
+
this.logger.error("❌ trackLoginAuto requires tracking_user_id. Please set user ID using setUserId() or pass it in options.tracking_user_id.");
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
await this.trackEvent(EventType.LOGIN, options.loginData, userId);
|
|
1353
|
+
}
|
|
1354
|
+
// Track signup with auto user ID (object parameter format)
|
|
1355
|
+
async trackSignupAuto(options) {
|
|
1356
|
+
const userId = options.tracking_user_id || this.getUserId();
|
|
1357
|
+
if (!userId) {
|
|
1358
|
+
this.logger.error("❌ trackSignupAuto requires tracking_user_id. Please set user ID using setUserId() or pass it in options.tracking_user_id.");
|
|
1359
|
+
return;
|
|
1360
|
+
}
|
|
1361
|
+
await this.trackEvent(EventType.SIGNUP, options.signupData, userId);
|
|
1362
|
+
}
|
|
1363
|
+
// Track email verification with auto user ID (object parameter format)
|
|
1364
|
+
async trackEmailVerificationAuto(options) {
|
|
1365
|
+
const userId = options.tracking_user_id || this.getUserId();
|
|
1366
|
+
if (!userId) {
|
|
1367
|
+
this.logger.error("❌ trackEmailVerificationAuto requires tracking_user_id. Please set user ID using setUserId() or pass it in options.tracking_user_id.");
|
|
1368
|
+
return;
|
|
1369
|
+
}
|
|
1370
|
+
await this.trackEvent(EventType.EMAIL_VERIFICATION, options.verificationData, userId);
|
|
1371
|
+
}
|
|
1197
1372
|
// Track product view
|
|
1198
1373
|
async trackProductView(tracking_user_id, productData) {
|
|
1199
1374
|
await this.trackEvent(EventType.PRODUCT_VIEW, productData, tracking_user_id);
|
|
@@ -1279,6 +1454,42 @@ class AttributionSDK {
|
|
|
1279
1454
|
this.logger.debug("UTM params for event:", filteredParams);
|
|
1280
1455
|
return filteredParams;
|
|
1281
1456
|
}
|
|
1457
|
+
// Initialize user ID
|
|
1458
|
+
initializeUserId() {
|
|
1459
|
+
// If userId is provided in config, set it (will override existing)
|
|
1460
|
+
if (this.config.userId) {
|
|
1461
|
+
this.setUserId(this.config.userId);
|
|
1462
|
+
this.logger.info(`👤 User ID initialized from config: ${this.config.userId}`);
|
|
1463
|
+
}
|
|
1464
|
+
else {
|
|
1465
|
+
// Check if user ID already exists in storage
|
|
1466
|
+
const existingUserId = this.getUserId();
|
|
1467
|
+
if (existingUserId) {
|
|
1468
|
+
this.logger.debug(`👤 Existing user ID found: ${existingUserId}`);
|
|
1469
|
+
}
|
|
1470
|
+
else {
|
|
1471
|
+
this.logger.debug("👤 No user ID found, will be set when user identifies");
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
// Set user ID
|
|
1476
|
+
setUserId(userId) {
|
|
1477
|
+
if (!userId || userId.trim() === "") {
|
|
1478
|
+
this.logger.warn("Cannot set empty user ID");
|
|
1479
|
+
return;
|
|
1480
|
+
}
|
|
1481
|
+
this.storage.setUserId(userId);
|
|
1482
|
+
this.logger.info(`👤 User ID set: ${userId}`);
|
|
1483
|
+
}
|
|
1484
|
+
// Get user ID
|
|
1485
|
+
getUserId() {
|
|
1486
|
+
return this.storage.getUserId();
|
|
1487
|
+
}
|
|
1488
|
+
// Remove user ID
|
|
1489
|
+
removeUserId() {
|
|
1490
|
+
this.storage.removeUserId();
|
|
1491
|
+
this.logger.info("👤 User ID removed");
|
|
1492
|
+
}
|
|
1282
1493
|
// Initialize user session
|
|
1283
1494
|
initializeSession() {
|
|
1284
1495
|
const existingSession = this.storage.getSession();
|
|
@@ -1731,6 +1942,7 @@ function autoInit() {
|
|
|
1731
1942
|
autoCleanUTM: script.getAttribute("data-auto-clean-utm") !== "false",
|
|
1732
1943
|
batchSize: parseInt(script.getAttribute("data-batch-size") || "100"),
|
|
1733
1944
|
batchInterval: parseInt(script.getAttribute("data-batch-interval") || "2000"),
|
|
1945
|
+
userId: script.getAttribute("data-user-id") || undefined,
|
|
1734
1946
|
};
|
|
1735
1947
|
// Initialize SDK
|
|
1736
1948
|
init(config);
|
|
@@ -1874,6 +2086,51 @@ async function trackEmailVerification(tracking_user_id, verificationData) {
|
|
|
1874
2086
|
}
|
|
1875
2087
|
await sdk.trackEmailVerification(tracking_user_id, verificationData);
|
|
1876
2088
|
}
|
|
2089
|
+
// Track audit approved (conversion)
|
|
2090
|
+
async function trackAuditApproved(tracking_user_id, auditData) {
|
|
2091
|
+
const sdk = getSDK();
|
|
2092
|
+
if (!sdk) {
|
|
2093
|
+
console.warn("GetuAI SDK: Not initialized. Call init() first.");
|
|
2094
|
+
return;
|
|
2095
|
+
}
|
|
2096
|
+
await sdk.trackAuditApproved(tracking_user_id, auditData);
|
|
2097
|
+
}
|
|
2098
|
+
// Track purchase with auto user ID (object parameter format)
|
|
2099
|
+
async function trackPurchaseAuto(options) {
|
|
2100
|
+
const sdk = getSDK();
|
|
2101
|
+
if (!sdk) {
|
|
2102
|
+
console.warn("GetuAI SDK: Not initialized. Call init() first.");
|
|
2103
|
+
return;
|
|
2104
|
+
}
|
|
2105
|
+
await sdk.trackPurchaseAuto(options);
|
|
2106
|
+
}
|
|
2107
|
+
// Track login with auto user ID (object parameter format)
|
|
2108
|
+
async function trackLoginAuto(options) {
|
|
2109
|
+
const sdk = getSDK();
|
|
2110
|
+
if (!sdk) {
|
|
2111
|
+
console.warn("GetuAI SDK: Not initialized. Call init() first.");
|
|
2112
|
+
return;
|
|
2113
|
+
}
|
|
2114
|
+
await sdk.trackLoginAuto(options);
|
|
2115
|
+
}
|
|
2116
|
+
// Track signup with auto user ID (object parameter format)
|
|
2117
|
+
async function trackSignupAuto(options) {
|
|
2118
|
+
const sdk = getSDK();
|
|
2119
|
+
if (!sdk) {
|
|
2120
|
+
console.warn("GetuAI SDK: Not initialized. Call init() first.");
|
|
2121
|
+
return;
|
|
2122
|
+
}
|
|
2123
|
+
await sdk.trackSignupAuto(options);
|
|
2124
|
+
}
|
|
2125
|
+
// Track email verification with auto user ID (object parameter format)
|
|
2126
|
+
async function trackEmailVerificationAuto(options) {
|
|
2127
|
+
const sdk = getSDK();
|
|
2128
|
+
if (!sdk) {
|
|
2129
|
+
console.warn("GetuAI SDK: Not initialized. Call init() first.");
|
|
2130
|
+
return;
|
|
2131
|
+
}
|
|
2132
|
+
await sdk.trackEmailVerificationAuto(options);
|
|
2133
|
+
}
|
|
1877
2134
|
// Track product view
|
|
1878
2135
|
async function trackProductView(tracking_user_id, productData) {
|
|
1879
2136
|
const sdk = getSDK();
|
|
@@ -1943,6 +2200,33 @@ function getCurrentUTMParams() {
|
|
|
1943
2200
|
}
|
|
1944
2201
|
return sdk.getCurrentUTMParams();
|
|
1945
2202
|
}
|
|
2203
|
+
// Set user ID
|
|
2204
|
+
function setUserId(userId) {
|
|
2205
|
+
const sdk = getSDK();
|
|
2206
|
+
if (!sdk) {
|
|
2207
|
+
console.warn("GetuAI SDK: Not initialized. Call init() first.");
|
|
2208
|
+
return;
|
|
2209
|
+
}
|
|
2210
|
+
sdk.setUserId(userId);
|
|
2211
|
+
}
|
|
2212
|
+
// Get user ID
|
|
2213
|
+
function getUserId() {
|
|
2214
|
+
const sdk = getSDK();
|
|
2215
|
+
if (!sdk) {
|
|
2216
|
+
console.warn("GetuAI SDK: Not initialized. Call init() first.");
|
|
2217
|
+
return null;
|
|
2218
|
+
}
|
|
2219
|
+
return sdk.getUserId();
|
|
2220
|
+
}
|
|
2221
|
+
// Remove user ID
|
|
2222
|
+
function removeUserId() {
|
|
2223
|
+
const sdk = getSDK();
|
|
2224
|
+
if (!sdk) {
|
|
2225
|
+
console.warn("GetuAI SDK: Not initialized. Call init() first.");
|
|
2226
|
+
return;
|
|
2227
|
+
}
|
|
2228
|
+
sdk.removeUserId();
|
|
2229
|
+
}
|
|
1946
2230
|
// Destroy SDK
|
|
1947
2231
|
function destroy() {
|
|
1948
2232
|
if (globalSDK) {
|
|
@@ -1989,6 +2273,22 @@ class AttributionSDKStatic extends AttributionSDK {
|
|
|
1989
2273
|
static async trackEmailVerification(tracking_user_id, verificationData) {
|
|
1990
2274
|
return await trackEmailVerification(tracking_user_id, verificationData);
|
|
1991
2275
|
}
|
|
2276
|
+
// Static method to track purchase with auto user ID
|
|
2277
|
+
static async trackPurchaseAuto(options) {
|
|
2278
|
+
return await trackPurchaseAuto(options);
|
|
2279
|
+
}
|
|
2280
|
+
// Static method to track login with auto user ID
|
|
2281
|
+
static async trackLoginAuto(options) {
|
|
2282
|
+
return await trackLoginAuto(options);
|
|
2283
|
+
}
|
|
2284
|
+
// Static method to track signup with auto user ID
|
|
2285
|
+
static async trackSignupAuto(options) {
|
|
2286
|
+
return await trackSignupAuto(options);
|
|
2287
|
+
}
|
|
2288
|
+
// Static method to track email verification with auto user ID
|
|
2289
|
+
static async trackEmailVerificationAuto(options) {
|
|
2290
|
+
return await trackEmailVerificationAuto(options);
|
|
2291
|
+
}
|
|
1992
2292
|
// Static method to track product view
|
|
1993
2293
|
static async trackProductView(tracking_user_id, productData) {
|
|
1994
2294
|
return await trackProductView(tracking_user_id, productData);
|
|
@@ -2021,6 +2321,18 @@ class AttributionSDKStatic extends AttributionSDK {
|
|
|
2021
2321
|
static getCurrentUTMParams() {
|
|
2022
2322
|
return getCurrentUTMParams();
|
|
2023
2323
|
}
|
|
2324
|
+
// Static method to set user ID
|
|
2325
|
+
static setUserId(userId) {
|
|
2326
|
+
setUserId(userId);
|
|
2327
|
+
}
|
|
2328
|
+
// Static method to get user ID
|
|
2329
|
+
static getUserId() {
|
|
2330
|
+
return getUserId();
|
|
2331
|
+
}
|
|
2332
|
+
// Static method to remove user ID
|
|
2333
|
+
static removeUserId() {
|
|
2334
|
+
removeUserId();
|
|
2335
|
+
}
|
|
2024
2336
|
// Static method to destroy SDK
|
|
2025
2337
|
static destroy() {
|
|
2026
2338
|
destroy();
|
|
@@ -2061,13 +2373,21 @@ if (typeof window !== "undefined") {
|
|
|
2061
2373
|
trackFormSubmit,
|
|
2062
2374
|
trackVideoPlay,
|
|
2063
2375
|
trackEmailVerification,
|
|
2376
|
+
trackAuditApproved,
|
|
2064
2377
|
trackProductView,
|
|
2065
2378
|
trackAddToCart,
|
|
2379
|
+
trackPurchaseAuto,
|
|
2380
|
+
trackLoginAuto,
|
|
2381
|
+
trackSignupAuto,
|
|
2382
|
+
trackEmailVerificationAuto,
|
|
2066
2383
|
getAttributionData,
|
|
2067
2384
|
flush,
|
|
2068
2385
|
getStatus,
|
|
2069
2386
|
addUTMToURL: src_addUTMToURL,
|
|
2070
2387
|
getCurrentUTMParams,
|
|
2388
|
+
setUserId,
|
|
2389
|
+
getUserId,
|
|
2390
|
+
removeUserId,
|
|
2071
2391
|
destroy,
|
|
2072
2392
|
EventType: EventType,
|
|
2073
2393
|
Currency: Currency,
|
|
@@ -2087,11 +2407,18 @@ if (typeof window !== "undefined") {
|
|
|
2087
2407
|
window.trackEmailVerification = trackEmailVerification;
|
|
2088
2408
|
window.trackProductView = trackProductView;
|
|
2089
2409
|
window.trackAddToCart = trackAddToCart;
|
|
2410
|
+
window.trackPurchaseAuto = trackPurchaseAuto;
|
|
2411
|
+
window.trackLoginAuto = trackLoginAuto;
|
|
2412
|
+
window.trackSignupAuto = trackSignupAuto;
|
|
2413
|
+
window.trackEmailVerificationAuto = trackEmailVerificationAuto;
|
|
2090
2414
|
window.getAttributionData = getAttributionData;
|
|
2091
2415
|
window.flush = flush;
|
|
2092
2416
|
window.getStatus = getStatus;
|
|
2093
2417
|
window.addUTMToURL = src_addUTMToURL;
|
|
2094
2418
|
window.getCurrentUTMParams = getCurrentUTMParams;
|
|
2419
|
+
window.setUserId = setUserId;
|
|
2420
|
+
window.getUserId = getUserId;
|
|
2421
|
+
window.removeUserId = removeUserId;
|
|
2095
2422
|
window.destroy = destroy;
|
|
2096
2423
|
window.AttributionSDK = AttributionSDKStatic; // 直接暴露带静态方法的AttributionSDK类
|
|
2097
2424
|
}
|
|
@@ -2111,11 +2438,18 @@ if (typeof window !== "undefined") {
|
|
|
2111
2438
|
trackEmailVerification,
|
|
2112
2439
|
trackProductView,
|
|
2113
2440
|
trackAddToCart,
|
|
2441
|
+
trackPurchaseAuto,
|
|
2442
|
+
trackLoginAuto,
|
|
2443
|
+
trackSignupAuto,
|
|
2444
|
+
trackEmailVerificationAuto,
|
|
2114
2445
|
getAttributionData,
|
|
2115
2446
|
flush,
|
|
2116
2447
|
getStatus,
|
|
2117
2448
|
addUTMToURL: src_addUTMToURL,
|
|
2118
2449
|
getCurrentUTMParams,
|
|
2450
|
+
setUserId,
|
|
2451
|
+
getUserId,
|
|
2452
|
+
removeUserId,
|
|
2119
2453
|
destroy,
|
|
2120
2454
|
EventType: EventType,
|
|
2121
2455
|
Currency: Currency,
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -29,7 +29,15 @@ export declare class AttributionStorageManager {
|
|
|
29
29
|
private logger;
|
|
30
30
|
private readonly UTM_STORAGE_KEY;
|
|
31
31
|
private readonly SESSION_STORAGE_KEY;
|
|
32
|
+
private readonly USER_ID_KEY;
|
|
33
|
+
private readonly USER_ID_COOKIE_EXPIRES;
|
|
32
34
|
constructor(logger: LoggerInterface);
|
|
35
|
+
setUserId(userId: string): void;
|
|
36
|
+
getUserId(): string | null;
|
|
37
|
+
removeUserId(): void;
|
|
38
|
+
private setCookie;
|
|
39
|
+
private getCookie;
|
|
40
|
+
private deleteCookie;
|
|
33
41
|
init(): Promise<void>;
|
|
34
42
|
storeUTMData(utmData: Partial<AttributionData>): void;
|
|
35
43
|
getUTMData(): AttributionData | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,eAAe,EAEhB,MAAM,UAAU,CAAC;AASlB,qBAAa,mBAAoB,YAAW,gBAAgB;IAC1D,OAAO,CAAC,MAAM,CAAkB;gBAEpB,MAAM,EAAE,eAAe;IAInC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG;IAmBrB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;IAelC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAUzB,KAAK,IAAI,IAAI;IAUb,OAAO,CAAC,mBAAmB;CA4B5B;AAGD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,EAAE,CAA4B;gBAE1B,MAAM,EAAE,eAAe;IAI7B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAoCrB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BzC,eAAe,CAAC,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,SA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AS,EAAE,CAAC;IAI1D,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAI/B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC,kBAAkB,IAAI,IAAI;CAG3B"}
|
package/dist/storage/index.js
CHANGED
|
@@ -274,10 +274,131 @@ export class AttributionStorageManager {
|
|
|
274
274
|
constructor(logger) {
|
|
275
275
|
this.UTM_STORAGE_KEY = "attribution_utm_data";
|
|
276
276
|
this.SESSION_STORAGE_KEY = "attribution_session";
|
|
277
|
+
this.USER_ID_KEY = "getuai_user_id";
|
|
278
|
+
this.USER_ID_COOKIE_EXPIRES = 365; // days
|
|
277
279
|
this.logger = logger;
|
|
278
280
|
this.localStorage = new LocalStorageManager(logger);
|
|
279
281
|
this.indexedDB = new IndexedDBManager(logger);
|
|
280
282
|
}
|
|
283
|
+
// User ID management - stores in both cookie and localStorage
|
|
284
|
+
setUserId(userId) {
|
|
285
|
+
if (!userId || userId.trim() === "") {
|
|
286
|
+
this.logger.warn("Cannot set empty user ID");
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const trimmedUserId = userId.trim();
|
|
290
|
+
// Store in cookie
|
|
291
|
+
try {
|
|
292
|
+
this.setCookie(this.USER_ID_KEY, trimmedUserId, this.USER_ID_COOKIE_EXPIRES);
|
|
293
|
+
this.logger.debug(`👤 User ID stored in cookie: ${trimmedUserId}`);
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
this.logger.error("Failed to store user ID in cookie:", error);
|
|
297
|
+
}
|
|
298
|
+
// Store in localStorage
|
|
299
|
+
try {
|
|
300
|
+
if (typeof localStorage !== "undefined") {
|
|
301
|
+
localStorage.setItem(this.USER_ID_KEY, trimmedUserId);
|
|
302
|
+
this.logger.debug(`👤 User ID stored in localStorage: ${trimmedUserId}`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
this.logger.error("Failed to store user ID in localStorage:", error);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
getUserId() {
|
|
310
|
+
// Try localStorage first
|
|
311
|
+
try {
|
|
312
|
+
if (typeof localStorage !== "undefined") {
|
|
313
|
+
const userId = localStorage.getItem(this.USER_ID_KEY);
|
|
314
|
+
if (userId) {
|
|
315
|
+
return userId;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
catch (error) {
|
|
320
|
+
this.logger.debug("Failed to get user ID from localStorage:", error);
|
|
321
|
+
}
|
|
322
|
+
// Fallback to cookie
|
|
323
|
+
try {
|
|
324
|
+
const userId = this.getCookie(this.USER_ID_KEY);
|
|
325
|
+
if (userId) {
|
|
326
|
+
// Sync back to localStorage if cookie exists but localStorage doesn't
|
|
327
|
+
try {
|
|
328
|
+
if (typeof localStorage !== "undefined") {
|
|
329
|
+
localStorage.setItem(this.USER_ID_KEY, userId);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
// Ignore sync errors
|
|
334
|
+
}
|
|
335
|
+
return userId;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
catch (error) {
|
|
339
|
+
this.logger.debug("Failed to get user ID from cookie:", error);
|
|
340
|
+
}
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
removeUserId() {
|
|
344
|
+
// Remove from cookie
|
|
345
|
+
try {
|
|
346
|
+
this.deleteCookie(this.USER_ID_KEY);
|
|
347
|
+
this.logger.debug("👤 User ID removed from cookie");
|
|
348
|
+
}
|
|
349
|
+
catch (error) {
|
|
350
|
+
this.logger.error("Failed to remove user ID from cookie:", error);
|
|
351
|
+
}
|
|
352
|
+
// Remove from localStorage
|
|
353
|
+
try {
|
|
354
|
+
if (typeof localStorage !== "undefined") {
|
|
355
|
+
localStorage.removeItem(this.USER_ID_KEY);
|
|
356
|
+
this.logger.debug("👤 User ID removed from localStorage");
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
this.logger.error("Failed to remove user ID from localStorage:", error);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
// Cookie helper methods
|
|
364
|
+
setCookie(name, value, days) {
|
|
365
|
+
try {
|
|
366
|
+
const expires = new Date();
|
|
367
|
+
expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000);
|
|
368
|
+
const cookieValue = `${name}=${encodeURIComponent(value)};expires=${expires.toUTCString()};path=/;SameSite=Lax`;
|
|
369
|
+
document.cookie = cookieValue;
|
|
370
|
+
}
|
|
371
|
+
catch (error) {
|
|
372
|
+
this.logger.error("Failed to set cookie:", error);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
getCookie(name) {
|
|
376
|
+
try {
|
|
377
|
+
const nameEQ = name + "=";
|
|
378
|
+
const ca = document.cookie.split(";");
|
|
379
|
+
for (let i = 0; i < ca.length; i++) {
|
|
380
|
+
let c = ca[i];
|
|
381
|
+
while (c.charAt(0) === " ")
|
|
382
|
+
c = c.substring(1, c.length);
|
|
383
|
+
if (c.indexOf(nameEQ) === 0) {
|
|
384
|
+
return decodeURIComponent(c.substring(nameEQ.length, c.length));
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return null;
|
|
388
|
+
}
|
|
389
|
+
catch (error) {
|
|
390
|
+
this.logger.error("Failed to get cookie:", error);
|
|
391
|
+
return null;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
deleteCookie(name) {
|
|
395
|
+
try {
|
|
396
|
+
document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;`;
|
|
397
|
+
}
|
|
398
|
+
catch (error) {
|
|
399
|
+
this.logger.error("Failed to delete cookie:", error);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
281
402
|
async init() {
|
|
282
403
|
await this.indexedDB.init();
|
|
283
404
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ export declare enum EventType {
|
|
|
8
8
|
SIGNUP = "signup",
|
|
9
9
|
PRODUCT_VIEW = "product_view",
|
|
10
10
|
ADD_TO_CART = "add_to_cart",
|
|
11
|
-
PURCHASE = "purchase"
|
|
11
|
+
PURCHASE = "purchase",
|
|
12
|
+
AUDIT_APPROVED = "audit_approved"
|
|
12
13
|
}
|
|
13
14
|
export declare enum Currency {
|
|
14
15
|
USD = "USD"
|
|
@@ -74,6 +75,7 @@ export interface SDKConfig {
|
|
|
74
75
|
excludeDomains?: string[];
|
|
75
76
|
autoCleanUTM?: boolean;
|
|
76
77
|
pageViewDebounceInterval?: number;
|
|
78
|
+
userId?: string;
|
|
77
79
|
}
|
|
78
80
|
export interface StorageInterface {
|
|
79
81
|
get(key: string): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,oBAAY,SAAS;IAEnB,SAAS,cAAc;IACvB,UAAU,eAAe,CAAE,8BAA8B;IACzD,UAAU,eAAe;IAGzB,WAAW,gBAAgB;IAC3B,kBAAkB,uBAAuB;IAGzC,KAAK,UAAU;IAGf,MAAM,WAAW;IAGjB,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,oBAAY,SAAS;IAEnB,SAAS,cAAc;IACvB,UAAU,eAAe,CAAE,8BAA8B;IACzD,UAAU,eAAe;IAGzB,WAAW,gBAAgB;IAC3B,kBAAkB,uBAAuB;IAGzC,KAAK,UAAU;IAGf,MAAM,WAAW;IAGjB,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;IAGrB,cAAc,mBAAmB;CAClC;AAGD,oBAAY,QA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AM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,IAAI,IAAI,CAAC;CACf;AAGD,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,MAAM,CAAC;CAChB;AAGD,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC7C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAC9C;AAGD,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,eAAO,MAAM,gBAAgB,aAO5B,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -16,6 +16,8 @@ export var EventType;
|
|
|
16
16
|
EventType["PRODUCT_VIEW"] = "product_view";
|
|
17
17
|
EventType["ADD_TO_CART"] = "add_to_cart";
|
|
18
18
|
EventType["PURCHASE"] = "purchase";
|
|
19
|
+
// Post-conversion / back-office conversion
|
|
20
|
+
EventType["AUDIT_APPROVED"] = "audit_approved";
|
|
19
21
|
})(EventType || (EventType = {}));
|
|
20
22
|
// Currency types
|
|
21
23
|
export var Currency;
|
|
@@ -30,4 +32,5 @@ export const IMMEDIATE_EVENTS = [
|
|
|
30
32
|
EventType.SIGNUP,
|
|
31
33
|
EventType.FORM_SUBMIT,
|
|
32
34
|
EventType.EMAIL_VERIFICATION,
|
|
35
|
+
EventType.AUDIT_APPROVED,
|
|
33
36
|
];
|