How to implement referral program in mobile Apps for both Android and iPhone

前端 未结 7 2261
无人共我
无人共我 2020-12-22 17:29

We have a mobile app that\'s available in both Google Play Store and Apple AppStore, we want to implement a referral program to get more users to install and use our App.

7条回答
  •  时光说笑
    2020-12-22 17:59

    Disclaimer: not being satisfied with the original accepted answer, I'm providing an alternative solution back to this "popular" thread.

    On Android, this is not an issue at all. Google will let you access the referrer param sent at install time by registering a receiver, you can also leverage their install referrer API.

    For iOS it is a bit trickier as it's not officially supported. As proposed here you can do fingerprinting but that's cumbersome and comes with a high degree of inaccuracy. There are two more elegant solutions I came across:

    1. Cookie based tracking that is explained in details here
    2. URL copied to clipboard (Firebase seems to do both clipboard and cookie approach but that's based on personal observation - no official source).
      • When user visits your webpage (ie: example.com/invite/123), display a web page before redirecting to the App Store.
      • In that page make the user push a button so that you can copy a string to the clipboard/pasteboard with document.execCommand('copy') after having selected some string residing in an hidden input via focus() and setSelectionRange()
      • After install, when the user lands in the app you can do two things:
        1. Catch clipboard/pasteboard content via UIPasteboard.general.string (swift) and do some parsing or API calls
        2. Redirect the user back (via its default browser to avoid Cookies not present) on a page on the same domain as in the initial link (ie: mydomain.com/retrieve) so that the page will receive the initially set cookies (in step 1.) gently shared by the browser upon visit. You can then redirect the user back to your original link as the app is now installed and Universal Linking will now work as intended.

提交回复
热议问题