Facebook App Invites:将活动参数传递给 Play 商店

Facebook App Invites: pass campaign params to Play store

我正在为 Android 使用 Facebook 应用程序邀请。一切正常:我发送邀请,在目标设备上收到邀请,我可以从 Google Play 安装应用。

现在我想将用户的引荐代码传递给 Google Play。这个想法是当我的 "friend" 安装应用程序时,他会自动获得我的推荐代码。我的 BroadcastReceiver 正在捕捉 Google 活动参数。

我有一个服务器端脚本,可以生成如下简单代码:

<html>
<head>
    <meta property="fb:app_id" content="<MY_APP_ID>">
    <meta property="og:title" content="<APP_NAME>">
    <meta property="al:android:url" content="market://details?id=<PACKAGE_NAME>&amp;referrer=utm_source%3D<REF_CODE>">
    <meta property="al:android:app_name" content="<APP_NAME>">
    <meta property="al:android:package" content="<PACKAGE_NAME>">
</head>
<body>
    Redirect...
</body>
</html>

问题是 Facebook 更改了活动参数,所以我收到了这样的信息:

utm_source = apps.facebook.com
utm_content = {"app":0,"t":<SOME_NUMERIC_ID>}
utm_campaign = fb4a

Android方:发送邀请:

AppInviteContent content = new AppInviteContent.Builder()
                        .setApplinkUrl("<SERVER_SCRIPT_URL>.php?referral="+ref_code)
                        .setPreviewImageUrl("<IMAGE>.png")
                        .build();
                if (AppInviteDialog.canShow()) {
                    appInviteDialog.show(getActivity(), content);
                }

Android端:广播接收器:

@Override
public void onReceive(Context context, Intent intent) {
    Bundle extras = intent.getExtras();
    String referrerString = extras.getString("referrer");
    ...
}

我在 2014 年发现了一个类似的问题 here 但没有提供答案。

所以,我的问题是如何通过 Facebook App Invites 将我自己的参数传递给 Play Store,以及如何使用我的 BroadcastReceiver 接收它?

Facebook 显示的移动应用安装广告始终覆盖 Play 商店 link/intent 中的 referrer 参数。你对此无能为力。

您可以使用延迟 deep linking, which is also discussed here

将数据从 Facebook 传递到您的应用

您不能使用 Android 或 iOS 的任何内置机制(如 referrer 参数)来接收延迟的深度 link 参数,因为 Facebook 控制着流程。此外,即使您可以,在 Android 上,有时也可能需要几秒钟才能为 Google Play 传送安装引荐来源网址,从而导致用户体验非常缓慢。

Facebook 有一个未记录的机制,您可以在其中构建自己的延迟深度 linking 解决方案,在他们的广告和邀请产品之上。不幸的是,正如接受的答案所提到的,iOS app invite deferred deep linking 完全被破坏了。广告产品有效。

技术流程如下:

  1. 使用适当的深度 link 创建应用邀请或安装广告,如下所示:

  1. 新用户(没有应用)点击应用邀请或应用安装广告
  2. 新用户安装您的应用程序
  3. 向此端点发出 POST 请求 https://developers.facebook.com/docs/graph-api/reference/application/activities/

https://graph.facebook.com/<APP ID>/activities?access_token=<APPACCESSTOKEN>&event=DEFERRED_APP_LINK&advertiser_id=<GAID>&advertiser_tracking_enabled=1&application_tracking_enabled=1

  1. 应用程序 link 数据将从图表 API 为被点击的关联对象返回

或者,如果您不想麻烦这些东西,并且想要在 Facebook 之外工作的深度 links,我一直在研究这个名为 branch.io 的免费工具这一切都为您完成。