@loamly/tracker 2.0.0 → 2.0.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.cjs +37 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +37 -2
- package/dist/index.mjs.map +1 -1
- package/dist/loamly.iife.global.js +37 -2
- package/dist/loamly.iife.global.js.map +1 -1
- package/dist/loamly.iife.min.global.js +1 -1
- package/dist/loamly.iife.min.global.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +1 -1
- package/src/core.ts +52 -1
package/dist/index.d.mts
CHANGED
|
@@ -189,6 +189,7 @@ interface LoamlyTracker {
|
|
|
189
189
|
*/
|
|
190
190
|
declare const loamly: LoamlyTracker & {
|
|
191
191
|
getAgentic: () => AgenticDetectionResult | null;
|
|
192
|
+
reportHealth: (status: 'initialized' | 'error' | 'ready', errorMessage?: string) => void;
|
|
192
193
|
};
|
|
193
194
|
|
|
194
195
|
/**
|
|
@@ -245,7 +246,7 @@ declare function detectAIFromUTM(url: string): AIDetectionResult | null;
|
|
|
245
246
|
* @license MIT
|
|
246
247
|
* @see https://github.com/loamly/loamly
|
|
247
248
|
*/
|
|
248
|
-
declare const VERSION = "2.0.
|
|
249
|
+
declare const VERSION = "2.0.2";
|
|
249
250
|
/**
|
|
250
251
|
* Known AI platforms for referrer detection
|
|
251
252
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -189,6 +189,7 @@ interface LoamlyTracker {
|
|
|
189
189
|
*/
|
|
190
190
|
declare const loamly: LoamlyTracker & {
|
|
191
191
|
getAgentic: () => AgenticDetectionResult | null;
|
|
192
|
+
reportHealth: (status: 'initialized' | 'error' | 'ready', errorMessage?: string) => void;
|
|
192
193
|
};
|
|
193
194
|
|
|
194
195
|
/**
|
|
@@ -245,7 +246,7 @@ declare function detectAIFromUTM(url: string): AIDetectionResult | null;
|
|
|
245
246
|
* @license MIT
|
|
246
247
|
* @see https://github.com/loamly/loamly
|
|
247
248
|
*/
|
|
248
|
-
declare const VERSION = "2.0.
|
|
249
|
+
declare const VERSION = "2.0.2";
|
|
249
250
|
/**
|
|
250
251
|
* Known AI platforms for referrer detection
|
|
251
252
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/config.ts
|
|
2
|
-
var VERSION = "2.0.
|
|
2
|
+
var VERSION = "2.0.2";
|
|
3
3
|
var DEFAULT_CONFIG = {
|
|
4
4
|
apiHost: "https://app.loamly.ai",
|
|
5
5
|
endpoints: {
|
|
@@ -1817,6 +1817,7 @@ function init(userConfig = {}) {
|
|
|
1817
1817
|
});
|
|
1818
1818
|
spaRouter.start();
|
|
1819
1819
|
setupUnloadHandlers();
|
|
1820
|
+
reportHealth("initialized");
|
|
1820
1821
|
log("Initialization complete");
|
|
1821
1822
|
}
|
|
1822
1823
|
function setupAdvancedBehavioralTracking() {
|
|
@@ -2162,6 +2163,39 @@ function getAgenticResult() {
|
|
|
2162
2163
|
function isTrackerInitialized() {
|
|
2163
2164
|
return initialized;
|
|
2164
2165
|
}
|
|
2166
|
+
function reportHealth(status, errorMessage) {
|
|
2167
|
+
if (!config.apiKey) return;
|
|
2168
|
+
try {
|
|
2169
|
+
const healthData = {
|
|
2170
|
+
workspace_id: config.apiKey,
|
|
2171
|
+
status,
|
|
2172
|
+
error_message: errorMessage || null,
|
|
2173
|
+
version: VERSION,
|
|
2174
|
+
url: typeof window !== "undefined" ? window.location.href : null,
|
|
2175
|
+
user_agent: typeof navigator !== "undefined" ? navigator.userAgent : null,
|
|
2176
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2177
|
+
features: {
|
|
2178
|
+
scroll_tracker: !!scrollTracker,
|
|
2179
|
+
time_tracker: !!timeTracker,
|
|
2180
|
+
form_tracker: !!formTracker,
|
|
2181
|
+
spa_router: !!spaRouter,
|
|
2182
|
+
behavioral_ml: !!behavioralClassifier,
|
|
2183
|
+
focus_blur: !!focusBlurAnalyzer,
|
|
2184
|
+
agentic: !!agenticAnalyzer,
|
|
2185
|
+
ping_service: !!pingService,
|
|
2186
|
+
event_queue: !!eventQueue
|
|
2187
|
+
}
|
|
2188
|
+
};
|
|
2189
|
+
safeFetch(endpoint(DEFAULT_CONFIG.endpoints.health), {
|
|
2190
|
+
method: "POST",
|
|
2191
|
+
headers: { "Content-Type": "application/json" },
|
|
2192
|
+
body: JSON.stringify(healthData)
|
|
2193
|
+
}).catch(() => {
|
|
2194
|
+
});
|
|
2195
|
+
log("Health reported:", status);
|
|
2196
|
+
} catch {
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2165
2199
|
function reset() {
|
|
2166
2200
|
log("Resetting tracker");
|
|
2167
2201
|
pingService?.stop();
|
|
@@ -2211,7 +2245,8 @@ var loamly = {
|
|
|
2211
2245
|
getAgentic: getAgenticResult,
|
|
2212
2246
|
isInitialized: isTrackerInitialized,
|
|
2213
2247
|
reset,
|
|
2214
|
-
debug: setDebug
|
|
2248
|
+
debug: setDebug,
|
|
2249
|
+
reportHealth
|
|
2215
2250
|
};
|
|
2216
2251
|
export {
|
|
2217
2252
|
AI_BOT_PATTERNS,
|