humanbehavior-js 0.1.3 → 0.1.5
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/cjs/index.js +35 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +35 -22
- package/dist/esm/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +13 -1
- package/src/tracker.ts +3 -1
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -41,6 +41,9 @@ export class HumanBehaviorAPI {
|
|
|
41
41
|
referrer = document.referrer;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
console.log('API init called with:', { sessionId, userId, entryURL, referrer, baseUrl: this.baseUrl });
|
|
45
|
+
|
|
46
|
+
try {
|
|
44
47
|
const response = await fetch(`${this.baseUrl}/api/ingestion/init`, {
|
|
45
48
|
method: 'POST',
|
|
46
49
|
headers: {
|
|
@@ -56,14 +59,23 @@ export class HumanBehaviorAPI {
|
|
|
56
59
|
})
|
|
57
60
|
});
|
|
58
61
|
|
|
62
|
+
console.log('API init response status:', response.status);
|
|
63
|
+
|
|
59
64
|
if (!response.ok) {
|
|
60
|
-
|
|
65
|
+
const errorText = await response.text();
|
|
66
|
+
console.error('API init failed:', response.status, errorText);
|
|
67
|
+
throw new Error(`Failed to initialize ingestion: ${response.statusText} - ${errorText}`);
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
const responseJson = await response.json();
|
|
71
|
+
console.log('API init success:', responseJson);
|
|
64
72
|
return {
|
|
65
73
|
sessionId: responseJson.sessionId,
|
|
66
74
|
endUserId: responseJson.endUserId
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error('API init error:', error);
|
|
78
|
+
throw error;
|
|
67
79
|
}
|
|
68
80
|
}
|
|
69
81
|
|
package/src/tracker.ts
CHANGED
|
@@ -114,7 +114,9 @@ export class HumanBehaviorTracker {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// Initialize API
|
|
117
|
-
const defaultIngestionUrl = 'http://3.137.217.33:3000'; // AWS Development Server
|
|
117
|
+
//const defaultIngestionUrl = 'http://3.137.217.33:3000'; // AWS Development Server
|
|
118
|
+
//const defaultIngestionUrl = 'http://ingestion-server-alb-1823866402.us-east-2.elb.amazonaws.com'; // ALB
|
|
119
|
+
const defaultIngestionUrl = 'https://ingest.humanbehavior.co'; // HTTPS ALB
|
|
118
120
|
this.api = new HumanBehaviorAPI({
|
|
119
121
|
apiKey: apiKey,
|
|
120
122
|
ingestionUrl: ingestionUrl || defaultIngestionUrl
|