Skip to content

Repository files navigation

AnalyticsDrop SDKs

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

Shared contract (identical everywhere)

  • 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 seq counter.
  • 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, header X-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 types screen_view | track | identify | session_start | session_end. Nil optionals are omitted (e.g. userId before identify).

Architecture

@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.

Developing the JS SDKs

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)

Tests

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 / seq reset, 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.

.npmrc sets legacy-peer-deps=true so 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).

License

MIT — see LICENSE.


AnalyticsDrop is a product of Flywheel Studio.

About

AnalyticsDrop cross-platform SDKs: @analyticsdrop/core, @analyticsdrop/react-native, @analyticsdrop/web

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages