https://yourbrand.dshl.in/Ab12Cd) is a Universal Link and does not require this SDK. Recovering the original content after an App Store install, and joining that first open to the store tap, does.
click_id as the store tap.
When you need the SDK
Without the SDK, a fresh install opens on the home screen and the store tap cannot be joined to first open. See Receive for the routing vs deferred map.
Install
Swift Package Manager
In Xcode: File → Add Package Dependencies →https://github.com/Dashlink-ai/dashlink-ios.git from 1.0.0. Add the Dashlink product to your app target.
Or in Package.swift:
CocoaPods
Dynamic Link API key
JSON resolve that writes tracking requires a Dynamic Link API key. REST keys (dlk_live_) are rejected.
- In the dashboard, go to Settings → API Keys → Type Dynamic Link.
- Copy the
dlk_sdk_…key once and callDynamicLinks.configure(apiKey:)beforehandleUniversalLink/performDeferredCheckIfNeeded. - The SDK sends it as
X-API-Key(header only). A leaked IPA key can hit that org’s resolve URL; it cannot call the dashboard REST API.
configure rejects keys that do not start with dlk_sdk_.
Declare the Dynamic Link host
Dashlink already hosts the Apple app site association file on the Dynamic Link domain. The app must still declare that host. Associated Domains must includeapplinks: plus {subdomain}.dshl.in, not only the marketing site.
Receive Universal Links
scene(_:continue:) with the same webpageURL.
dynamicLinkHosts restricts which https URLs the SDK treats as Dashlink short URLs.
On an installed tap the SDK JSON-resolves the short URL (deferred=0, match=direct), returns appUrl, and analytics records app_open. The query parameters the SDK sends are listed on Receive.
Deferred first-open
When the app is missing, Dashlink shows a store interstitial that copies the short URL (withdl_cid) to the pasteboard, then opens the App Store.
Call once at launch:
- Reads
UIPasteboard.generalifDashlinkPasteboardRetrievalEnabledis notNO. - Accepts the value only when it looks like this app’s Dynamic Link host.
- JSON-resolves with
deferred=1,match=pasteboard, and the recoveredclick_id. - Returns
PendingDynamicLink(appUrl, UTMs,isDeferred=true,clickId). - Clears the pasteboard value and marks deferred consumed (
UserDefaultskeyai.dashlink.sdk.deferredChecked) so a later launch does not re-fire.
deferred_open is published.
Paste banner (iOS 14+)
Reading the pasteboard can show the system Allow Paste banner once. That is expected iOS behavior. Users who deny paste cannot recover the pending link; the SDK reports a miss and still consumes the check. Disable with Info.plist:Misses
Empty pasteboard, foreign text, or a URL that is not this app’s Dynamic Link host is a miss. Deferred is still marked consumed. There is no silent home-screen drop that looks like success. Clearing app data re-runs recovery. Reinstall is a new container, so first open after reinstall checks again. Recovery uses the pasteboard value only. If the interstitial never copied the short URL, or the user overwrote the clipboard, there is no destination to recover.Tracking
The store interstitial / App Store hop is the click. SDK JSON resolve is an outcome on that click whenclick_id matches, not a second campaign click.
Campaign totals should unique-count by
click_id. Do not add deferred_open to click volume. Replay of the same click_id still returns app_url but does not publish a second deferred_open.
Test on a device
Simulators do not exercise Universal Link association the way a real device does.1
Delete the app
So the next tap takes the store path, and iOS will refetch the association file on reinstall.
2
Tap a staging Dynamic Link
The interstitial copies the short URL and
dl_cid, then opens the App Store.3
Install a build that includes the SDK
Associated Domains must list the Dynamic Link host.
4
Open once
First open may show a paste banner. After allowing, the app must land on
appUrl. Analytics must show deferred_open for the same click_id as the store tap.