Introduction


Learn how to use Smler to create deep links for your mobile app (with native support for React Native, iOS, and Android).

With deep links, your users get the best available experience for the platform they open your link on. If a user opens a Deep Link on iOS or Android, they can be taken directly to the linked content in your native app. If a user opens the same Deep Link in a desktop browser, they can be taken to the equivalent content on your website.

Step 1: Register a custom domain

Before you can create deep links, you need to configure your deep link custom domain in smler. This involves adding a custom domain that will be used for your deep links and configuring your deep link configuration files

Add a custom domain

First, you’ll need to add a custom domain to your Smler workspace. Navigate to your workspace domain settings and click add domain.

You can use a domain you already own and point it's cname to smler.in and start using it

Blog article on how to configure custom domain (in just 5 mins)

Set up your deep link configuration files

Once you’ve set up your custom domain, you’ll need to upload your deep link configuration file content on our server. Smler will host these files and serve it to android and iOS AASA when they request it. This configuration is required for auto verifying of domain and deep link to work

You can upload these assets by navigating to deffered link section in smler.

iOS (apple-app-site-association)

For iOS apps, upload your Apple App Site Association file to enable iOS deep links

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "<YOUR_APPLICATION_IDENTIFIER_PREFIX>.<YOUR_APPLICATION_BUNDLE_IDENTIFIER>",
        "paths": []
      }
    ]
  }
}

Android (assetlinks.json)

For Android apps, upload your AssetLinks file to enable Android deep links:

You can upload upload the file content in deferred link section

[
  {
    "target": {
      "namespace": "android_app",
      "package_name": "YOUR_PACKAGE_NAME",
      "sha256_cert_fingerprints": []
    },
    "relation": ["delegate_permission/common.handle_all_urls"]
  }
]

Verify that your configuration files are set up correctly

Once you’ve set up your deep link configuration files, you can go to their respective URLs to verify that they’ve been configured correctly:

iOS: yourdomain.link/.well-known/apple-app-site-association (example)

Android: yourdomain.link/.well-known/assetlinks.json (example)

Once, the content is updated you can verify the content by visiting the url specified in the page. Once, both links are visible you can proceed to next step

Allowlist your deep link domain in your app

Last but not least, you’ll need to allowlist your deep link domain in your apps to allow them to redirect straight into a page within your app.

For iOS apps, you’ll need to allow websites to link to your apps.

For Android apps, you’ll need to verify your Android app links.

Go to smler dashboard and create a short link as you would normally and simply toggle the deep link flag and that's it no extra action is needed apart from this.

If you set the deep links via api. Pass isDeferredLink=true in payload. To view the request response in detail you can checkout the postman docs

Along with deep links smler links also support, custom slug, temporary links, permanent links, analytics and much more.

If the user already has the app installed then your app would be opened by default and you would have to manually handle navigation in your app.

If the user has not installed the app then they would be redirect to app store or play store based on the device that they are using.

Scenario 1: User already has the app installed

Your app will receive the url when it opens up. The url will be in the format https://yourcustomdomain.com/short-link

Using this url you'll hit the smler endpoint to get the corresponding long URL for this short url. Using that you can open the specific screen in app.

Scenario 2: User does not have app installed

When your app isn’t installed, the user will be redirected to the App Store or Google Play Store based on device.

Once, the app is opened you'll follow the deferred deep link guide to extract the short code.

Guide for android

Guide for iOS

After the app installs and opens. You can track it into a conversion. By, hitting the track open endpoint in smler

Before deploying your deep links to production, test them thoroughly using emulators to ensure they work correctly.

Test on Android emulator

Use the Android Debug Bridge (adb) to test your deep links on an Android emulator:

adb shell am start -W -a android.intent.action.VIEW -d "https://yourdomain.link/your-short-link" com.yourpackage.name

Test on iOS simulator

Use the xcrun command to test your deep links on an iOS simulator:

xcrun simctl openurl booted "https://yourdomain.link/your-short-link"

Test on your device

You can also test your deep links by opening them from a messaging app on your device:

  1. Open a messaging app (like Messages, WhatsApp, or Telegram) on your device

  2. Send yourself a message containing your deep link URL

  3. Tap on the link in the message

  4. The link should either open your app directly or redirect to the appropriate app store

Published with LeafPad