简体   繁体   中英

Branch.io + Unity: How to setup Apple Search Ads?

I have been integrating the Branch SDK into my Unity iOS app and everything worked fine.

Now I am having some issues having the analytics page include the Apple Search Ads. I read the docs ( https://docs.branch.io/deep-linked-ads/apple-mobile-tracking/ ) but I couldn't find anything specifically for Unity.

I tried matching the suggested functions and here is all I could manage to "port":

using UnityEngine;

public class BranchManager : MonoBehaviour
{
    void Start()
    {
        Branch.delayInitToCheckForSearchAds();
        Branch.initSession(CallbackWithBranchUniversalObject);
    }

    void CallbackWithBranchUniversalObject(BranchUniversalObject buo, BranchLinkProperties linkProps, string error)
    {
        if (error != null)
        {
            System.Console.WriteLine("Error : " + error);
        }
        else if (linkProps.controlParams.Count > 0)
        {
            System.Console.WriteLine("Deeplink params : "
                                    + buo.ToJsonString()
                                    + linkProps.ToJsonString());
        }
    }

}

Is this enough to retrieve the Attribution properly?

Without the delayInitToCheckForSearchAds it didn't work, so I am not sure.

Also, not sure if this matters, but I have already my own plugin natively handling the Apple Attribution (to track on MixPanel).

Thanks in advance for the help! :)

Joan from Branch here -

You will need delayInitToCheckForSearchAds() because there needs to be a check for Apple search Ads prior to initialization . Note that by making the attribution call it'll cause a 1 second delay (a little longer if Apple Search Ads fails to respond).

Also, it shouldn't matter that you have your own plugin.

Here is a link to our Github page that highlights more on the Apple Search Ads integration specific to unity: Branch SDK - Unity: Apple Search Ads

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM