@reservamos/browser-analytics 1.0.4 → 1.0.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.
@@ -13448,6 +13448,17 @@ function flattenEventData(data) {
13448
13448
  return flattenedData;
13449
13449
  }, {});
13450
13450
  }
13451
+ function trackEventError(eventName, error) {
13452
+ try {
13453
+ mixpanelService.track("Track Event Error", {
13454
+ "Failed Event Name": eventName,
13455
+ "Error Message": (error == null ? void 0 : error.message) ?? "Failed to track event",
13456
+ "Validation Errors": (error == null ? void 0 : error.errors) || []
13457
+ });
13458
+ } catch (trackingError) {
13459
+ console.error("Failed to track error event:", trackingError);
13460
+ }
13461
+ }
13451
13462
  async function trackEvent(eventName, eventProperties, meta = {}) {
13452
13463
  if (!mixpanelService.isReady()) {
13453
13464
  throw new Error("Mixpanel is not initialized.");
@@ -13470,6 +13481,7 @@ async function trackEvent(eventName, eventProperties, meta = {}) {
13470
13481
  mixpanelService.track(eventName, properties);
13471
13482
  } catch (error) {
13472
13483
  console.error(`Error tracking event '${eventName}':`, error);
13484
+ trackEventError(eventName, error);
13473
13485
  }
13474
13486
  }
13475
13487
  function extractTrackingParams() {
@@ -13494,7 +13506,7 @@ function trackCustomEvent(eventName, eventData = {}, meta = {}) {
13494
13506
  trackEvent(eventName, eventData, meta);
13495
13507
  } catch (error) {
13496
13508
  console.error("Error trackCustomEvent:", error);
13497
- return;
13509
+ trackEventError(eventName, error);
13498
13510
  }
13499
13511
  }
13500
13512
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -16065,6 +16077,7 @@ async function identify(userId, properties = {}) {
16065
16077
  }
16066
16078
  } catch (error) {
16067
16079
  console.error("Error identifying user", error);
16080
+ trackEventError("Identify", error);
16068
16081
  }
16069
16082
  }
16070
16083
  const origin = window.location.origin;