Commit 419231d
authored
feat(posthog): Add session recording support (#632)
* Add session replay and error tracking features to PostHog Capacitor plugin
Implemented comprehensive session replay and error tracking capabilities across iOS, Android, and Web platforms for the PostHog Capacitor plugin.
**Key Changes:**
- Added `captureException()` method to capture and track errors with optional properties
- Added `startSessionRecording()` and `stopSessionRecording()` methods with configurable sampling and linked flag options
- Updated TypeScript definitions with new interfaces: `CaptureExceptionOptions` and `StartSessionRecordingOptions`
- Extended Capacitor configuration interface with session replay and error tracking options
- Implemented platform-specific option classes for iOS (Swift) and Android (Java)
- Updated configuration handling to automatically enable features based on plugin config
- Enhanced web implementation using posthog-js session recording and exception capture APIs
- Added iOS implementation using PostHog iOS SDK methods
- Added Android implementation using PostHog Android SDK methods
**Configuration Options Added:**
- `enableSessionReplay`: Auto-enable session recording on app start
- `sessionReplaySampling`: Set sampling rate (0.0 to 1.0, default 1.0)
- `sessionReplayLinkedFlag`: Enable linked flags for session recording
- `enableErrorTracking`: Auto-enable error tracking
These changes provide a unified, cross-platform API for session replay and error tracking while maintaining backward compatibility.
* Add changeset to branch
* Simplify changeset and change to minor change
* Request Changes
Commit includes:
- Revert changes to root package.json and posthog package.json
- Sort definitions correctly
- Update version in definitions
- Remove undefined type
- Remove capacitor config from web package
* Sort alphabetically for SetupOptions
* Revert package-lock
* Fix Session Replays & Error tracking
This commit includes the following:
- Remove error tracking from iOS (unsupported)
- Fix session replays for android and iOS
* Fix android compile failure
* Fix linting issues
* Updates to web types and definitions
* feat(rm-error-tracking): Remove error tracking to make minor bump
* Fix commented out setup and remove remain error capture code
* revert package-lock and update changeset
* Resolve type issues for PostHogConfig
* remove error tracking types and add jvm target
* Fix Kotlin Options
* Fix linting errors1 parent 045ed28 commit 419231d
18 files changed
Lines changed: 525 additions & 83 deletions
File tree
- .changeset
- packages/posthog
- android/src/main/java/io/capawesome/capacitorjs/plugins/posthog
- classes/options
- ios
- Plugin.xcodeproj
- Plugin
- Classes/Options
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
0 commit comments