@devskin/browser-sdk 1.0.38 → 1.0.40

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.
@@ -857,9 +857,11 @@ class NetworkCollector {
857
857
  }
858
858
 
859
859
  class HeatmapCollector {
860
- constructor(config, transport) {
860
+ constructor(config, transport, anonymousId, sessionId) {
861
861
  this.config = config;
862
862
  this.transport = transport;
863
+ this.anonymousId = anonymousId;
864
+ this.sessionId = sessionId;
863
865
  this.clickData = [];
864
866
  this.scrollData = [];
865
867
  this.mouseMoveData = [];
@@ -924,7 +926,7 @@ class HeatmapCollector {
924
926
  element: this.getElementSelector(target),
925
927
  elementId: target.id || undefined,
926
928
  elementClass: target.className || undefined,
927
- pageUrl: window.location.pathname,
929
+ pageUrl: window.location.href,
928
930
  timestamp: new Date().toISOString(),
929
931
  viewportWidth: window.innerWidth,
930
932
  viewportHeight: window.innerHeight,
@@ -952,7 +954,7 @@ class HeatmapCollector {
952
954
  maxDepth: this.maxScrollDepth,
953
955
  pageHeight: documentHeight,
954
956
  viewportHeight: windowHeight,
955
- pageUrl: window.location.pathname,
957
+ pageUrl: window.location.href,
956
958
  timestamp: new Date().toISOString(),
957
959
  };
958
960
  this.scrollData.push(scrollData);
@@ -989,7 +991,7 @@ class HeatmapCollector {
989
991
  const mouseMoveData = {
990
992
  x: event.clientX + window.scrollX,
991
993
  y: event.clientY + window.scrollY,
992
- pageUrl: window.location.pathname,
994
+ pageUrl: window.location.href,
993
995
  timestamp: new Date().toISOString(),
994
996
  };
995
997
  this.mouseMoveData.push(mouseMoveData);
@@ -1003,21 +1005,21 @@ class HeatmapCollector {
1003
1005
  // Send clicks individually (backend expects one click event per item)
1004
1006
  if (this.clickData.length > 0) {
1005
1007
  this.clickData.forEach(click => {
1006
- this.transport.sendHeatmapData(Object.assign({ type: 'click' }, click));
1008
+ this.transport.sendHeatmapData(Object.assign({ type: 'click', anonymousId: this.anonymousId, sessionId: this.sessionId }, click));
1007
1009
  });
1008
1010
  this.clickData = [];
1009
1011
  }
1010
1012
  // Send scroll data individually
1011
1013
  if (this.scrollData.length > 0) {
1012
1014
  this.scrollData.forEach(scroll => {
1013
- this.transport.sendHeatmapData(Object.assign({ type: 'scroll' }, scroll));
1015
+ this.transport.sendHeatmapData(Object.assign({ type: 'scroll', anonymousId: this.anonymousId, sessionId: this.sessionId }, scroll));
1014
1016
  });
1015
1017
  this.scrollData = [];
1016
1018
  }
1017
1019
  // Send mouse moves individually
1018
1020
  if (this.mouseMoveData.length > 0) {
1019
1021
  this.mouseMoveData.forEach(move => {
1020
- this.transport.sendHeatmapData(Object.assign({ type: 'mousemove' }, move));
1022
+ this.transport.sendHeatmapData(Object.assign({ type: 'mousemove', anonymousId: this.anonymousId, sessionId: this.sessionId }, move));
1021
1023
  });
1022
1024
  this.mouseMoveData = [];
1023
1025
  }
@@ -13931,12 +13933,11 @@ class DevSkinSDK {
13931
13933
  // Merge default heatmap config with user config
13932
13934
  const heatmapConfig = Object.assign({ enabled: true, trackClicks: true, trackScroll: true, trackMouseMovement: true, mouseMoveSampling: 0.1 }, this.config.heatmapOptions);
13933
13935
  this.config.heatmapOptions = heatmapConfig;
13934
- this.heatmapCollector = new HeatmapCollector(this.config, this.transport);
13936
+ this.heatmapCollector = new HeatmapCollector(this.config, this.transport, this.anonymousId, this.sessionId);
13935
13937
  this.heatmapCollector.start();
13936
13938
  // Initialize screenshot collector and capture page
13937
13939
  this.screenshotCollector = new ScreenshotCollector(this.config, this.transport);
13938
- // Send only the pathname (not full URL) for consistent hashing
13939
- this.screenshotCollector.captureAndSend(this.sessionId, window.location.pathname);
13940
+ this.screenshotCollector.captureAndSend(this.sessionId, window.location.href);
13940
13941
  if (this.config.debug) {
13941
13942
  console.log('[DevSkin] Heatmap collection enabled (always on)');
13942
13943
  }
@@ -14007,7 +14008,7 @@ class DevSkinSDK {
14007
14008
  userId: this.userId || undefined,
14008
14009
  anonymousId: this.anonymousId || undefined,
14009
14010
  properties: Object.assign(Object.assign({}, properties), this.getContextData()),
14010
- pageUrl: window.location.pathname,
14011
+ pageUrl: window.location.href,
14011
14012
  pageTitle: document.title,
14012
14013
  };
14013
14014
  (_a = this.transport) === null || _a === void 0 ? void 0 : _a.sendEvent(eventData);