React Native SDK: Implementing Deep-Links

 

Introduction

Deep-links are links that lead into specific content inside an app. When a user clicks a deep-link on a device that has the app installed, the app opens and shows a specific product or experience.

Singular tracking links can include deep-linking as well as deferred deep-linking (see our Deep-Linking FAQ and the Singular Links FAQ for more information).

The instructions below will show you how to:

  1. Access the tracking link that led to your app being opened,
  2. Read the deep-link destination, and
  3. Show the appropriate content.

Note: This article assumes your organization is using Singular Links - Singular's new tracking link technology, launched in 2019.

Older customers of Singular may be using Singular's older tracking links (legacy links). To support deep-linking with legacy links, see Handling Deep-Links with Legacy Links.

Enabling Singular Links

To enable Singular Links in iOS and in Android, see Singular Links Prerequisites.

Handling Singular Links

The Singular SDK provides a handler mechanism to read the details of the tracking link that led to the app being opened.

To use the handler:

  1. Call withSingularLinks when you create the SingularConfig object, as in the example below. This registers a Singular Links handler.
  2. Inside the handler, call or define a callback function that receives a SingularLinksParams object, as in the example below. The SingularLinksParams object contains the following fields:
    • deeplink - the deep-link address. This is what you need to parse in order to show the users the right product or experience.
    • passthrough - any pass-through parameters added to the deep-link.
    • isDeferred - true if this is a deferred deep-link.
const config = new SingularConfig('<API_KEY>', '<SECRET>');
config.withSingularLinks(singularLinksParams => {
    const deeplink = singularLinksParams.deeplink;
    const passthrough = singularLinksParams.passthrough;
    const isDeferred = singularLinksParams.isDeferred;
    // Add your code here to handle the deep-link
});
Singular.init(config);

 

Was this article helpful?
0 out of 0 found this helpful