Skip to content

Conversation

@riley-wv
Copy link
Contributor

@riley-wv riley-wv commented Oct 21, 2025

  • Add error tracking to Android & Web plugins
  • Update documentation with new API methods and configuration options
  • Maintain backward compatibility with existing implementations
  • Update PostHog versions on iOS, Android & Web

Pull request checklist

Please check if your PR fulfills the following requirements:

  • The changes have been tested successfully.
  • A changeset has been created (npm run changeset).
  • I have read and followed the pull request guidelines.

Close #645

…lugin

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.
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
This commit includes the following:
- Remove error tracking from iOS (unsupported)
- Fix session replays for android and iOS
@robingenz
Copy link
Member

What about iOS?

@riley-wv
Copy link
Contributor Author

Error tracking isn't supported in iOS at the moment. Once it is, I will implement it

@robingenz
Copy link
Member

@riley-wv Please merge the latest changes.

…ror-tracking

# Conflicts:
#	packages/posthog/README.md
#	packages/posthog/src/definitions.ts
#	packages/posthog/src/web.ts
# Conflicts:
#	packages/posthog/README.md
#	packages/posthog/src/definitions.ts
#	packages/posthog/src/web.ts
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 12, 2025

Open in StackBlitz

@capawesome/capacitor-age-signals

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-age-signals@646

@capawesome-team/capacitor-android-battery-optimization

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome-team/capacitor-android-battery-optimization@646

@capawesome/capacitor-android-dark-mode-support

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-android-dark-mode-support@646

@capawesome/capacitor-android-edge-to-edge-support

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-android-edge-to-edge-support@646

@capawesome-team/capacitor-android-foreground-service

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome-team/capacitor-android-foreground-service@646

@capawesome/capacitor-app-review

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-app-review@646

@capawesome/capacitor-app-shortcuts

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-app-shortcuts@646

@capawesome/capacitor-app-update

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-app-update@646

@capawesome/capacitor-asset-manager

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-asset-manager@646

@capawesome/capacitor-background-task

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-background-task@646

@capawesome/capacitor-badge

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-badge@646

@capawesome/capacitor-cloudinary

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-cloudinary@646

@capawesome-team/capacitor-datetime-picker

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome-team/capacitor-datetime-picker@646

@capawesome-team/capacitor-file-opener

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome-team/capacitor-file-opener@646

@capawesome/capacitor-file-picker

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-file-picker@646

@capawesome/capacitor-libsql

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-libsql@646

@capawesome/capacitor-live-update

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-live-update@646

@capawesome/capacitor-managed-configurations

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-managed-configurations@646

@capawesome/capacitor-photo-editor

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-photo-editor@646

@capawesome/capacitor-posthog

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-posthog@646

@capawesome/capacitor-realtimekit

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-realtimekit@646

@capawesome/capacitor-screen-orientation

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-screen-orientation@646

@capawesome/capacitor-screenshot

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-screenshot@646

@capawesome/capacitor-torch

npm i https://pkg.pr.new/capawesome-team/capacitor-plugins/@capawesome/capacitor-torch@646

commit: a21f1ad

@riley-wv
Copy link
Contributor Author

@robingenz this has all been merged and error tracking logic re-added

@robingenz
Copy link
Member

@riley-wv Please take another look at your changes and clean them up. For example, the session replay changeset should not be needed as this is already merged.

@tlebeitsuk
Copy link

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(error-tracking): PostHog Error Tracking

3 participants