@devskin/browser-sdk 1.0.42 → 1.0.45
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.
- package/dist/devskin.cjs.js +42 -12
- package/dist/devskin.cjs.js.map +1 -1
- package/dist/devskin.esm.js +42 -12
- package/dist/devskin.esm.js.map +1 -1
- package/dist/devskin.umd.js +42 -12
- package/dist/devskin.umd.js.map +1 -1
- package/dist/devskin.umd.min.js +4 -4
- package/dist/devskin.umd.min.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/devskin.umd.js
CHANGED
|
@@ -13970,6 +13970,14 @@
|
|
|
13970
13970
|
console.warn('[DevSkin] SDK already initialized or initializing');
|
|
13971
13971
|
return;
|
|
13972
13972
|
}
|
|
13973
|
+
// CRITICAL: Skip ALL initialization for bots/crawlers (SEO optimization)
|
|
13974
|
+
// This ensures ZERO performance impact on Google PageSpeed, Lighthouse, etc.
|
|
13975
|
+
if (this.isBot()) {
|
|
13976
|
+
if (config.debug) {
|
|
13977
|
+
console.log('[DevSkin] Bot/crawler detected - SDK disabled for SEO optimization');
|
|
13978
|
+
}
|
|
13979
|
+
return;
|
|
13980
|
+
}
|
|
13973
13981
|
// Mark as initializing to prevent duplicate init() calls
|
|
13974
13982
|
this.initializing = true;
|
|
13975
13983
|
this.config = Object.assign({ debug: false, captureWebVitals: true, captureNetworkRequests: true, captureErrors: true, captureUserAgent: true, captureLocation: true, captureDevice: true, heatmapOptions: {
|
|
@@ -14020,17 +14028,15 @@
|
|
|
14020
14028
|
}
|
|
14021
14029
|
// Initialize session recording with rrweb
|
|
14022
14030
|
if ((_a = this.config.sessionRecording) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
14023
|
-
// Skip recording for bots/crawlers to avoid impacting SEO
|
|
14024
|
-
const isBot = this.isBot();
|
|
14025
14031
|
// Apply session sampling - decide if this session should be recorded
|
|
14026
14032
|
const samplingRate = this.config.sessionRecording.sampling || 1.0;
|
|
14027
|
-
const shouldRecord =
|
|
14033
|
+
const shouldRecord = Math.random() < samplingRate;
|
|
14028
14034
|
if (shouldRecord) {
|
|
14029
14035
|
// Use RRWebRecorder for complete DOM recording
|
|
14030
14036
|
// Pass sessionStartTime to ensure timestamp continuity across page navigations
|
|
14031
14037
|
this.rrwebRecorder = new RRWebRecorder(this.sessionId, {
|
|
14032
14038
|
enabled: true,
|
|
14033
|
-
mouseMoveSampleRate: 0.5, // Sample
|
|
14039
|
+
mouseMoveSampleRate: 0.5, // Sample 50% of mouse movements to reduce bandwidth
|
|
14034
14040
|
blockClass: 'rr-block',
|
|
14035
14041
|
ignoreClass: this.config.sessionRecording.ignoreClass || 'rr-ignore',
|
|
14036
14042
|
maskAllInputs: this.config.sessionRecording.maskAllInputs !== undefined
|
|
@@ -14060,12 +14066,7 @@
|
|
|
14060
14066
|
}
|
|
14061
14067
|
else {
|
|
14062
14068
|
if ((_c = this.config) === null || _c === void 0 ? void 0 : _c.debug) {
|
|
14063
|
-
|
|
14064
|
-
console.log(`[DevSkin] Session ${this.sessionId} skipped recording (bot/crawler detected for SEO optimization)`);
|
|
14065
|
-
}
|
|
14066
|
-
else {
|
|
14067
|
-
console.log(`[DevSkin] Session ${this.sessionId} not sampled for recording (sampling: ${samplingRate * 100}%)`);
|
|
14068
|
-
}
|
|
14069
|
+
console.log(`[DevSkin] Session ${this.sessionId} not sampled for recording (sampling: ${samplingRate * 100}%)`);
|
|
14069
14070
|
}
|
|
14070
14071
|
}
|
|
14071
14072
|
}
|
|
@@ -14370,9 +14371,38 @@
|
|
|
14370
14371
|
}
|
|
14371
14372
|
}
|
|
14372
14373
|
// Create singleton instance
|
|
14373
|
-
const
|
|
14374
|
+
const sdk = new DevSkinSDK();
|
|
14375
|
+
// Command processor function (Hotjar-style API)
|
|
14376
|
+
function DevSkin(command, ...args) {
|
|
14377
|
+
if (typeof sdk[command] === 'function') {
|
|
14378
|
+
sdk[command](...args);
|
|
14379
|
+
}
|
|
14380
|
+
else {
|
|
14381
|
+
console.warn(`[DevSkin] Unknown command: ${command}`);
|
|
14382
|
+
}
|
|
14383
|
+
}
|
|
14384
|
+
// Process queued commands from async loader
|
|
14385
|
+
if (typeof window !== 'undefined' && window.DevSkin) {
|
|
14386
|
+
const stub = window.DevSkin;
|
|
14387
|
+
if (stub.q && Array.isArray(stub.q)) {
|
|
14388
|
+
// Process all queued commands
|
|
14389
|
+
stub.q.forEach((args) => {
|
|
14390
|
+
if (args.length > 0) {
|
|
14391
|
+
DevSkin(args[0], ...args.slice(1));
|
|
14392
|
+
}
|
|
14393
|
+
});
|
|
14394
|
+
}
|
|
14395
|
+
// Preserve load time
|
|
14396
|
+
if (stub.l) {
|
|
14397
|
+
DevSkin.l = stub.l;
|
|
14398
|
+
}
|
|
14399
|
+
// Replace stub with real function
|
|
14400
|
+
window.DevSkin = DevSkin;
|
|
14401
|
+
}
|
|
14402
|
+
// For UMD/global access, also expose singleton methods directly
|
|
14403
|
+
Object.assign(DevSkin, sdk);
|
|
14374
14404
|
|
|
14375
|
-
return
|
|
14405
|
+
return sdk;
|
|
14376
14406
|
|
|
14377
14407
|
}));
|
|
14378
14408
|
//# sourceMappingURL=devskin.umd.js.map
|