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 25 forks source link

Branch.io initSession returns empty BranchUniversalObject JSON and BranchLinkProperties JSON #184

Closed johnnypi6 closed 4 years ago

johnnypi6 commented 4 years ago

Hi, Many thanks for your ongoing support for the Unity community.

I'm trying to add a sharing feature to my existing app using Unity Branch SDK. Branch SDK version 0.6.5.

I created the following deep links using the Unity Branch SDK.

https://xleague.app.link/r7DxT2wkZ5 https://xleague.app.link/4WPwY7jm05 https://xleague.app.link/LFfAOZuo05 https://xleague.app.link/hVR3fr0n05

And I retrieved BranchUniversalObject and BranchLinkProperties using the following code.

void Start()
{
    Branch.initSession(CallbackWithBranchUniversalObject);
}

void CallbackWithBranchUniversalObject(BranchUniversalObject buo, BranchLinkProperties linkProps, string error)
{
    if (error != null)
        Debug.Log($"Error : {error}");
    else
    {
        Debug.Log(buo.ToJsonString());
        Debug.Log(linkProps.ToJsonString());
        if (linkProps.controlParams.ContainsKey("$deviceID"))
        {
            string senderDeviceID = linkProps.controlParams["$deviceID"];
            ...
        }
    }
}

If I click the shared link on iPhone or Android, it will redirect me to Appstore or Google Play Store. I can install the app on the Appstore and Google Play Store. But when I opened the app, initSession returns empty BranchUniversalObject JSON and BranchLinkProperties JSON.

BranchUniversalObject JSON _{ "$canonical_identifier": "", "$canonical_url": "", "$og_title": "", "$og_description": "", "$og_image_url": "", "$publicly_indexable": "0", "$locally_indexable": "0", "$expdate": "69425078400000", "$keywords": [], "metadata": "{}" }

BranchLinkProperties JSON _{ "~tags": [], "~feature": "", "~alias": "", "~channel": "", "~stage": "", "~duration": "0", "controlparams": {} }

What makes me more confused is that initSession sometimes returns correct BranchUniversalObject JSON and BranchLinkProperties JSON as expected. I guess the Branch Short URL that I created only works for the first click. I'd be much appreciated you if you could help me.

johnnypi6 commented 4 years ago

I reposted this issue. https://github.com/BranchMetrics/unity-branch-deep-linking-attribution/issues/186