Search code examples
iosreferralsbranch.io

Device identity for referral system using branch.io


I am trying to implement a referral system in my iOS app. If 2 of my friends use the link i shared to install the app, in-app purchase for me will be free.

I have used branch.io to implement it in my app. It works kinda great, but when i delete the app and reinstall branch.io doesn't recognise the device and all my referral credits are gone. So to enjoy free in app entities i have to do the sharing again , which is not fair to a user.

Can anyone help me to fix this and make branch.io always remember my device with the referrals credits even i install/uninstall apps multiple times.

I noticed there is a function setIdentity available , but not sure how it works.

Branch.getInstance().setidentity = 2244323

Thanks


Solution

  • Alex from Branch here: glad you're finding the service useful!

    We do track the IDFA for every device we see, but that is primarily to prevent referral program fraud and doesn't currently allow us to trace anonymous users across multiple installs. The good news is most users don't frequently delete and reinstall apps, so this is hopefully not a situation that will come up too often.

    The setIdentity function can definitely do this for you. Here is the full documentation, but basically you'd need to already be allowing users to sign into your app with a username, an email, or some other unique ID. At the time they sign into your system, you can trigger Branch's setIdentity method with the same unique ID.

    If the user deletes the app and later reinstalls it, they would log back into your system with the same unique ID, the setIdentity method would be called again, and any referral history connected to that ID would be restored.