Deep Links & Attribution
The Datafly mobile SDKs extract UTM parameters and vendor click IDs from deep links, enabling campaign attribution for mobile app traffic.
Handling deep links
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
| Parameter | Description |
|---|---|
utm_source | Traffic source (e.g., google, facebook) |
utm_medium | Marketing medium (e.g., cpc, email) |
utm_campaign | Campaign name |
utm_term | Paid search keyword |
utm_content | Ad 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:
| Parameter | Vendor | Description |
|---|---|---|
gclid | Google Ads | Google Click ID |
gbraid | Google Ads | App campaign click ID (iOS) |
wbraid | Google Ads | Web-to-app click ID (iOS) |
fbclid | Meta | Facebook Click ID |
ttclid | TikTok | TikTok Click ID |
epik | Pinterest Click ID | |
msclkid | Microsoft Ads | Microsoft Click ID |
sccid | Snapchat | Snapchat Click ID |
twclid | X (Twitter) | Twitter Click ID |
li_fat_id | LinkedIn First-Party Ad Tracking ID | |
rdt_cid | Reddit Click ID | |
irclickid | Impact Radius | Impact affiliate click ID |
Click IDs are included in the vendor IDs payload and delivered to the corresponding vendor’s API for conversion attribution.
Example deep link URL
https://example.com/product/123?utm_source=google&utm_medium=cpc&utm_campaign=summer_sale&gclid=abc123&fbclid=def456This would:
- Set campaign context:
{ source: "google", medium: "cpc", campaign: "summer_sale" } - Capture click IDs:
{ gclid: "abc123", fbclid: "def456" } - 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.
Universal Links / App Links
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.