Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Branch clicked_branch_link is 0 without metadata Swift

Trying to set up branch for deep linking. In settings for the Branch control panel the link domain is set to: get.myapp.co. For iOS the URI Scheme is: myapp://. Under the Associated Domains section of entitlements I have:

applinks:get.myapp.co
applinks:get-alternate.myapp.co

I have my AppDelegate.swift setup as described by the guide.

func application(_ application: UIApplication,

didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

let branch = Branch.getInstance()

        branch?.initSession(launchOptions: launchOptions) { (params, error) in

            //We can handle links when an app is launched/open here
            if let error = error {
                print("Branch error: \(error.localizedDescription)", logType: .Error)
            } else {
                print("Branch params: \(params.description)")
            }

        }


}

Now I have a marketing ink setup in the control panel with the key: redirect and value subscription. When I tap on the link I output I get is:

Branch params: [AnyHashable("+clicked_branch_link"): 0, AnyHashable("+is_first_session"): 0, AnyHashable("+non_branch_link"): http://get.myapp.co/xmas-special-offer]

So +clicked_branch_link is 0. My metadata with the key redirect is also missing. What am I doing wrong here?

EDIT:

Note I was pasting the link from the control panel into an email and then opening it from the mail app, this doesn't work. BUT if I send the link from the control panel via sms the metadata appears and clicked_branch_link is 1. What gives?

like image 569
KexAri Avatar asked Dec 05 '22 16:12

KexAri


2 Answers

Spent a lot of time trying to solve the same issue. My problem was caused by opening test link while using live environment. For using test environment I had to get branch singletone like:

Branch *branch = [Branch getTestInstance];

like image 73
tema-orange Avatar answered Dec 24 '22 01:12

tema-orange


Alex from Branch here: the +clicked_branch_link: 0 param means that the SDK is not detecting any Branch link click for that device prior to the app launching. This is why you're not getting your metadata back. The presence of +non_branch_link in the return indicates some configuration issues, which are probably causing the failure to detect a Branch link click. Based on some of the details in your question, I think there may be some confusion around how to configure your custom domain and your URI scheme.

Without seeing the specific configuration in your dashboard, this is tough to diagnose. Could you either edit your question with more details (example links, screenshots of the dashboard, etc), or submit a ticket with the Branch integrations team for further debugging?

like image 45
Alex Bauer Avatar answered Dec 24 '22 00:12

Alex Bauer