BranchMetrics / unity-branch-deep-linking-attribution

The Branch Unity SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/apps/unity/
MIT License
118 stars 24 forks source link

Not receiving metadata #94

Closed rubinbasha closed 6 years ago

rubinbasha commented 7 years ago

Greetings,

I have used this SDK for integrating Branch in a Unity application and I am having some issues in iOS currently with retrieving metadata from BranchUniversalObject. I have tested some scenarios and will show below what they are: 1- I tested Branch integration without enabling Associated Domains and in this case the app did not open automatically when clicking the link(as expected), but when i than open the app manually from the apps menu than it does recognize that there was some deeplinking metadata to receive and it does receive the metadata. 2- I tested Branch integration with enabling Associated Domains and in this case when clicking the link it opens the app but the strange thing is that it does not receive the metadata.

I am not able to understand now why do I not get metadata when Associated Domains is enabled?

The params I get from CallbackWithBranchUniversalObject are these for each case respectively: 1- {"$canonical_identifier":"","$canonical_url":"","$og_title":"","$og_description":"","$og_image_url":"","$content_type":"","$publicly_indexable":"0","$exp_date":"0","$keywords":[],"metadata":{"shareId":"e70796569ac32dd5e270167d3efa5d37"}}{"~tags":[],"~feature":"","~alias":"","~channel":"","~stage":"","~duration":"0","control_params":{}}

2-{"$canonical_identifier":"","$canonical_url":"","$og_title":"","$og_description":"","$og_image_url":"","$content_type":"","$publicly_indexable":"0","$exp_date":"0","$keywords":[],"metadata":{}}{"~tags":[],"~feature":"","~alias":"","~channel":"","~stage":"","~duration":"0","control_params":{}}

I need some assistance to understand why do I not get the "shareId" contextual deeplinking data in the second implementation(that is how it should be implemented by the documentation)?

antonargunov commented 7 years ago

Hi @rubinbasha , you must enable Associated Domains and add your link "applinks:yourlink". It seems you have incorrect settings in branch object, or you didn't set anything in branch dashboard for your app or you have incorrect bundle id. Check please that things.

rubinbasha commented 7 years ago

Hi @antonargunov , thank you for the quick response. I have enabled Associated Domains and also added "applinks:myLink" and "applinks-alternate:myLink" in the second use case that i have describe din the first comment. The thing that I don't understand is why when there is no Associated Domains I do get the metadata and when there is Associated Domains enabled than i get the link to open the app but no metadata?

antonargunov commented 7 years ago

@rubinbasha , something wrong in settings, I think. Please write to our support team. Right now I can't ask you about your application data, link data etc. because we are on public site. We will try to make solving of your issue as fast as possible. Attach a link to this thread in your message.

aaaronlopez commented 7 years ago

Hi @rubinbasha, can you reach out to our Integration Engineering team at integrations@branch.io with your Branch Key and the links you are testing with? Looking forward to hearing from you.

dustinkerstein commented 7 years ago

@rubinbasha, any chance you see this BNCStrongMatchHelper error in your log? What version of Unity are you on?

BNCStrongMatchHelper.m(290) Warning: cookieBasedMatching is enabled but SafariServices framework is not available.
callbackDictString: 

{"callbackId":"BranchCallbackId1","params":{"linkProperties":{},"universalObject":{}},"error":null}

That's the error I'm getting and I'm also having similar issues on iOS (with Unity 2017.1.0f3). The app will open, but no data is returned, and I also don't see these link clicks in the Branch.io Dashboard.

My app / deep linking was working just fine in my previous Unity 5.5 and older Branch SDK

Update - I also just tried to run my config through the link validator but the validator now results in a bad request - https://branch.io/resources/universal-links

ERROR
The request could not be satisfied.
The origin closed the connection. 
Generated by cloudfront (CloudFront)
Request ID: ewFbck6IQrQnMBFCfCe4ML6z_kOHE1uCo44uot62GB4hEF-uNP4BSw==
dustinkerstein commented 7 years ago

And I can also confirm @rubinbasha's behavior of when Associated Domains = False that the deep link data will be available on the subsequent manual launch of the app. Seems like I have the same issue.

dustinkerstein commented 7 years ago

Interestingly I wasn't able to replicate this using the Branch Unity demo app. It works just fine. I'll try to figure out what's different between my app and the demo app.

dustinkerstein commented 7 years ago

Ok, sorry for the spam - I just tried cleaning out all of my Google Cardboard SDK and Branch SDK files, and then re-imported just the Branch SDK and I'm now seeing the correct behavior. @rubinbasha, any chance you're also using Google Cardboard?

rubinbasha commented 7 years ago

Hi @aaaronlopez and @dustinkerstein . It was indeed an issue with cardboard, in our project we did not use the Cardboard SDK, but we had an option activated in the project. The option was "Virtual Reality Support", after disabling this option than deeplinking came with the metadata. So most probably this is the bug that has to be fixed and maybe it is replicable also in the sample project when activating this option.

dustinkerstein commented 7 years ago

Good to hear @rubinbasha - Just to clarify a couple things though:

  1. Which version of Unity are you using?
  2. You don't have the actual Unity Cardboard SDK package imported, you just had the "Virtual Reality Support" checked, correct? Which VR platforms were listed there?

I just want to see if it was possibly related to #95

dustinkerstein commented 7 years ago

Also, since I'm now facing this same issue, are there any known workarounds? The solution posted in "ThirdPartySolutions" no longer applies to the native cardboard integration in Unity 5.6.x and 2017.x when used with the supplementary Cardboard SDK - CardboardAppController.h and CardboardAppController.mm are no longer used.

Update - I believe the only conflicts with UnityAppController now exist in GvrAudioAppController.mm/h

dustinkerstein commented 7 years ago

Per my last comment, I was actually able to get this working on iOS (in Unity 2017.1.0f3 + Cardboard SDK 1.6 via Cocoapods) by modifying the GvrAudioAppController.mm/h in the same was as the original "ThirdPartySolutions" workaround.

antonargunov commented 7 years ago

@rubinbasha , @dustinkerstein , I was able to build and run iOS version of our testbed with unity's VR support and without any changes in source code. I use Unity 2017.1.0.p4.

@rubinbasha , which version of Unity3d do you use?

dustinkerstein commented 7 years ago

@antonargunov, I was only able to replicate this with the addition of the Unity GVR SDK - https://github.com/googlevr/gvr-unity-sdk

antonargunov commented 7 years ago

@dustinkerstein , I will receive DayDream with galaxy s8 tomorrow or the day after tomorrow, and then I will test internal integration and external VR plugins. Thanks for info.

dustinkerstein commented 7 years ago

While this is definitely more related to #95 - feel free to take a look at this issue I posted regarding the UX of VR <-> Magic Window here - https://github.com/googlevr/gvr-unity-sdk/issues/703 - That Daydream View interstitial is causing issues not only for Branch, but other UX issues as well.

antonargunov commented 6 years ago

Look at #95