How to implement referral program in mobile Apps for both Android and iPhone
Android
On android you can create an install broadcast listener, where you can get and save the referrer part of the link to SharedPreferences
https://play.google.com/store/apps/details?id=com.example.app&referrer=example_referral_code_here
For this check
Android - Is it possible to get install referrer programmatically
and
Get referrer after installing app from Android Market
and
https://developer.android.com/google/play/installreferrer/library.html
iOS
For now (Jan 2016) It is not possible to get the install referrer code in your app, like with android.
Options i had for ios were:
- user frameworks/3rd party services like alau.me
- a workaround with fingerprinting, similar to what Puru Pawar suggests
- just make the user enter the referral code inside your app
We are doing a similar type of referral system in our app which provides certain amount of Reward Points to the referrer (one who actually shared the link to app) on successful install of the app by new user (one who received the link).
I will try to explain our implementation using your scenario: So according to your user story:
Every new user (E.g John) is given a unique referral link, which he/she can share it to his friends using FB/TW/Email or SMS.
When John's friend clicks on the link, he is re-directed first to a Servlet which eventually redirects him to respective AppStore based on his platform (Android/iPhone) to download the app.
Note that we can find out the IP address, user agent and device model of the user who clicked the link using a Servlet.
We already know that the referral link belongs to John and hence the servlet maps the IP address,user agent and/or device model of John's friend to John's entry in database.
The moment John's friend installs the app, and opens the app, the application sends the IP address, user agent and/or device model to the server.
The server checks the entry against all the user to find the referrer and if it finds him, in our case John, John gets rewarded accordingly..
Thats it. We implemented this in the last month itself and it does increased our downloads. Let me know if that's helpful.
If anyone is still looking for solution to this question. I read a lot of blogs and documents for the same problem, and arrived at following conclusion:-
IP Address + User Agent + Device Model is not enough to identify a device uniquely. So, I think it will be better to use dynamic links. You can create dynamic links containing a unique id. And that data will survive url redirection to app store and even after installation your app can get the unique id from dynamic link.Google's firebase can be used for creating dynamic links :-
https://firebase.google.com/docs/dynamic-links/
Or if you want to use a ready to use solution then you can refer branch.io