Mobile SDK
Mobile SDK overview
Why the Nerja mobile SDK exists, what it captures, what it needs from you and from the user.
Why use the SDK#
The Nerja Tag only sees your website. If people also use your app, the SDK makes them the same lead: their app events, their push token and their purchases join their website history, so a cart abandoned on the web can be recovered with a push to their phone — and a tap opens the right screen of your app.
What it does for you#
- Registers and refreshes the device's FCM token and links it to the signed-in user.
- Sends events you track (
app_openis automatic) andidentifycalls. - Retries on a flaky network — requests are kept on the device and replayed.
- Shows pushes that arrive while your app is open, with image and button.
- Reports delivered / opened / clicked back to Nerja.
- Routes a tapped push to the right screen — deep links.
What it needs#
| Need | Why | Where it comes from |
|---|---|---|
| An app key (nak_pk_…) | Authenticates the app's event and token writes | Nerja → AI Connectors → Firebase → your app |
| Your app id (package / bundle id) | Ties the key to your app, so a key leaked from one app is useless in another | Your app |
| A Firebase project connected in Nerja | Nerja sends pushes through your Firebase project | Push setup |
| Firebase config in the app | The app needs it to obtain an FCM token | google-services.json / GoogleService-Info.plist |
End-to-end flow#
- 1Nerja.init(appKey)
- 2request a push token
- 3token
- 4POST /v1/devices — token + app id
- 5identify(user, userHash?)
- 6POST /v1/identify — token is now this person's
- You connect Firebase in Nerja (service-account JSON).
- Your app starts the SDK; the device gets an FCM token and registers it.
- The user signs in; your app calls
identify— the token is now attached to that person. - A campaign (audience or event) targets that person; Nerja sends through Firebase.
- The user taps; the SDK reports it and opens your app at the right place.
App key and app id#
The app key is public (like the web tag key) — it is meant to ship inside the app. It can only write events and tokens, never read your data. Nerja checks the request's X-Nerja-App-Id against the app ids allowed for the key.
Tip
Prefer to talk it through? Book a 30-minute call with the Nerja team.
Something unclear or missing? Email support@nerja.ai and we will improve this page.