Referrals
A referral has two halves. The SDK captures the referral code when the app is installed. Your app tells Flyy when the new user signs up, so the code is mapped to them and the referrer gets credited.
1. Install attribution
- Android
- iOS
Automatic. On first launch the SDK reads the Play Store install referrer,
sends the install event and stores the code. You call nothing.
iOS has no install referrer, so pass the universal link that opened the app. Without one the SDK uses a device fingerprint for attribution.
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
Flyy.startReferralTracking(userActivity: userActivity)
}
// No link? Call once on first launch:
Flyy.startReferralTracking()
It sends the install event only once per install.
2. Credit the referrer at signup
- Android
- iOS
Flyy.setUserWithReferralCode("user-1001")
Flyy.setUserWithReferralCode("user-1001") { /* referral mapped */ }
Flyy.setUserWithReferralCode("user-1001") { ok in /* referral mapped */ }
Call this only for new signups. For returning users use setUser.
Your own referral codes
If users enter a code by hand, or your own deep links carry one, set it before the signup call:
- Android
- iOS
Flyy.setReferrerCode("FRIEND50")
Flyy.setUserWithReferralCode("user-1001")
Flyy.setReferrerCode("FRIEND50")
Flyy.setUserWithReferralCode("user-1001")
Reading referral state
- Android
- iOS
Flyy.getReferrerCode() // captured code, or null for an organic install
Flyy.getReferrerDetails(this, object : FlyyFetchReferrerDetailsListener {
override fun onSuccess(flyyReferrerDetails: FlyyReferrerDetails) {
// flyyReferrerDetails.referrerName / .extReferrerId
}
override fun onFailure(message: String) { }
})
Flyy.getReferrerCode() // "" for an organic install
Flyy.getReferrerLink { ok, link in /* share link */ }
To show the full refer-and-earn screen, open REFERRALS — see Open screens.