Skip to content

feat(error-tracking): PostHog Error Tracking #645

@riley-wv

Description

@riley-wv

Plugin(s)

  • Accelerometer
  • Android Battery Optimization
  • Android Dark Mode Support
  • Android Edge-to-Edge Support
  • Android Foreground Service
  • App Review
  • App Shortcuts
  • App Update
  • Asset Manager
  • Audio Recorder
  • Background Task
  • Badge
  • Barometer
  • Bluetooth Low Energy
  • Cloudinary
  • Contacts
  • Datetime Picker
  • File Compressor
  • File Opener
  • File Picker
  • Live Update
  • Managed Configurations
  • NFC
  • Pedometer
  • Photo Editor
  • Posthog
  • Printer
  • Screen Orientation
  • Screenshot
  • Speech Recognition
  • Speech Synthesis
  • SQLite
  • Torch
  • Zip

Current problem

The PostHog plugin lacks built-in support for error tracking capabilities, which is an essential feature available in the native PostHog SDKs. Users cannot easily enable exceptions capturing without manually implementing workarounds.

Preferred solution

Add native error tracking features to the PostHog Capacitor plugin with:

  1. Error Tracking:

    • captureException() - Capture and track exceptions with optional properties
    • autoCaptureExceptions - Add exceptions auto capture to Android
  2. Cross-Platform Support:

    • Implement using PostHog JS SDK for web
    • Implement using PostHog iOS SDK for iOS
    • Implement using PostHog Android SDK for Android

This solution provides a consistent API across all platforms and follows PostHog's official SDK patterns.

Alternative options

  1. Manual Implementation: Users could manually integrate PostHog SDKs alongside the Capacitor plugin, but this creates complexity and inconsistency.

  2. Third-Party Plugins: Use separate plugins for error tracking, but this doesn't integrate well with PostHog's analytics.

  3. Web-Only Solution: Only implement for web platform using PostHog JS, but this leaves mobile platforms unsupported.

Additional context

  • Error tracking integration provides better context when exceptions occur during recorded sessions
  • All features are opt-in and maintain backward compatibility with existing implementations

Before submitting

  • I have read and followed the feature request guidelines.
  • I have attached links to possibly related issues and discussions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions