Website to app routing on iOS 9.3.2

Answered Asked on June 23, 2016 in Technical.

I am trying to redirect my mobile web page to an app, using the documentation available in the website to app routing guide.

I have defined both URI scheme and universal link with the associated domain, but I still get a strange behavior:

  1. The automatic redirect using javascript does nothing
  2. When I click a link with the branch.deepviewCta() function, I can see that I am redirected to the alternate link ( I can see that for a few seconds in safari)
  3. I am then redirected to the appstore and not the app even though I have it installed.

Haven’t tried it on a different iOS version.

Any ideas what might be wrong?

Foxxy Mobile ltd. — Developer
15 Answer(s)
Best answer Answered on July 1, 2016.

Hi!

First of all, it sounds like you’re building something pretty awesome, but it’s definitely outside of a ‘normal implementation’ so it’s somewhat uncharted territory for me!

I wouldn’t recommend creating a second Branch app. I think you should be able to do what you need without that, and adding a second app in will cause all sorts of other headaches. Preserving the link data through install is one of our main features. Actually, that’s what deepviewCta() is specifically designed to do. If you wanted to manually recreate that functionality, you’d need to retrieve the link data (which you are doing) and then pass it through to a NEW link when the user presses the button to go on to the app store. I’m not sure what this will do to your analytics data though…you might end up recording twice as many link clicks, because I believe deepviewCta() does some work behind the scenes to reconcile this.

Did you investigate the fallback URL control parameters? I think this may be the answer to what you need, since you can override the app-wide redirection settings for specific links. The recommended approach would be to leave your App Store page as the app-wide default, and then set overrides on the links being generated inside the app.

Branch — Developer
Answered on July 3, 2016.

You’re very welcome, Ran! Love seeing what all our partners are building :).

I think the redirect override control params should do the trick. If you have any further questions after you’ve had a chance to try them out, please let me know!

Branch — Developer
Commented on January 5, 2017.

Hi @abauer, I’m having a similar issue. I created a branch.deepviewCta() which redirects the user through https://n4xx-alternate.app.link, instead of my custom subdomain link (go.dubbi.com.br) and then redirects to the App Store instead of opening my $deeplink_path (from branch.deepview ) inside my App.

Inside my Dashboard at “Liveview & Export” I can see that the links are created fine and work well if I test it on Notes.

Do you have any ideia? Thanks for any help

Dubbi — Product Manager
Commented on January 5, 2017.

Hi @marcos_arata, it is the expected behavior for the CTA link to point at your app.link domain. You’ll need to add all of the app.link domains as listed in the docs, and then this should work!

 

Branch — Developer
Commented on January 5, 2017.

Hi @abauer, I did include my subdomain link inside my config.xml file as described on Cordova/Ionic tutorial, I am creating an Ionic app.

<branch-config>
 <ios-team-id value="MYTEAMID"/>
 <android-prefix value="/myprefix" />
 <host name="go.example.com" scheme="https" />
 </branch-config>

Should I also include inside Associated Domains as described on iOS tutorial? BTW this step is not mentioned on Ionic tutorial.

Dubbi — Product Manager
Commented on January 5, 2017.

FYI included my domain on Associated Domains, but did not work as well. It is still redirecting to App Store through n4x3-alternate.app.link

Dubbi — Product Manager
Commented on January 5, 2017.

@marcos_arata, you need both. That step actually is mentioned in the Ionic documentation — your config needs to look like this:

<branch-config>
<ios-team-id value="xxxx"/>
<host name="go.dubbi.com.br" scheme="https" />
<host name="n4x3.app.link" scheme="https" />
<host name="n4x3-alternate.app.link" scheme="https" />
</branch-config>
Branch — Developer
Commented on January 6, 2017.

Got it! Thanks @abauer

Dubbi — Product Manager
Commented on January 6, 2017.

@marcos_arata, no problem! Glad to hear it worked 🙂

Branch — Developer
Answered on June 23, 2016.

Hmmm…there are a number of configuration things that could be causing behavior like this. Is there somewhere we can go to take a look at an example?

Branch — Developer
Answered on June 24, 2016.

Hi Alex

This is the mobile web page I have created:

http://ping-pong.me/~u2qlkw

It has the script in the head section, and a link at the bottom which invokes deepviewCta()

The page is not redirecting me directly to the app, and when I click the link, it directs me to the alternate domain and then to the app store.

Unfortunately, I cannot give you the app yet since it is not approved, but I have configured Universal linking following your guide.

A few things to notice that might help identifying the problem:

    1. I have defined a custom sub domain: pingpong.app.link, but the alternate domain you specify is still using the old prefix: pnrk-alternate.app.link. Is this ok?
    2. I am using iOS 9.3, and configured universal linking (with your domains, including in itunes connect)
    3. I am almost sure that it worked the very first time I clicked on the link, as it went to the primary domain and not the alternate..
    4. I think it does not work on my windows desktop as well, since I should get the SMS landing page but instead I get my default url when clicking the link

 

If there is any other info you need to investigate this, I will provide since I would really like to use your services.

Thanks

Ran

Foxxy Mobile ltd. — Developer
Answered on June 24, 2016.

 

UPDATE 24/6:

After removing and installing the app again, it seems that both primary and alternate link domains are working from the notes app.

But, a link created using the javascript api, takes me directly to the default url and not the app.

Must be some bad configuration of the web link, even though I followed the instructions..

This is my web page with the JS api: http://ping-pong.me/~u2qlkw

Foxxy Mobile ltd. — Developer
Answered on June 24, 2016.

Sounds like you might have run into the dreaded Universal Links disabling issue!

However, you’re right…something odd is still going on with the deeplinkCTA() call. What applinks: domains do you have configured in Xcode?

Branch — Developer
Answered on June 24, 2016.

We looked into this on the backend…you’re right: pnrk-alternate.app.link should be pingpong-alternate.app.link. It looks like something went wrong, so we’re investigating this as a bug.

In the meantime, we’ll manually update your config. Hopefully this should take care of the issue with the javascript API links. Give it another try in a little bit (after the change has time to propagate) and let me know if you’re still seeing problems!

Branch — Developer
Answered on June 25, 2016.

Hi Alex

Thanks for looking into this issue.

After your change, I do get the pingpong-alternate.app.link domain.

Unfortunately, the Javascript api still does not work, as I always get the default domain when clicking the link, and I am not redirected on page load as well.

It is not working on desktop as well, I am also redirected to the default url.

I have tried copying your exact sample code, and adding the content security meta tag but still nothing..

Foxxy Mobile ltd. — Developer
Answered on June 27, 2016.

Hi Ran,

There are several things going on here:

  1. You should configure all your platform-specific routing rules on the Branch dashboard. Right now it looks like many of these are blank, and the error message of “We don’t know where to redirect!” exists for a reason :).
  2. The web-to-app-routing feature you’re using functions a bit differently from a normal Branch link,  since it is intended to be a sort of ‘stopover point’ for a visitor who has already opened a Branch link. The button you’re using to trigger deepviewCta() won’t automatically follow all the platform-specific routing rules you set up on the Branch dashboard because it is actually intended to function as an alternative them. In other words, once a user lands on http://ping-pong.me/~u2qlkw, we assume they are there as the result of an $ios_url parameter (or other platform-specific param) in an earlier link, and won’t need additional routing. If you want to do this anyway, you can always specify something like ‘$desktop_url’: ‘https://google.com’, in the data dictionary of your deepview() call.
  3. I have tested this code on my end and do get Universal Link behavior when clicking the deepviewCta() button. Can you make sure these haven’t somehow been disabled again on your device?
Branch — Developer
Answered on June 29, 2016.

Hi Alex

I know I haven’t configured all the rules, since I do not have store links yet.

Anyways,  following your point number 2, let me specify what I was trying to achieve, and maybe you can lead me to the right configuration..

My thoughts were, that users will invite their friends from the app by sending a link (which will be a regular link and not branch link). The friend will click the link and then one of 2 should happen:

  1. If the friend have the app, it should open
  2. If not, the friend should get a mobile web page with some data, and a button to download the app

I was trying to achieve that with the javascript SDK, thinking that on page load your SDK will check if the app exists, and if not the user will later click a button that will trigger deepviewCta().

What is the right way to achieve the above behavior?

Thanks

Foxxy Mobile ltd. — Developer
Answered on June 29, 2016.

Ahh….yes, I understand what you’re trying to do.

First of all, you need to put something in the rules areas, even if it’s a fake temporary URL. The redirection logic will fail in certain situations if those values are null.

Now on to the main question: the best approach is to have the invite link be a Branch link. That simplifies your flow considerably, since that should prevent the vast majority of users who already have the app from ever landing on your mobile web page in the first place. By not using a Branch link here, you start to run into these nasty edge cases. The open_app: true parameter (which you do have set) is designed to do what you’re wanting (automatically launch the app when the page is loaded) and in an ideal world it would, but there are many situations in which it fails. The most painful of these being Safari on iOS 9+ (thanks to Universal Links) and Chrome/Firefox (thanks to Chrome Intents) on Android.

However, if you really don’t want to use Branch for the invite link, then what you’re doing is the best approach. Just be aware that in some situations the user will have to click a button the launch the app instead of this happening automatically on page load!

Branch — Developer
Answered on June 30, 2016.

Ok, so I managed to get it working with creating branch links in my app and sharing it from the app.

I used my own custom domain – u.ping-pong.me – and it works. (maybe you cannot see this configuration since I have created a second app – ping pong 2 for this test)

 

As said, I want users who do not have my app to see a mobile web page. Does it mean that I need to configure a “custom url” on my redirects with the page’s address?

How do I extract the link’s data? Can I extract it using PHP?

In the web page, should I use deepviewCta() to send the user to the app store?

Thanks

Foxxy Mobile ltd. — Developer
Answered on June 30, 2016.

Hi,

The answer to all of your questions is yes :).

See here for info on the link() method you can use with javascript: https://github.com/BranchMetrics/web-branch-deep-linking#linkdata-callback. Alternatively you can use the API with PHP: https://github.com/BranchMetrics/branch-deep-linking-public-api#viewing-state-of-existing-deep-linking-urls 

Branch — Developer
Answered on July 1, 2016.

Hi Alex

Thanks again for taking your time to answer!

So I think I got it working, just missing one last thing. What I did is:

  1. A branch link is created in the app with some custom data
  2. On the dashboard I am using a custom URL to point to a mobile web page if the app is not installed.
  3. Since I need some server data there, the mobile web page extracts the link data and redirects to a php page.
  4. On the php page, the user see the data from the link and has a “download app from app store” link

Now the last thing I want to achieve, is to let the user download the app while preserving the link data. I know this is one of your features, but my problem is that if I use the same branch app, the link redirect setting are now incorrect since again I am transferring the user to the custom url page and not to the app store…

What I was thinking of doing is create another branch app with different link settings, and use that on my php page.

WDYT?

Foxxy Mobile ltd. — Developer
Answered on July 3, 2016.

Thanks Alex!

First of all, I must tell you that It’s good to know you guys are taking your time to invest in some customer service (annoying) questions.. it’s important to know there is someone we can talk to..

I will try using a single app, and maybe play a bit with the control parameters.

Regarding analytics, since deep links are not a main feature in my app, I think I can live with that even on 2 apps.

Ran

Foxxy Mobile ltd. — Developer