Universal Links support

iOS requires a secure connection between an application and its associated domains. In order to establish such a connection, AppMetrica puts a file called apple-app-site-association on its domain. File contains Bundle ID and App Prefix applications.

  1. Setting up Universal Links
  2. Preparing your app
  3. Configuring your app
  4. Ways to use Universal Links
  5. Testing

Setting up Universal Links

To activate Universal Links for your app, follow these steps in the AppMetrica web interface:

  1. Go to the Applications section.
  2. Select the app and go to Settings.
  3. Open the Main tab and enter your app's Bundle ID and App Prefix.

    How to get the Bundle ID
    You can find the Bundle ID in the Apple developer console, in Organization Profile → Account Summary. In Xcode, you can find it in Target → General.
    How to get the App Prefix

    You can find the App Prefix in the Apple Developer Console. In most cases, the App Prefix is the same as the Team ID. This ID is also available in the Apple Developer Console (in the Member Center, click your name in the upper-right corner of the window and choose View Account → Developer Account Summary).

  4. Set the Use Universal Link option to On and click Save settings. After this, you will see a link in the Universal Link field that looks like applinks:<app_id>.redirect.appmetrica.yandex.com, where <app_id> is your app's ID in AppMetrica (application ID).

Preparing your app

If your app is already registered in the Apple Developer Center, go to the developer console and enable Associated Domains for the application ID:

  1. Go to Identifiers → App IDs.
  2. Select the app, then enable the Associated Domains option for the Development and Distribution columns.
  3. Generate initialization files for your app, then download and install them.

Configuring your app

In the Xcode interface, follow these steps:

  1. Select the app target.
  2. In Capabilities, enable the Associated Domains option.
  3. In Domains, enter the Universal Link generated by AppMetrica.

Ways to use Universal Links

AppMetrica offers several ways to use Universal Links.

Using standard tracking links with deeplinks enabled

Click-throughs from a tracking URL go to the AppMetrica redirect service, regardless of whether the app is installed on the device. The redirect service then takes the user to a Universal Link.

What happens next depends on the circumstances:

  • The app opens, if it is already installed.
  • The app's page in the App Store opens, if the app isn't installed.
Advantages
  • Complete information. You can always track click-throughs from the tracking URL.
  • Simplicity. You won't need to change tracking URLs that you are already using on advertising platforms.
Disadvantages
The app opens from the tracking URL only if the link is clicked in a browser. However, some browsers don't support redirects to the Universal Link. If the link wasn't opened in a browser, the user is redirected to the App Store, even if the app is already installed.

For more information about setting up tracking URLs, see Parameters of the tracking URL.

Using a direct Universal Link

A direct Universal Link has the following format:

https://<application_id>.redirect.appmetrica.yandex.com/?appmetrica_tracking_id=<tracking_id>

Depending on the circumstances, clicking a link like this makes one of the following happen:

  • The app opens, if it is already installed.
  • The app's page in the App Store opens, if the app isn't installed.
Advantages
Maximum coverage of sources where the Universal Link can be published. Direct links aren't confined to browsers – they also work from mobile app ads (app-to-app advertising).
Disadvantages
Statistics might be incomplete: if the app is installed, the direct link opens it without going through the redirect service. This click-through isn't registered in AppMetrica. Since this doesn't affect statistics on new users, the data loss is inconsequential. If the app isn't installed, AppMetrica registers a click-through to the App Store using the direct Universal Link.

Testing

Now your app is fully configured and you can use Universal Links. While the application included Universal Links, when referring to the domain of the view applinks:<app_id>.redirect.appmetrica.yandex.com, will navigate directly to the app.

Note. To test how the Universal Link works, you must use a real device. If the Associated Domain is changed, make sure the app is reinstalled.

If Safari opens instead of the app, reinstall the app. If the problem persists, add a new Associated Domains row in Xcode (so it will change), and then reinstall the app.

Make sure that your link has the same domain as your app.