Skip to content

Feature Request: React Native Offline Support #192

@Miguel-A-Jara

Description

@Miguel-A-Jara

📌 Summary

We are actively using Openpanel in our mobile analytics workflow. While event tracking works seamlessly in online mode, there is currently no built-in offline support for React Native.
In many mobile environments, users may temporarily lose connectivity (e.g., during travel, in rural areas, or when switching networks). This results in dropped events and incomplete analytics.

🚨 Problem

At present, Openpanel in React Native apps requires an active network connection to send events in real time. This creates issues in scenarios where:

  • The user is offline when interacting with the app (events are lost).
  • Mobile network switches cause brief disconnections during usage.
  • Long-running sessions in offline environments (e.g., flights, underground transport) are not tracked.
  • Events cannot be retroactively synchronized once connectivity returns.

This gap leads to incomplete datasets and reduced accuracy in user behavior analysis.

✅ Proposed Solution

Introduce offline event queueing for the React Native SDK:

  1. Queue Storage

    • Store events locally (e.g., in AsyncStorage or SQLite) when no internet connection is detected.
    • Events should include all necessary metadata and timestamps.
  2. Automatic Synchronization

    • On reconnection, the SDK should automatically send queued events to the Openpanel server in chronological order.
    • Include retry mechanisms and backoff strategies for failed transmissions.
  3. Configurable Options

    • Max queue size before discarding oldest events.
    • Optional flush interval.
    • Developer hooks for onFlush and onQueue events.

🔍 Key Benefits

  • Data Completeness — Ensures no events are lost due to temporary disconnections.
  • Improved Accuracy — Offline behavior is accurately reflected in analytics.
  • Better User Experience — Tracking works without requiring constant network checks from the developer.
  • Resilience — Handles unstable network conditions gracefully.

🔧 Suggested SDK Integration

  • Extend the React Native SDK with an offlineQueue: true/false configuration option.

  • Expose public methods:

    • flushQueue() — manually trigger sending queued events.
    • clearQueue() — clear stored events without sending.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions