2

I'm using Facebook App Invites for Android. Everything works fine: I send an invitation, I receive it on the target device, I can install app from Google Play.

Now I want to pass the user's referrer code to Google Play. The idea is when my "friend" installs the app, he automatically has my referral code. I have my BroadcastReceiver that is catching Google campaign parameters.

I have a server-side script which generates a simple code like this :

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

The problem is Facebook changes campaign parameters, so I receive something like this :

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

Android-side: Send an invitation:

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-side: Broadcast receiver:

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

I found a similar question posted in 2014 here but no answer was provided.

So, my question is how can I pass my own parameter to Play Store via Facebook App Invites and how can I receive it with my BroadcastReceiver ?

Community
  • 1
  • 1
Jean DuPont
  • 411
  • 7
  • 22

2 Answers2

2

You can't use any of the built in mechanisms (like the referrer parameter) for Android or iOS to receive deferred deep link parameters since Facebook controls the flow. Additionally, even if you could, on Android, the install referrer can sometimes take a few seconds to be delivered for Google Play, resulting in a pretty laggy user experience.

Facebook has a mechanism that's undocumented where you can build your own deferred deep linking solution on top of their ads and invite product. Unfortunately, as the accepted answer mentions, iOS app invite deferred deep linking is totally broken. The ads products work.

Here's the technical flow:

  1. Create app invite or install ad with the appropriate deep link like so:

enter image description here

  1. New user (without the app) clicks on app invite or app install ad
  2. New user installs your app
  3. Make a POST request to this endpoint 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. The app link data will be returned from that Graph API for the associated object that was clicked

Or if you don't want to hassle with all that stuff, and you want deep links that work outside of Facebook, I've been working on this free tool called branch.io that does all of this for you.

Alex Austin
  • 1,142
  • 8
  • 11
0

Mobile app install ads displayed by Facebook always override the referrer parameter in the play store link/intent. There is nothing you can do about that.

You can on pass data into your app from Facebook by using deferred deep linking, which is also discussed here

Community
  • 1
  • 1
derabbink
  • 2,419
  • 1
  • 22
  • 47
  • Unfortunately it seems like I can't get a deeplink if the app was not installed – Jean DuPont Jul 23 '15 at 18:49
  • Facebook are currently experiencing issues with deferred deep linking. You can subscribe to a bug report about that [here](https://developers.facebook.com/bugs/393947180805373/) – derabbink Jul 24 '15 at 10:48