Socket
Book a DemoInstallSign in
Socket

@splunk/otel-web-session-recorder

Package Overview
Dependencies
Maintainers
14
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@splunk/otel-web-session-recorder

Session recorder for Splunk Observability

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
4.1K
-21.07%
Maintainers
14
Weekly downloads
 
Created
Source

@splunk/otel-web-session-recorder

🚀 Installation & Setup⚙️ Configuration🛠️ Troubleshooting📚 API Reference

Latest GitHub release version npm package version Apache 2.0 License Bundle size

For complete instructions for how to get started with the Splunk distribution of OpenTelemetry JavaScript for Web, see Install the Browser RUM agent for Splunk RUM, Instrument browser-based web applications for Splunk RUM and Record browser sessions.

Privacy-aware visual session replay for web applications. The Splunk Session Recorder extends @splunk/otel-web with comprehensive session recording capabilities, correlating visual user interactions with OpenTelemetry telemetry for enhanced debugging and user experience analysis.

🚀 Installation & Setup

Package Manager Installation

1. Install the Packages

# Install both core RUM and session recorder
npm install @splunk/otel-web @splunk/otel-web-session-recorder
# or
pnpm add @splunk/otel-web @splunk/otel-web-session-recorder
# or
yarn add @splunk/otel-web @splunk/otel-web-session-recorder

2. Initialize RUM and Session Recorder

import { SplunkRum } from '@splunk/otel-web'
import SplunkSessionRecorder from '@splunk/otel-web-session-recorder'

// Initialize core RUM first
SplunkRum.init({
	realm: 'us1',
	rumAccessToken: 'YOUR_RUM_ACCESS_TOKEN',
	applicationName: 'my-web-app',
	deploymentEnvironment: 'production',
})

// Then initialize session recorder
SplunkSessionRecorder.init({
	realm: 'us1',
	rumAccessToken: 'YOUR_RUM_ACCESS_TOKEN',
})

CDN Installation

1. Load the Scripts

<!-- Load core RUM first -->
<script
	src="https://cdn.signalfx.com/o11y-gdi-rum/<version>/splunk-otel-web.js"
	crossorigin="anonymous"
	integrity="sha384-<integrity>"
></script>

<!-- Then load session recorder -->
<script
	src="https://cdn.signalfx.com/o11y-gdi-rum/<version>/splunk-session-recorder.js"
	crossorigin="anonymous"
	integrity="sha384-<integrity>"
></script>

Replace <version> and <integrity> with the values from GitHub Releases.

2. Initialize RUM and Session Recorder

<script>
	// Initialize core RUM first
	SplunkRum.init({
		realm: 'us1',
		rumAccessToken: 'YOUR_RUM_ACCESS_TOKEN',
		applicationName: 'my-web-app',
		deploymentEnvironment: 'production',
	})

	// Then initialize session recorder
	SplunkSessionRecorder.init({
		realm: 'us1',
		rumAccessToken: 'YOUR_RUM_ACCESS_TOKEN',
	})
</script>

Complete CDN Example

<!DOCTYPE html>
<html>
	<head>
		<title>My Web App with Session Recording</title>

		<!-- Load Splunk RUM -->
		<script
			src="https://cdn.signalfx.com/o11y-gdi-rum/<version>/splunk-otel-web.js"
			crossorigin="anonymous"
			integrity="sha384-<integrity>"
		></script>

		<!-- Load Session Recorder -->
		<script
			src="https://cdn.signalfx.com/o11y-gdi-rum/<version>/splunk-session-recorder.js"
			crossorigin="anonymous"
			integrity="sha384-<integrity>"
		></script>

		<script>
			// Initialize RUM first
			SplunkRum.init({
				realm: 'us1',
				rumAccessToken: 'YOUR_RUM_ACCESS_TOKEN',
				applicationName: 'my-web-app',
				deploymentEnvironment: 'production',
			})

			// Then initialize session recorder
			SplunkSessionRecorder.init({
				realm: 'us1',
				rumAccessToken: 'YOUR_RUM_ACCESS_TOKEN',
				debug: false, // Set to true for development
			})
		</script>
	</head>
	<body>
		<!-- Your app content -->
	</body>
</html>

⚠️ Important: Always call SplunkRum.init() before SplunkSessionRecorder.init().

⚙️ Configuration Options

OptionTypeRequiredDefaultDescription
realmstring-Splunk realm (us0, us1, eu0, etc.)
rumAccessTokenstring-RUM access token for authentication
beaconEndpointstring-Custom destination URL for captured data (overrides realm)
debugbooleanfalseEnable debug logging
persistFailedReplayDatabooleantrueStore failed uploads in localStorage for retry
maskAllInputsbooleantrueMask all form input values
maskAllTextbooleanfalseMask all text content
sensitivityRulesSensitivityRule[][]Custom rules for masking, unmasking, or excluding elements
features.canvasbooleanfalseRecord canvas elements
features.iframesbooleanfalseRecord iframe content
features.videobooleanfalseRecord video elements
features.cacheAssetsbooleantrueCache assets for replay
features.packAssetsboolean | PackAssetsConfigtruePack assets to reduce payload size
maxExportIntervalMsnumber5000Maximum interval between data exports (milliseconds)
logLevel'debug' | 'info' | 'warn' | 'error''warn'Logging level for session recorder

Sensitivity Rules Configuration

interface SensitivityRule {
	rule: 'mask' | 'unmask' | 'exclude'
	selector: string // CSS selector
}

// Example usage
SplunkSessionRecorder.init({
	realm: 'us1',
	rumAccessToken: 'YOUR_RUM_ACCESS_TOKEN',
	sensitivityRules: [
		{ rule: 'mask', selector: '.sensitive-data' },
		{ rule: 'exclude', selector: '.payment-form' },
		{ rule: 'unmask', selector: '.public-content' },
	],
})

Asset Packing Configuration

interface PackAssetsConfig {
	fonts?: boolean // Pack font assets
	styles?: boolean // Pack CSS styles
	images?:
		| boolean
		| {
				onlyViewportImages?: boolean // Only pack visible images
				pack?: boolean // Enable image packing
				quality?: number // JPEG quality (0-1)
		  }
}

// Example usage
SplunkSessionRecorder.init({
	realm: 'us1',
	rumAccessToken: 'YOUR_RUM_ACCESS_TOKEN',
	features: {
		packAssets: {
			fonts: true,
			styles: true,
			images: {
				onlyViewportImages: true,
				pack: true,
				quality: 0.8,
			},
		},
	},
})

Complete Configuration Example

import SplunkSessionRecorder from '@splunk/otel-web-session-recorder'

SplunkSessionRecorder.init({
	// Required settings
	realm: 'us1',
	rumAccessToken: 'YOUR_RUM_ACCESS_TOKEN',

	// Optional: Custom endpoint (overrides realm)
	beaconEndpoint: 'https://custom-endpoint.com/v1/rumreplay',

	// Privacy & Security
	maskAllInputs: true,
	maskAllText: false,
	sensitivityRules: [
		{ rule: 'exclude', selector: '.payment-form' },
		{ rule: 'mask', selector: '.sensitive-data' },
		{ rule: 'unmask', selector: '.public-info' },
	],

	// Feature Control
	features: {
		canvas: false, // Skip canvas recording for privacy
		iframes: false, // Skip iframe content
		video: false, // Skip video elements
		cacheAssets: true, // Cache assets for better replay
		packAssets: {
			// Optimize asset packing
			fonts: true,
			styles: true,
			images: {
				onlyViewportImages: true,
				pack: true,
				quality: 0.7,
			},
		},
	},

	// Performance
	maxExportIntervalMs: 5000, // Export data every 5 seconds
	logLevel: 'warn', // Log warnings and errors only

	// Advanced
	debug: false, // Disable debug logging
	persistFailedReplayData: true, // Store failed uploads for retry
})

🛠️ Troubleshooting

For troubleshooting issues with the Splunk Session Recorder, see Troubleshoot browser instrumentation for Splunk Observability Cloud in the official documentation.

📚 API Reference

SplunkSessionRecorder Class

Static Methods

MethodParametersReturnsDescription
init(config)SessionRecorderConfigvoidInitialize session recorder
start()-voidStart recording current session
stop()-voidStop recording current session
interface SessionRecorderConfig {
	// Required
	realm: string
	rumAccessToken: string

	// Privacy
	maskAllInputs?: boolean
	maskAllText?: boolean
	sensitivityRules?: SensitivityRule[]

	// Feature Control
	features?: {
		canvas?: boolean
		iframes?: boolean
		video?: boolean
		cacheAssets?: boolean
		packAssets?: boolean | PackAssetsConfig
	}

	// Performance
	maxExportIntervalMs?: number
	logLevel?: 'debug' | 'info' | 'warn' | 'error'

	// Advanced
	debug?: boolean
	beaconEndpoint?: string
	persistFailedReplayData?: boolean
}

interface SensitivityRule {
	rule: 'mask' | 'unmask' | 'exclude'
	selector: string
}

interface UserInfo {
	id?: string
	email?: string
	attributes?: Record<string, string>
}

License

Licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

ℹ️  SignalFx was acquired by Splunk in October 2019. See Splunk SignalFx for more information.

Keywords

splunk

FAQs

Package last updated on 01 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts