Mobile SDKsDeep Links & Attribution

Deep Links & Attribution

The Datafly mobile SDKs extract UTM parameters and vendor click IDs from deep links, enabling campaign attribution for mobile app traffic.

Call handleDeepLink() when your app receives a deep link URL:

iOS (Swift)

// SwiftUI
.onOpenURL { url in
    Datafly.shared.handleDeepLink(url: url)
}
 
// UIKit SceneDelegate
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
    if let url = URLContexts.first?.url {
        Datafly.shared.handleDeepLink(url: url)
    }
}
 
// UIKit AppDelegate (legacy)
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
    Datafly.shared.handleDeepLink(url: url)
    return true
}

Android (Kotlin)

// In your Activity
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    intent.data?.let { Datafly.handleDeepLink(it) }
}
 
override fun onNewIntent(intent: Intent) {
    super.onNewIntent(intent)
    intent.data?.let { Datafly.handleDeepLink(it) }
}

React Native

import { Linking } from 'react-native';
 
Linking.addEventListener('url', ({ url }) => {
  DataflySignal.handleDeepLink(url);
});

What gets extracted

UTM parameters

ParameterDescription
utm_sourceTraffic source (e.g., google, facebook)
utm_mediumMarketing medium (e.g., cpc, email)
utm_campaignCampaign name
utm_termPaid search keyword
utm_contentAd content variation

UTM parameters are attached to all subsequent events in the context.campaign object until overwritten by a new deep link.

Vendor click IDs

The SDK extracts 13 vendor-specific click IDs from URL query parameters:

ParameterVendorDescription
gclidGoogle AdsGoogle Click ID
gbraidGoogle AdsApp campaign click ID (iOS)
wbraidGoogle AdsWeb-to-app click ID (iOS)
fbclidMetaFacebook Click ID
ttclidTikTokTikTok Click ID
epikPinterestPinterest Click ID
msclkidMicrosoft AdsMicrosoft Click ID
sccidSnapchatSnapchat Click ID
twclidX (Twitter)Twitter Click ID
li_fat_idLinkedInLinkedIn First-Party Ad Tracking ID
rdt_cidRedditReddit Click ID
irclickidImpact RadiusImpact affiliate click ID

Click IDs are included in the vendor IDs payload and delivered to the corresponding vendor’s API for conversion attribution.

https://example.com/product/123?utm_source=google&utm_medium=cpc&utm_campaign=summer_sale&gclid=abc123&fbclid=def456

This would:

  1. Set campaign context: { source: "google", medium: "cpc", campaign: "summer_sale" }
  2. Capture click IDs: { gclid: "abc123", fbclid: "def456" }
  3. Attach both to all subsequent events

Click IDs are treated as vendor IDs and are sent to the server alongside the self-generated vendor IDs (GA4 client_id, Meta fbp, etc.). The server stores them in the identity graph and includes them when delivering events to the corresponding vendor’s API.

The handleDeepLink() method works with any URL format:

  • Custom scheme: myapp://product/123?gclid=abc
  • Universal Links (iOS): https://example.com/product/123?gclid=abc
  • App Links (Android): https://example.com/product/123?gclid=abc

The SDK only reads query parameters — it does not interpret the URL path or scheme.