如何在 Android 和 iPhone 的移动应用程序中实施推荐计划

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22006674/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 05:25:09  来源:igfitidea点击:

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

androidiosiphoneinstalltracking

提问by James Khoo

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.

我们有一个移动应用程序,可在 Google Play 商店和 Apple AppStore 中使用,我们希望实施推荐计划以吸引更多用户安装和使用我们的应用程序。

Here's the user story:

这是用户故事:

  • Every new user (E.g John) is given to a unique referral link, where he/she can share to FB/TW/Email or SMS.
  • When John friend clicks the link, they are directed to respective AppStore base on their device.
  • The moment John's friend install the app and open the app, our server should get notified, and we shall know that the referral is from John, John will be rewarded accordingly.
  • 每个新用户(例如 John)都会获得一个唯一的推荐链接,他/她可以在其中分享到 FB/TW/Email 或 SMS。
  • 当 John 朋友单击该链接时,他们将被定向到其设备上的相应 AppStore。
  • 约翰的朋友安装应用程序并打开应用程序的那一刻,我们的服务器应该得到通知,我们将知道推荐来自约翰,约翰将得到相应的奖励。

We have evaluated a number of Mobile App Install Tracking Tools, most of the tools are the best use in the Publisher/ Mobile Advertisement.

我们评估了许多移动应用安装跟踪工具,大多数工具在发布商/移动广告中使用效果最佳。

Appreciate any comments, suggestions

感谢任何意见,建议

Cheers James

干杯詹姆斯

回答by Puru Pawar

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..

  • 每个新用户(例如 John)都会获得一个唯一的推荐链接,他/她可以使用 FB/TW/Email 或 SMS 将其分享给他的朋友。

  • 当 John 的朋友点击链接时,他首先被重定向到一个 Servlet,最终将他重定向到基于他的平台 (Android/iPhone) 的相应 AppStore 以下载应用程序。

  • 请注意,我们可以使用 Servlet 找出单击链接的用户的 IP 地址、用户代理和设备模型。

  • 我们已经知道推荐链接属于约翰,因此 servlet 将约翰朋友的 IP 地址、用户代理和/或设备模型映射到约翰在数据库中的条目。

  • 在约翰的朋友安装应用程序并打开应用程序的那一刻,应用程序将 IP 地址、用户代理和/或设备模型发送到服务器。

  • 服务器根据所有用户检查条目以找到推荐人,如果找到他,在我们的例子中,约翰,约翰会得到相应的奖励。

Thats it. We implemented this in the last month itself and it does increased our downloads. Let me know if that's helpful.

就是这样。我们在上个月就实现了这一点,它确实增加了我们的下载量。让我知道这是否有帮助。

回答by Chandan Kumar

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 :-

IP 地址 + 用户代理 + 设备模型不足以唯一地标识设备。所以,我认为使用动态链接会更好。您可以创建包含唯一 ID 的动态链接。并且该数据将在 url 重定向到应用程序商店后仍然存在,即使在安装后,您的应用程序也可以从动态链接中获取唯一 ID。Google 的 firebase 可用于创建动态链接:-

https://firebase.google.com/docs/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

或者,如果您想使用现成的解决方案,那么您可以参考 branch.io

回答by lxknvlk

Android

安卓

On android you can create an install broadcast listener, where you can get and save the referrer part of the link to SharedPreferences

在 android 上,您可以创建一个安装广播侦听器,您可以在其中获取并保存链接的引用部分到 SharedPreferences

https://play.google.com/store/apps/details?id=com.example.app&referrer=example_referral_code_here

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

对于此检查
Android - 是否有可能以编程方式安装引荐来源网址

在从 Android 市场安装应用程序后获取引荐来源网址

and

https://developer.android.com/google/play/installreferrer/library.html

https://developer.android.com/google/play/installreferrer/library.html

iOS

IOS

For now (Jan 2016) It is not possible to get the install referrer code in your app, like with android.

目前(2016 年 1 月)无法在您的应用程序中获取安装引用代码,就像使用 android。

Options i had for ios were:

我对 ios 的选择是:

  1. user frameworks/3rd party services like alau.me
  2. a workaround with fingerprinting, similar to what Puru Pawar suggests
  3. just make the user enter the referral code inside your app
  1. 用户框架/第三方服务,如 alau.me
  2. 指纹识别的解决方法,类似于 Puru Pawar 的建议
  3. 只需让用户在您的应用中输入推荐代码

回答by Teraiya Mayur

Gradle File

摇篮文件

 implementation 'com.android.installreferrer:installreferrer:1.0'

PUT CODE IN ACTIVITY WHERE IT NEED TO RECIEVE REFFERAL CODE

将代码置于需要接收推荐代码的活动中

 InstallReferrerClient mReferrerClient;

 mReferrerClient = InstallReferrerClient.newBuilder(this).build();

 mReferrerClient.startConnection(new InstallReferrerStateListener() {
 @Override
 public void onInstallReferrerSetupFinished(int responseCode) {
            switch (responseCode) {
                case InstallReferrerClient.InstallReferrerResponse.OK:
                    // Connection established
                    try {
                        ReferrerDetails response = 
 mReferrerClient.getInstallReferrer();
                        if (!response.getInstallReferrer().contains("utm_source"))
                            edtPRferelCode.setText("" + 
 response.getInstallReferrer());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    mReferrerClient.endConnection();
                    break;
                case 
 InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED:
                    // API not available on the current Play Store app
                    break;
                case 
 InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE:
                    // Connection could not be established
                    break;
            }
        }

        @Override
        public void onInstallReferrerServiceDisconnected() {
            // Try to restart the connection on the next request to
            // Google Play by calling the startConnection() method.
        }
    });

SHARE LINK EXAMPLE

分享链接示例

https://play.google.com/store/apps/details?id=com.yourpackage&referrer=9BE46300

https://play.google.com/store/apps/details?id=com.yourpackage&referrer=9BE46300

回答by rels

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.

Android 上,这根本不是问题。Google 将允许您通过注册接收器来访问在安装时发送的引用参数,您还可以利用他们的安装引用 API

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

对于iOS,它有点棘手,因为它不受官方支持。正如这里提出的那样您可以进行指纹识别,但这很麻烦,并且具有高度的不准确度。我遇到了两个更优雅的解决方案:

  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.
  1. 此处详细说明的基于 Cookie 的跟踪
  2. URL 复制到剪贴板(Firebase 似乎同时使用剪​​贴板和 cookie 方法,但这是基于个人观察 - 没有官方来源)。
    • 当用户访问您的网页时(即:example.com/invite/123),在重定向到 App Store 之前显示一个网页。
    • 在该页面中,让用户按下一个按钮,这样您就可以document.execCommand('copy')在通过focus()setSelectionRange()
    • 安装后,当用户登陆应用程序时,您可以做两件事:
      1. 通过UIPasteboard.general.string(swift)捕获剪贴板/粘贴板内容并进行一些解析或 API 调用
      2. 在与初始链接(即:mydomain.com/retrieve)相同域上的页面上将用户重定向回(通过其默认浏览器以避免 Cookie 不存在),以便该页面将接收初始设置的 cookie(在步骤 1 中) .) 浏览器在访问时轻轻分享。然后,您可以将用户重定向回您的原始链接,因为现在已安装应用程序,通用链接现在将按预期工作。

回答by PlatformDating

An alternative is to let your current users make a unique code, for example, David123 or HenryABC. They share their code (which is easy to remember as it's personal). Within your app you provide a referral box that a new user enters the code to unlock additional features. This way you can track and don't have to worry about a fingerprint. The big issue with a fingerprint method is iOS is not unique enough and mobile networks share IP addresses. So someone with an iPhone 6s in London on EE is likely to have the same fingerprint as 100s of other people.

另一种方法是让您当前的用户制作唯一代码,例如 David123 或 HenryABC。他们共享他们的代码(这很容易记住,因为它是个人的)。在您的应用程序中,您提供了一个推荐框,新用户输入代码以解锁其他功能。这样您就可以跟踪而不必担心指纹。指纹方法的一个大问题是 iOS 不够独特,移动网络共享 IP 地址。因此,在伦敦的 EE 上使用 iPhone 6s 的人很可能与其他 100 多岁的人拥有相同的指纹。

回答by rjsadda

It can be done using Google Campaign Measurementwhere in the utm_source just give unique number/string for each user which you will receive when user's friend installs the app as Google Play store will broadcastit after the installation. Refer to this question.

可以使用Google Campaign Measurement来完成,其中在 utm_source 中只需为每个用户提供唯一的数字/字符串,当用户的朋友安装应用程序时,您将收到这些数字/字符串,因为 Google Play 商店将在安装后广播它。参考这个问题