💡 Pro feature
This functionality is only available on the Pro plan.
Dynalinks offers two powerful methods for iOS attribution and deferred deep linking, giving you flexibility in how you track user acquisition and handle app installations. Both methods are available on PRO plans and can be used together for comprehensive tracking.
Method 1: Clipboard-Based Deferred Deep Linking
Our original clipboard-based solution works universally across all iOS versions and provides reliable deferred deep linking.
How It Works
You can enable iOS Deferred Deep Linking by setting the parameter ios_deferred_deep_linking_enabled
to true
when generating a Dynalink.
If a user does not have your app installed and clicks on one of your Dynalinks, they will be directed to a preview landing page that provides context about the link. This page will include a “Download on the App Store” button to prompt the user to install the app.
Once the user taps this button and is redirected to the App Store, the deep link URL associated with the Dynalink will be automatically copied to the device’s clipboard.
Implementation in Swift
To retrieve this copied URL after your app is installed and launched, you can use the UIPasteboard
API in Swift:
func handleClipboardIfNeeded() {
// You may want to check this only on first launch
let pasteboard = UIPasteboard.general
if let clipboardText = pasteboard.string,
clipboardText.hasPrefix("https://{your-project}.dynalinks.app") {
// Handle your referral or deep link
print("📋 Found deep link in clipboard: \(clipboardText)")
// TODO: Route user or save referral info, etc.
// e.g., DeepLinkHandler.handle(url: clipboardText)
// Optionally clear the clipboard (user privacy)
// pasteboard.string = nil
}
}
💡 Important note
iOS requires explicit user consent when an app accesses the clipboard, especially if the app is running in the foreground. Be mindful of this to avoid any disruptions in user experience.
User-Friendly Paste Button Approach
If you want to avoid automatic clipboard access, you can use PasteButton:
PasteButton(payloadType: String.self) { strings in
print("📋 Pasted deep link: \(strings.first ?? "N/A")")
}
This provides a built-in button that allows users to paste content into your app explicitly, removing the need for silent clipboard access.
For example, you might show a prompt like:
VStack(spacing: 16) {
Text("Did you install this app from a shared link?")
.font(.headline)
Text("Tap the button below to let us know which link brought you here.")
.font(.subheadline)
.multilineTextAlignment(.center)
PasteButton(payloadType: String.self) { strings in
if let pasted = strings.first,
pasted.hasPrefix("https://{your-project}.dynalinks.app") {
print("📋 Received deep link: \(pasted)")
// DeepLinkHandler.handle(url: pasted)
}
}
.buttonStyle(.borderedProminent)
}
React Native Support
To replicate iOS Deferred Deep Linking functionality in React Native, you can use the Clipboard API:
npx expo install @react-native-clipboard/clipboard
Check the clipboard on app start:
import Clipboard from '@react-native-clipboard/clipboard';
import { useEffect } from 'react';
useEffect(() => {
const checkClipboard = async () => {
const text = await Clipboard.getString();
if (text.startsWith('https://{your-project}.dynalinks.app')) {
console.log('📋 Found deep link in clipboard:', text);
// Handle deep link routing here
}
};
checkClipboard();
}, []);
User-friendly paste button implementation:
import React from 'react';
import { Button, Text, View, Alert } from 'react-native';
import Clipboard from '@react-native-clipboard/clipboard';
export default function DeepLinkPrompt() {
const handlePaste = async () => {
const text = await Clipboard.getString();
if (text.startsWith('https://{your-project}.dynalinks.app')) {
Alert.alert('Found Deep Link', text);
// Handle the deep link
} else {
Alert.alert('No valid link found');
}
};
return (
<View style=>
<Text style=>
Did you install this app from a shared link?
</Text>
<Text style=>
Tap the button below to let us know which link brought you here.
</Text>
<Button title="Paste Link" onPress={handlePaste} />
</View>
);
}
Method 2: Apple Campaign Tracking
Apple Campaign Tracking is Apple’s official method for campaign attribution and provides native App Store integration for marketing campaigns.
What is Apple Campaign Tracking?
Apple Campaign Tracking allows you to track marketing campaigns by adding specific parameters to your App Store URLs. When users install your app through these tracked links, you can attribute the installation to the correct marketing source and campaign.
This is Apple’s official method for campaign attribution, as detailed in their App Store Connect documentation.
How It Works
When you add campaign tracking parameters to your links, Dynalinks automatically generates App Store URLs with the proper attribution parameters:
Standard App Store URL:
https://apps.apple.com/app/id123456789
With Campaign Tracking:
https://apps.apple.com/app/id123456789?pt=123456&ct=holiday2024&mt=8
Parameters Explained
pt
(Provider Token): Your Apple affiliate program provider tokenct
(Campaign Token): Your custom campaign identifiermt=8
: Automatically added to indicate this is a mobile app link
Setting Up Campaign Tracking
Via API
Add provider_token
and campaign_token
to your link creation requests:
{
"name": "Holiday Campaign Link",
"path": "holiday-sale",
"url": "https://myapp.com/holiday",
"provider_token": "123456",
"campaign_token": "holiday2024",
"ios_app": {
"bundle_id": "com.mycompany.myapp",
"app_store_id": "123456789"
}
}
Via Console
- Navigate to your project’s Links section
- Create or edit a link
- In the Attribution section (after the Referrer field), you’ll find two new fields:
- Apple Provider Token: Your affiliate program provider token
- Campaign Token: Your custom campaign identifier
- Both parameters are required together
- These fields are only available for PRO projects
Via Unnamed Links
Add campaign parameters directly to your URLs:
https://yourproject.dynalinks.app/?link=https://myapp.com/content&ibi=com.mycompany.myapp&pt=123456&ct=holiday2024
App Store Connect Analytics
Campaign attribution is also available through Apple’s App Store Connect analytics, providing detailed insights into:
- Installation sources
- Campaign performance
- User acquisition costs
- Conversion rates
Validation Requirements
Both provider_token
and campaign_token
must be provided together for Apple Campaign Tracking. Attempting to set only one parameter will result in a validation error.
For clipboard-based deferred deep linking, simply set ios_deferred_deep_linking_enabled
to true
.