App Clips
App Clip deferred deep linking is the highest-fidelity iOS attribution path Attriv supports: the click id rides the App Clip's invocation URL (path-carried, query-stripped) through the App Store boundary, so the full app's first launch attributes deterministically — no clipboard, no paste prompt, no fingerprint guess. It is immune to paste denials, clipboard overwrites, and iCloud Private Relay.
It is opt-in premium: the per-customer work below is real (an App Clip target + App Store Connect), which is why it's not the default. The pasteboard tiers cover apps that skip this — and cover the traffic the clip misses when both are enabled. See iOS attribution for how the two mechanisms combine.
Prerequisites
iosTeamIdandiosStoreIdset on your Attriv app (App → create form)- At least one verified link domain
- Xcode 14+, an Apple Developer account with the App Clips capability
- An App Clip target in your app (see the template below)
Attriv setup
Dashboard → your app → Settings → App Clip bundle id — enter your App Clip's bundle identifier (e.g. com.acme.app.Clip).
That one field turns on three server behaviors on your link domains:
- Smart App Banner — iOS landing pages render
<meta name="apple-itunes-app" content="app-id=…, app-clip-bundle-id=…">; tapping the banner's Open launches your App Clip. appclipsAASA entry —/.well-known/apple-app-site-associationgainsappclips: { apps: ["TEAMID.com.acme.app.Clip"] }, which Apple verifies before invoking the App Clip./c/click-path redirect — iOS clicks are 302'd tohttps://<domain>/c/<clickId>, because the invocation URL is the landing page's URL with query and fragment stripped — the/c/path is the only click-id carrier. (Gated on the full config — clip bundle id, store id, team id, and bundle id; partially-configured apps keep the inline landing.)
How it works end-to-end
- User taps your link in Safari → Attriv records the click → redirects to
/c/<clickId>→ landing page with the Smart App Banner. - User taps the banner's Open → your App Clip launches with invocation URL
https://<domain>/c/<clickId>. - The App Clip resolves the URL against the API, shows a branded card with the link's content, and writes the resolved
clickIdto the shared App Group container (keyattriv.click_id). - User taps Get the full app → App Store → install.
- The full app's first launch: the SDK reads the container value (deterministic, no prompts) and claims it →
matchType: "appclip".
Xcode + App Store Connect setup
- Add an App Clip target to your app (File → New → Target → App Clip). The system-generated bundle id is your app's id +
.Clip. - Associated domains on the App Clip target:
appclips:<your-link-domain>(one per verified domain). - Create an App Group (Signing & Capabilities → App Groups) shared between the full app and the App Clip — e.g.
group.com.acme.app. - Pass the App Group identifier to the SDK:
await Attriv.init({ appKey: "ak_…", apiUrl: "https://api.getattriv.com", appClipAppGroup: "group.com.acme.app", }); - In App Store Connect, register the App Clip under your app and create an App Clip experience whose invocation URL covers your link domain. The default experience is usually enough; advanced experiences let you customize per-URL cards.
- The App Clip ships with your app's review — keep it under 15 MB (a card UI is trivially inside).
App Clip template
The App Clip calls the public API directly (no Capacitor SDK in a 15 MB clip — keep it pure SwiftUI):
import SwiftUI
@main
struct AcmeClipApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.onContinueUserActivity(NSUserActivityTypeBrowsingWeb) { activity in
// Invocation URL: https://<domain>/c/clk_…
guard let url = activity.webpageURL else { return }
resolveAndStore(url: url)
}
}
}
/// Resolve the invocation URL against the Attriv API and write the click
/// id to the shared container for the full app's first launch to claim.
private func resolveAndStore(url: URL) {
var req = URLRequest(url: URL(string: "https://api.getattriv.com/v1/resolve")!)
req.httpMethod = "POST"
req.setValue("application/json", forHTTPHeaderField: "content-type")
req.httpBody = try? JSONSerialization.data(withJSONObject: [
"appKey": "ak_…", // the same app key the full app uses
"url": url.absoluteString,
])
URLSession.shared.dataTask(with: req) { data, _, _ in
guard let data,
let res = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
let clickId = res["clickId"] as? String
else { return }
if let suite = UserDefaults(suiteName: "group.com.acme.app") {
suite.set(clickId, forKey: "attriv.click_id")
}
}.resume()
}
}
struct ContentView: View {
var body: some View {
VStack(spacing: 16) {
Image(systemName: "gift").font(.system(size: 48))
Text("Your offer is waiting").font(.title2.bold())
Text("Get the full app to redeem it.")
.font(.subheadline)
.foregroundStyle(.secondary)
Link("Get the Full App", destination: URL(string: "https://apps.apple.com/app/id123456789")!)
.font(.headline)
.buttonStyle(.borderedProminent)
}
.padding()
}
}
The contract the template honors (and the full app's SDK expects):
| Piece | Value |
|---|---|
| Container | The App Group you pass as appClipAppGroup to Attriv.init |
| Key | attriv.click_id |
| Value | The clickId string from POST /v1/resolve |
| Consume | The SDK reads and removes the key on first launch — a later launch can't replay it |
Fallback path: invocation URL without the container
If the App Group isn't configured (or the container read raced the install POST), the full app still receives the invocation URL via the standard appUrlOpen universal-link flow on first launch. The SDK's automatic resolve handles it: /v1/resolve recognizes /c/<clickId> paths and late-claims an organic install in place — the response carries the updated attribution, which the SDK persists. Never downgrades an attributed install.
What App Clips don't cover
- In-app webviews (WhatsApp, Instagram, …) don't render Smart App Banners — those users keep the pasteboard flow.
- Banner-tap rate: users who tap the page's CTA instead of the banner go through the pasteboard flow. De-emphasizing the CTA on clip-configured apps steers traffic to the banner path.
- Ad-hoc/enterprise distributions without App Store Connect review can't ship App Clips.