@devskin/browser-sdk 1.0.42 → 1.0.43

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.
@@ -13968,6 +13968,14 @@ class DevSkinSDK {
13968
13968
  console.warn('[DevSkin] SDK already initialized or initializing');
13969
13969
  return;
13970
13970
  }
13971
+ // CRITICAL: Skip ALL initialization for bots/crawlers (SEO optimization)
13972
+ // This ensures ZERO performance impact on Google PageSpeed, Lighthouse, etc.
13973
+ if (this.isBot()) {
13974
+ if (config.debug) {
13975
+ console.log('[DevSkin] Bot/crawler detected - SDK disabled for SEO optimization');
13976
+ }
13977
+ return;
13978
+ }
13971
13979
  // Mark as initializing to prevent duplicate init() calls
13972
13980
  this.initializing = true;
13973
13981
  this.config = Object.assign({ debug: false, captureWebVitals: true, captureNetworkRequests: true, captureErrors: true, captureUserAgent: true, captureLocation: true, captureDevice: true, heatmapOptions: {
@@ -14018,17 +14026,15 @@ class DevSkinSDK {
14018
14026
  }
14019
14027
  // Initialize session recording with rrweb
14020
14028
  if ((_a = this.config.sessionRecording) === null || _a === void 0 ? void 0 : _a.enabled) {
14021
- // Skip recording for bots/crawlers to avoid impacting SEO
14022
- const isBot = this.isBot();
14023
14029
  // Apply session sampling - decide if this session should be recorded
14024
14030
  const samplingRate = this.config.sessionRecording.sampling || 1.0;
14025
- const shouldRecord = !isBot && Math.random() < samplingRate;
14031
+ const shouldRecord = Math.random() < samplingRate;
14026
14032
  if (shouldRecord) {
14027
14033
  // Use RRWebRecorder for complete DOM recording
14028
14034
  // Pass sessionStartTime to ensure timestamp continuity across page navigations
14029
14035
  this.rrwebRecorder = new RRWebRecorder(this.sessionId, {
14030
14036
  enabled: true,
14031
- mouseMoveSampleRate: 0.5, // Sample 10% of mouse movements to reduce bandwidth
14037
+ mouseMoveSampleRate: 0.5, // Sample 50% of mouse movements to reduce bandwidth
14032
14038
  blockClass: 'rr-block',
14033
14039
  ignoreClass: this.config.sessionRecording.ignoreClass || 'rr-ignore',
14034
14040
  maskAllInputs: this.config.sessionRecording.maskAllInputs !== undefined
@@ -14058,12 +14064,7 @@ class DevSkinSDK {
14058
14064
  }
14059
14065
  else {
14060
14066
  if ((_c = this.config) === null || _c === void 0 ? void 0 : _c.debug) {
14061
- if (isBot) {
14062
- console.log(`[DevSkin] Session ${this.sessionId} skipped recording (bot/crawler detected for SEO optimization)`);
14063
- }
14064
- else {
14065
- console.log(`[DevSkin] Session ${this.sessionId} not sampled for recording (sampling: ${samplingRate * 100}%)`);
14066
- }
14067
+ console.log(`[DevSkin] Session ${this.sessionId} not sampled for recording (sampling: ${samplingRate * 100}%)`);
14067
14068
  }
14068
14069
  }
14069
14070
  }