branch.io deep-linked URL not passing data in App from Facebook Ads

假装没事ソ 提交于 2019-12-06 10:38:31

问题


We are using branch.io to pass custom data to App. For that we are following this steps in branch dashboard.

1) Ads -> Partner Management -> Facebook -> Create Facebook Link

2) Set data in Key/Value under "Deep Linking" Section (data which we need in our app)

3) We set Play/App Store URL in Android/iOs respectively Or set Default Redirects under "Redirects" section

That's it!!!

Now Go to Facebook Ads Manager and select App Install Campaign.

1) Select Play/App Store under App Section.

2) Set above generated URL under "deffered deep link"

You can read more here : https://docs.branch.io/pages/deep-linked-ads/facebook-app-install-ads/

Now Our Problem is :

  1. When user clicked on any branch link with deep link params it able to receive data in both case when user fresh install the application and if user has already app installed.
  2. When we clicked on Facebook ads with same url we are unable to get branch data if user has not installed application (Mostly in case when user redirect from App Store/play store) . But user has installed the app we can able to receive all branch data from same url.

So Question is:

1) Do we need any permission from Facebook or missing any configuration on Branch or Facebook?

2) The same thing will work with both (e.g. Android and iOs) devices?

Thanks


回答1:


Unfortunately the branch.io documentation for setting this is up is pretty incomplete - we just spent about a week testing and debugging the SDK to figure out how to get it to work. The necessary changes itself are actually quite simple.

On Android:

  1. Integrate the Facebook SDK if you haven't done so already
  2. Ensure that the facebook_app_id string resource you added as part of (1) is not prefixed with "fb"
  3. If you are using ProGuard, add rules to keep the relevant parts of the Facebook SDK
  4. Call enableFacebookAppLinkCheck() on your Branch instance right after initializing it

On iOS:

  1. Integrate the Facebook SDK if you haven't done so already
  2. Call registerFacebookDeepLinkingClass(FBSDKAppLinkUtility.self) on your Branch instance right after initializing it



回答2:


I had this exact same problem, but in a React Native project, so I'm using react-native-branch. @henning-dodenhof 's answer helped me a lot (thanks for figuring this out!), but I needed a couple of further adaptations, so I add this answer in case it's useful for someone else since this post was the main thing I found regarding this issue:

For iOS: The FB SDK registration needs to happen before initializing Branch, not after as the above answer suggests. So, before this line that you add as part of the normal library setup:

[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];

You need get the Branch instance from RNBranch and then register this FB SDK class:

[[RNBranch branch] registerFacebookDeepLinkingClass:[FBSDKAppLinkUtility class]];

Adding this new line before the initialization is critical, doesn't work if it's done after.

For Android: Here the setup code already gets an instance with Branch.getAutoInstance(this), so we can just chain the registration:

Branch.getAutoInstance(this).enableFacebookAppLinkCheck();

It looks like the getAutoInstance above doesn't actually fully initializes the instance, so you can call enableFacebookAppLinkCheck right after, and the instance gets fully initialized after the first use.



来源:https://stackoverflow.com/questions/49955368/branch-io-deep-linked-url-not-passing-data-in-app-from-facebook-ads

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!