Deep Links

General

Deep Links

Deep links allow users to launch a Zappar experience without first having to scan a zapcode. Here's an example deep link:

https://zpr.link/z/Kteb1c

Every zapcode has a deep link - when a user taps on a deep link they will be taken directly into the experience published to its corresponding zapcode. In the case that the user does not have the Zappar app installed on their device the following behavior occurs:

  • If the device supports Zappar but it is not installed the user will be directed to their app store to install Zappar.
  • If the device does not support Zappar a message will be displayed listing device compatibility.

Designer codes rely on the device's camera detecting the zapcode/target image to display content, therefore it is not recommended to deep link to a Designer experience.

There are a number of ways to find the deep link for a given zapcode:

  1. On the zapcode overview page in ZapWorks, the link is displayed on the right.
  2. In a Studio-built experience, calling Z.device.deepLinkId() returns the deep link for the current zapcode, without the https://zpr.link/ prefix.

Linking Between Experiences

Deep links can be used to move between different Zappar experiences - just use the link in conjunction with the existing features and functions for launching web links (e.g. Z.device.launchUrl(...)).

When doing so it's recommended that the https://zpr.link/ portion of the link is replaced with zappar:// since this ensures that the app gracefully handles the transition to the new content.

When using launchURL(...) with the https://zpr.link/ prefix the false argument needs to be passed for the deep link to work correctly. For the zappar:// prefix the false argument should not be passed.

Query Strings

Much like with a web link, you can provide information into an experience by passing it as the query string of a deep link.

https://zpr.link/ZID?myname=Zap%20Bot&myfriend=Mark&myfriend=Connell

In the example above everything after the ? is the query string which can be accessed using the queryStringRaw() and queryStringParameter(...) functions within a ZapWorks Studio script node. The ZID is a placeholder for the deep link of the target experience.

The example below shows a query string created from within a Studio script node. As the query string needs to be URL encoded in order for it to work we are using the encodeURIComponent JavaScript function to ensure this. We're also using the zappar:// prefix for the reasons mentioned in the section above. ZID is again a placeholder for the deep link of the target experience.

Z.device.launchUrl("zappar://" + ZID + 
                   "?myname=" + encodeURIComponent("Zap Bot") +
                   "&myfriend=" + encodeURIComponent("Mark")  +
                   "&myfriend=" + encodeURIComponent("Connell"));

To see how this particular query string can be accessed see the queryStringRaw() and queryStringParameter(...) function page examples.

Customizing Experiences By Launch Method

ZapWorks Studio experiences can customize their behavior based on the method the user took to launch the experience. The Z.device.launchMethod() function returns different values for the various possibilities. For more information see the LaunchMethod enum reference page.

Important Consideration

If an experience relies on tracking images or codes to function correctly, users that have entered such an experience by clicking on a deep link are unlikely to have the appropriate image. You may wish to use the launchMethod functionality mentioned above to provide an experience without the tracking image requirement in such cases.

Open in new window