@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.
@@ -863,9 +863,11 @@
863
863
  }
864
864
 
865
865
  class HeatmapCollector {
866
- constructor(config, transport) {
866
+ constructor(config, transport, anonymousId, sessionId) {
867
867
  this.config = config;
868
868
  this.transport = transport;
869
+ this.anonymousId = anonymousId;
870
+ this.sessionId = sessionId;
869
871
  this.clickData = [];
870
872
  this.scrollData = [];
871
873
  this.mouseMoveData = [];
@@ -930,7 +932,7 @@
930
932
  element: this.getElementSelector(target),
931
933
  elementId: target.id || undefined,
932
934
  elementClass: target.className || undefined,
933
- pageUrl: window.location.pathname,
935
+ pageUrl: window.location.href,
934
936
  timestamp: new Date().toISOString(),
935
937
  viewportWidth: window.innerWidth,
936
938
  viewportHeight: window.innerHeight,
@@ -958,7 +960,7 @@
958
960
  maxDepth: this.maxScrollDepth,
959
961
  pageHeight: documentHeight,
960
962
  viewportHeight: windowHeight,
961
- pageUrl: window.location.pathname,
963
+ pageUrl: window.location.href,
962
964
  timestamp: new Date().toISOString(),
963
965
  };
964
966
  this.scrollData.push(scrollData);
@@ -995,7 +997,7 @@
995
997
  const mouseMoveData = {
996
998
  x: event.clientX + window.scrollX,
997
999
  y: event.clientY + window.scrollY,
998
- pageUrl: window.location.pathname,
1000
+ pageUrl: window.location.href,
999
1001
  timestamp: new Date().toISOString(),
1000
1002
  };
1001
1003
  this.mouseMoveData.push(mouseMoveData);
@@ -1009,21 +1011,21 @@
1009
1011
  // Send clicks individually (backend expects one click event per item)
1010
1012
  if (this.clickData.length > 0) {
1011
1013
  this.clickData.forEach(click => {
1012
- this.transport.sendHeatmapData(Object.assign({ type: 'click' }, click));
1014
+ this.transport.sendHeatmapData(Object.assign({ type: 'click', anonymousId: this.anonymousId, sessionId: this.sessionId }, click));
1013
1015
  });
1014
1016
  this.clickData = [];
1015
1017
  }
1016
1018
  // Send scroll data individually
1017
1019
  if (this.scrollData.length > 0) {
1018
1020
  this.scrollData.forEach(scroll => {
1019
- this.transport.sendHeatmapData(Object.assign({ type: 'scroll' }, scroll));
1021
+ this.transport.sendHeatmapData(Object.assign({ type: 'scroll', anonymousId: this.anonymousId, sessionId: this.sessionId }, scroll));
1020
1022
  });
1021
1023
  this.scrollData = [];
1022
1024
  }
1023
1025
  // Send mouse moves individually
1024
1026
  if (this.mouseMoveData.length > 0) {
1025
1027
  this.mouseMoveData.forEach(move => {
1026
- this.transport.sendHeatmapData(Object.assign({ type: 'mousemove' }, move));
1028
+ this.transport.sendHeatmapData(Object.assign({ type: 'mousemove', anonymousId: this.anonymousId, sessionId: this.sessionId }, move));
1027
1029
  });
1028
1030
  this.mouseMoveData = [];
1029
1031
  }
@@ -13937,12 +13939,11 @@
13937
13939
  // Merge default heatmap config with user config
13938
13940
  const heatmapConfig = Object.assign({ enabled: true, trackClicks: true, trackScroll: true, trackMouseMovement: true, mouseMoveSampling: 0.1 }, this.config.heatmapOptions);
13939
13941
  this.config.heatmapOptions = heatmapConfig;
13940
- this.heatmapCollector = new HeatmapCollector(this.config, this.transport);
13942
+ this.heatmapCollector = new HeatmapCollector(this.config, this.transport, this.anonymousId, this.sessionId);
13941
13943
  this.heatmapCollector.start();
13942
13944
  // Initialize screenshot collector and capture page
13943
13945
  this.screenshotCollector = new ScreenshotCollector(this.config, this.transport);
13944
- // Send only the pathname (not full URL) for consistent hashing
13945
- this.screenshotCollector.captureAndSend(this.sessionId, window.location.pathname);
13946
+ this.screenshotCollector.captureAndSend(this.sessionId, window.location.href);
13946
13947
  if (this.config.debug) {
13947
13948
  console.log('[DevSkin] Heatmap collection enabled (always on)');
13948
13949
  }
@@ -14013,7 +14014,7 @@
14013
14014
  userId: this.userId || undefined,
14014
14015
  anonymousId: this.anonymousId || undefined,
14015
14016
  properties: Object.assign(Object.assign({}, properties), this.getContextData()),
14016
- pageUrl: window.location.pathname,
14017
+ pageUrl: window.location.href,
14017
14018
  pageTitle: document.title,
14018
14019
  };
14019
14020
  (_a = this.transport) === null || _a === void 0 ? void 0 : _a.sendEvent(eventData);