Cross-platform ports of the AnalyticsDrop iOS SDK:
one-line screen-journey analytics that batch and upload to POST {endpoint}/v1/events.
| SDK | Path | Platform | Package |
|---|---|---|---|
| Flutter | analyticsdrop-sdk-flutter | iOS & Android (Flutter) | analyticsdrop (Dart) |
| React Native | react-native/ |
iOS & Android (RN) | @analyticsdrop/react-native |
| Web | web/ |
Browsers / Next.js / any SPA | @analyticsdrop/web |
| shared core | core/ |
— | @analyticsdrop/core |
All SDKs implement the same behavior and wire format as iOS. The only per-platform difference is how screens are auto-captured:
| iOS | Flutter | React Native | Web | |
|---|---|---|---|---|
| Screen capture | viewDidAppear swizzle + SwiftUI fingerprint |
NavigatorObserver |
React Navigation route | history / popstate route |
| Persistence | Keychain + Caches file | path_provider files |
AsyncStorage (or memory) | localStorage (or memory) |
| App lifecycle | UIApplication notifications |
WidgetsBindingObserver |
AppState |
Page Visibility API |
- Public API:
start(apiKey, …)·identify(userId)·track(event, properties)·setScreenName(name)+ automatic screen capture. - Sessions: begin on foreground; end after a 30 s background grace; per-session
seqcounter. - Batching: flush at 20 events, every 30 s, and on background.
- Screen-view debounce: identical fingerprint within 300 ms is dropped.
- Crash recovery: unsent events are persisted and resent on next launch.
- Transport:
POST {endpoint}/v1/events, headerX-AnalyticsDrop-Key, 2 retries with 1 s/2 s backoff. - Wire format:
{ batch: [{ type, eventId, anonymousId, userId?, sessionId, seq, ts, screen?, event?, context }] }with event typesscreen_view | track | identify | session_start | session_end. Nil optionals are omitted (e.g.userIdbeforeidentify).
@analyticsdrop/core is a platform-agnostic TypeScript port of the iOS SDK internals
(sessions, batching, identity, queue, transport, wire format). @analyticsdrop/react-native
and @analyticsdrop/web are thin adapter layers that plug platform-specific storage,
app-lifecycle and screen-capture into the core. The Flutter SDK is a standalone Dart
port of the same design.
This directory is an npm workspace (core, react-native, web).
npm install
npm run build # tsc -b across all three packages
npm test # builds, then runs the full test suite (node --test)
npm run build:web-snippet # bundle the drop-in web <script> (dist/analyticsdrop.js)npm test (a pretest hook builds dist/ first) runs, via Node's built-in
test runner:
- core — an end-to-end suite against a mock ingest server: full-session wire
contract, crash recovery, session grace /
seqreset, screen-view debounce, event-count auto-flush, transport retry/backoff, endpoint normalization, and UUID validity. - web — pure-function tests for route normalization and name derivation.
- react-native — the storage adapter's memory fallback.
The Flutter package has its own flutter test suite (wire-format encoding). It is
not run by npm test and requires the Flutter toolchain.
.npmrcsetslegacy-peer-deps=trueso the React Native peer deps (react-native, React Navigation) are not installed during development — the package type-checks against ambient shims and treats them as peers.
The Flutter package lives in its own repository —
analyticsdrop-sdk-flutter —
and is developed with the standard Flutter toolchain (flutter pub get, flutter test,
and cd example && flutter run for the auto-driving demo harness).
MIT — see LICENSE.
AnalyticsDrop is a product of Flywheel Studio.