Deep Link Tracking in Mobile SDKs

Learn about the deep link tracking feature available in the Android (Kotlin) and iOS (Swift) SDKs.

This guide walks you through the deep link tracking feature available in the RudderStack Android (Kotlin) and iOS (Swift) SDKs.

Overview

Deep links are URLs that navigate users directly to specific content within your app, bypassing the home screen. The RudderStack mobile SDKs support tracking deep link opens, allowing you to:

  • Capture which deep links bring users into your app
  • Track query parameters for attribution and analytics
  • Understand user acquisition sources and campaign performance
The Android (Kotlin) SDK provides automatic deep link tracking, while the iOS (Swift) SDK requires manual API calls to track deep links.

Event structure

When a deep link is tracked, the SDK sends a track event with the event name Deep Link Opened. The event properties include:

PropertyTypeDescription
urlStringThe complete URL string
Query parametersStringEach query parameter is extracted and added as a separate property

For example, the SDK sends the below event for the deep link https://test.com/_app?id=123&ref=campaign:

json
{
  "event": "Deep Link Opened",
  "properties": {
    "url": "https://test.com/_app?id=123&ref=campaign",
    "id": "123",
    "ref": "campaign"
  }
}

iOS (Swift)

The RudderStack iOS (Swift) SDK provides a manual API to track when users open your app via deep links. You can use the open(url:options:) method to track deep link events:

swift
analytics.open(url: url, options: ["source": "email_campaign"])

// Without options
analytics.open(url: url)

Custom properties

The iOS (Swift) SDK supports custom options that are merged into the event properties. Any additional options you pass to the open(url:options:) method are included in the event payload.

For universal links, implement the appropriate delegate method in your app:

swift
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
    guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
          let url = userActivity.webpageURL else { return }

    analytics.open(url: url, options: ["type": "universal_link"])
}

Android (Kotlin)

The RudderStack Android (Kotlin) SDK provides automatic deep link tracking, meaning it automatically tracks deep link events when your app is opened via a deep link, without requiring manual API calls.

Deep link tracking is enabled by default in the Android (Kotlin) SDK.

To enable or disable automatic deep link tracking, set the trackDeepLinks parameter in the Configuration object during SDK initialization:

kotlin
val configuration = Configuration(
    application = application,
    writeKey = "YOUR_WRITE_KEY",
    dataPlaneUrl = "YOUR_DATA_PLANE_URL",
    trackDeepLinks = false  // Set to true to enable automatic deep link tracking
)
val analytics = Analytics(configuration)

Additional properties

The Android SDK captures additional referrer information:

PropertyTypeDescription
referring_applicationStringThe URI of the app that opened the deep link (if available)

A sample event payload with referrer information is shown below:

json
{
  "event": "Deep Link Opened",
  "properties": {
    "url": "https://test.com/_app?id=123&ref=campaign",
    "referring_application": "android-app://com.example.referringapp",
    "id": "123",
    "ref": "campaign"
  }
}

To open a deep link from another Android app with proper referrer attribution:

kotlin
val url = "https://test.com/_app?id=123&ref=campaign"
val intent = Intent(Intent.ACTION_VIEW).apply {
    data = Uri.parse(url)
    putExtra(Intent.EXTRA_REFERRER, Uri.parse("android-app://${context.packageName}"))
}
context.startActivity(intent)

FAQ

Do the mobile SDKs support deferred deep linking?

No — deferred deep linking is not supported in either the iOS (Swift) or Android (Kotlin) SDKs.

Deferred deep linking requires a backend service to capture and store the deep link URL when a user clicks it (before the app is installed), then match and deliver that data after installation. This server-side infrastructure is beyond the scope of a client-side SDK.


Questions? Let's figure it out together.

Join the RudderStack Slack community to connect with other users, customers, and the RudderStack team — or reach out for direct support.