Recording Sessions
Control when and how sessions are recorded in your app.
Automatic Recording
By default, PipeKit starts recording automatically when your app launches (if autoStart: true in config). Recording continues until the app goes to background or you manually stop it.
Session Lifecycle
- 1App launches → Recording starts automatically
- 2App goes to background → Recording pauses, session saves
- 3App returns to foreground → New session starts
- 4Session uploads in background when WiFi available
Manual Control
For more control, disable auto-start and manage recording manually:
Manual Recording
// Disable auto-start in configlet config = PipeKitConfig(autoStart: false)PipeKit.shared.configure(apiKey: "your_key", config: config)// Start recording when readyPipeKit.shared.startRecording()// Stop recordingPipeKit.shared.stopRecording()// Check if currently recordingif PipeKit.shared.isRecording {print("Recording in progress...")}
Conditional Recording
Record only specific user flows or conditions:
Conditional Recording
// Record only specific screensclass CheckoutViewController: UIViewController {override func viewDidAppear(_ animated: Bool) {super.viewDidAppear(animated)PipeKit.shared.startRecording()}override func viewWillDisappear(_ animated: Bool) {super.viewWillDisappear(animated)PipeKit.shared.stopRecording()}}// Record based on user consentfunc userDidConsentToRecording() {PipeKit.shared.startRecording()}// Record only for specific user segmentsif user.isBetaTester {PipeKit.shared.startRecording()}
Custom Events & Markers
Add custom events to mark important moments in your sessions:
swift
// Log a message with attributesPipeKit.log("purchase_completed", attributes: ["product_id": "12345","amount": "29.99"])// Log a warningPipeKit.warning("Low memory detected")// Log an error with attributesPipeKit.error("Payment processing failed", attributes: ["gateway": "stripe","code": "card_declined"])
Upload Control
Sessions are uploaded automatically, but you can also trigger manual uploads:
swift
// Upload current session immediatelyPipeKit.shared.uploadCurrentSession { result inswitch result {case .success(let response):print("Session uploaded: \(response.sessionId)")case .failure(let error):print("Upload failed: \(error)")}}// Upload all pending sessionsSessionUploader.shared.uploadAllPendingSessions { results inprint("Uploaded \(results.count) sessions")}
Upload Timing
Sessions are automatically uploaded when the app goes to background or when you callstopRecording(). Manual upload is useful for ensuring critical sessions are saved immediately.
Next: User Identification
Learn how to link sessions to your users for easier debugging.
Continue to User Identification →