@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.
@@ -26,7 +26,7 @@ var Loamly = (() => {
26
26
  });
27
27
 
28
28
  // src/config.ts
29
- var VERSION = "2.0.0";
29
+ var VERSION = "2.0.2";
30
30
  var DEFAULT_CONFIG = {
31
31
  apiHost: "https://app.loamly.ai",
32
32
  endpoints: {
@@ -1821,6 +1821,7 @@ var Loamly = (() => {
1821
1821
  });
1822
1822
  spaRouter.start();
1823
1823
  setupUnloadHandlers();
1824
+ reportHealth("initialized");
1824
1825
  log("Initialization complete");
1825
1826
  }
1826
1827
  function setupAdvancedBehavioralTracking() {
@@ -2166,6 +2167,39 @@ var Loamly = (() => {
2166
2167
  function isTrackerInitialized() {
2167
2168
  return initialized;
2168
2169
  }
2170
+ function reportHealth(status, errorMessage) {
2171
+ if (!config.apiKey) return;
2172
+ try {
2173
+ const healthData = {
2174
+ workspace_id: config.apiKey,
2175
+ status,
2176
+ error_message: errorMessage || null,
2177
+ version: VERSION,
2178
+ url: typeof window !== "undefined" ? window.location.href : null,
2179
+ user_agent: typeof navigator !== "undefined" ? navigator.userAgent : null,
2180
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2181
+ features: {
2182
+ scroll_tracker: !!scrollTracker,
2183
+ time_tracker: !!timeTracker,
2184
+ form_tracker: !!formTracker,
2185
+ spa_router: !!spaRouter,
2186
+ behavioral_ml: !!behavioralClassifier,
2187
+ focus_blur: !!focusBlurAnalyzer,
2188
+ agentic: !!agenticAnalyzer,
2189
+ ping_service: !!pingService,
2190
+ event_queue: !!eventQueue
2191
+ }
2192
+ };
2193
+ safeFetch(endpoint(DEFAULT_CONFIG.endpoints.health), {
2194
+ method: "POST",
2195
+ headers: { "Content-Type": "application/json" },
2196
+ body: JSON.stringify(healthData)
2197
+ }).catch(() => {
2198
+ });
2199
+ log("Health reported:", status);
2200
+ } catch {
2201
+ }
2202
+ }
2169
2203
  function reset() {
2170
2204
  log("Resetting tracker");
2171
2205
  pingService?.stop();
@@ -2215,7 +2249,8 @@ var Loamly = (() => {
2215
2249
  getAgentic: getAgenticResult,
2216
2250
  isInitialized: isTrackerInitialized,
2217
2251
  reset,
2218
- debug: setDebug
2252
+ debug: setDebug,
2253
+ reportHealth
2219
2254
  };
2220
2255
 
2221
2256
  // src/browser.ts