SDK overview
Easily integrate with the Invitebase SDK for web, iOS, Android, React Native, or Flutter
Invitebase offers native SDKs across all major mobile and web platforms. Integrate the native SDKs with just a few lines of code to begin growing your app with referrals in just a few hours.
If you want the fastest path to a working referral, start by integrating your app instead.
Anonymous-first identity
The SDK works fully with no identify() call. At configure() it generates a stable anonymous ID, persisted per platform (Keychain on iOS, EncryptedSharedPreferences on Android, localStorage on web). Everything — event tracking, referral attribution, qualification-gate progress — binds to that anonymous ID.
This is structural, not a convenience: a referee's most important moments (install, first open, attribution resolution, early qualifying actions) usually happen before signup. If tracking started at identify(), the front of every funnel would be lost.
When the user signs up, call identify(user). The anonymous history — events, attribution, gate progress — merges onto the identified user server-side, and events ingested under the anonymous ID count toward qualification after the merge. The merge is idempotent and handles every ordering: attribute → events → identify, identify → more events, identifying into an existing user with prior history, and two devices identifying as the same user.
Read more in Users & identity.
Reactive change observers
Apps should react the moment referral state changes — confetti when a reward lands, a progress strip that updates live as a referee completes gates — without writing polling code. Every SDK exposes an observer surface in its platform's native idiom:
| Platform | Idiom |
|---|---|
| Web/JS | Event emitter — invitebase.on('rewardsChanged', …) |
| iOS | InvitebaseDelegate, plus AsyncSequence and Combine publishers |
| Android | Listener interface, plus Kotlin Flow |
| React Native | Hooks — components re-render automatically |
| Flutter | Streams — widgets rebuild automatically |
Changes reach the device via smart refresh: the SDK re-fetches on app foreground, after SDK-initiated actions, and on a modest interval while referral surfaces are visible. There is no persistent connection to manage.
Platform support
| Web | iOS | Android | React Native | Flutter | |
|---|---|---|---|---|---|
| Package | @invitebase/js (npm) | InvitebaseSDK (SPM) | com.invitebase:sdk (Maven Central) | @invitebase/react-native (npm) | invitebase_flutter (pub.dev) |
| Core surface | Supported | Supported | Supported | Supported | Supported |
| Deferred attribution | URL params + first-party cookie | Clipboard handoff | Play Install Referrer | Native (per OS) | Native (per OS) |
| Already-installed deep links | — | Universal Links | App Links | Both | Both |
| Observers | Event emitter | Delegate / async / Combine | Listener / Flow | Hooks | Streams |
| Drop-in UI components | Web components | SwiftUI | Compose | RN components | Widgets |
Drop-in UI components
Each SDK ships themeable default screens for the moments every referral campaign needs, all fully replaceable with custom UI built on the same SDK calls:
- Invite screen — offer headline, the user's link/code with copy affordance, native share sheet, optional tier-progress strip.
- Referrer status page — invitees with per-referral state, gate-progress hints, tier ladder, earnings.
- Code-entry screen — manual referral-code entry with validation states, in strong and soft prominence variants.
- Referee welcome moment — confirmation after attribution resolves: who invited them and what they got.
- Campaign banner — a one-line call-out ("Earn $10 per friend — 2 referrals to your next tier") for home screens and paywalls.
Theming is driven by the same per-campaign configuration as your hosted referral pages, so every surface matches.
What's next
Install @invitebase/js and handle URL-param and cookie attribution.
iOS setupInstall InvitebaseSDK, wire Universal Links, and the clipboard handoff.
Android setupInstall the SDK, wire App Links, and Play Install Referrer attribution.
React Native setupInstall @invitebase/react-native, the Expo plugin, provider, and deep links.