Before proceeding, you should have a program created on Partnero. If you haven’t created one yet, refer to the Knowledge Base for guidance.
How mobile referral tracking works
In a web integration, PartneroJS reads the referral key from the URL and stores it in a cookie. In a mobile app, your code does the same thing manually:- A partner or customer shares a referral link (e.g.,
yoursite.com?ref=PARTNER_KEY) - Someone taps the link on their phone
- Your app opens via a deep link and extracts the referral key from the URL
- When the user signs up, your app sends the referral key to your backend
- Your backend calls the Partnero API to create the customer with the referral attribution
- When the user makes a purchase, your backend records the transaction via the API
Prerequisites: Set up deep links
Before your app can receive referral links, configure deep linking so URLs on your domain open your app:iOS universal links
iOS universal links
- Add an
apple-app-site-associationfile to your domain’s.well-knowndirectory. - Configure Associated Domains in Xcode (
applinks:yoursite.com). - Handle incoming URLs in
SceneDelegateorAppDelegate.
Android app links
Android app links
- Add intent filters to your
AndroidManifest.xmlfor your domain. - Host a Digital Asset Links JSON file at
yoursite.com/.well-known/assetlinks.json. - Handle incoming intents in your activity.
React Native / Flutter
React Native / Flutter
Both iOS and Android native configurations above are still required. Use libraries like
react-native-linking (React Native) or app_links (Flutter) to handle incoming URLs in your framework code.Step 1: Extract and store the referral key
When your app opens from a referral link, parse the referral key from the URL and store it persistently. The default query parameter isref, but your program may use a different one (e.g., via).
- iOS (Swift)
- Android (Kotlin)
- React Native
- Flutter (Dart)
UserDefaults, SharedPreferences, AsyncStorage) so the key survives app restarts. If the user opens the app from a referral link but doesn’t sign up immediately, the key is still available later.
Step 2: Send the referral key during sign-up
When the user creates an account, include the stored referral key in your sign-up request to your backend. Your backend then passes it to the Partnero API. Your app → Your backend: Include the referral key alongside the normal sign-up data your app already sends:referral_key from the sign-up request and calls the Partnero API. The field name depends on your program type:
- Affiliate program
- Refer-a-friend program
Use
partner.key to attribute the customer to the referring partner:Step 3: Track transactions
When a user makes a purchase, your backend records the transaction:Step 4: Show referral data in-app (refer-a-friend)
For refer-a-friend programs, you can build an in-app referral screen showing the user their referral link, stats, and rewards. Fetch this data through your backend:Referral link and share stats
Use GET /v1/customers//stats to get the customer’s referral link, click count, and social sharing links:referral_link with a “Copy link” or “Share” button in your app.
Reward balance
Use GET /v1/customers//balance to show how much the user has earned from referrals:List of referred friends
Use GET /v1/customers//referrals to show who the user has referred:URL formats reference
Your Partnero program may use different URL formats. Make sure your app handles whichever one you’ve configured:| Format | Example URL | How to extract |
|---|---|---|
| Query parameter (default) | yoursite.com?ref=KEY | Parse ref query param |
| Custom parameter | yoursite.com?via=KEY | Parse your custom param name |
| Path-based | yoursite.com/KEY | Parse first path segment |
Best practices
- Use persistent storage for the referral key so it survives app restarts and delayed sign-ups
- Always call the Partnero API from your backend to keep your API key out of the mobile app
- Install PartneroJS on your website as a fallback for users who don’t have the app installed
- Clear the referral key after successful sign-up to prevent duplicate attributions
- Test with real devices since deep link behavior varies across iOS and Android versions
