@tryappdata/react-native
v0.1.0
Published
appdata Live Users SDK for React Native — drop-in real-user presence for the appdata globe. No location permission, no PII.
Downloads
21
Maintainers
Readme
@tryappdata/react-native
Drop-in Live Users SDK for React Native. Your real users light up the appdata globe, live and worldwide — with no location permission, no cookies, and no PII unless you explicitly pass an avatar.
Install
npm i @tryappdata/react-native
# recommended (persists the anon id across launches so appdata can tell
# new vs returning users):
npm i @react-native-async-storage/async-storageUse
import { appdata } from '@tryappdata/react-native'
// once, at app root
appdata.init({ key: 'pk_…', appVersion: '2.3.1' })That's the whole required integration. The SDK creates an anonymous id, then heartbeats every 60s only while the app is foregrounded (it pauses in the background and resumes on return) — you write none of that.
Optional:
// when the visible screen changes — founders see this verbatim
appdata.screen('Paywall')
// attach a logged-in user's avatar (pass only with consent)
appdata.identify({ id: user.id, avatarUrl: user.photoURL })
// back to anonymous, e.g. on logout
appdata.reset()What's sent
{ key, anonId, platform, appVersion?, screen?, avatarUrl? } to
POST <host>/api/ingest/presence. Country/city are derived server-side
from the request IP and the IP is discarded — the SDK never sends or
sees a location, and never asks for a location permission.
Privacy & consent
You are the data controller for your end-users. The SDK is anonymous by default — no IP, location, cookies, or device id ever leave the device, and it requests no location permission (country is derived server-side from the request IP, which is then discarded).
If you call identify:
- pass
avatarUrlonly with the user's consent; - never pass emails, names, or other PII in any field;
- gate
initbehind your own consent flow where your jurisdiction requires it.
The pk_… key is public by design (like a Segment/PostHog write
key): write-only presence for one app, no read access, no secrets.
Config
| Field | Required | Notes |
|--------------|----------|--------------------------------------------------|
| key | yes | Public ingest key (pk_…) from the dashboard. |
| appVersion | no | Your app version; shown to you as exact data. |
| host | no | Override the appdata origin (defaults to prod). |
| debug | no | Log heartbeat failures to the console. |
Pings are fire-and-forget and never throw into your app. ~1 tiny request per minute while foregrounded → negligible battery/data.
Full wire spec: ../LIVE-USERS-CONTRACT.md.
