Deep Linking
Handle incoming deep links in your iOS app with the Grovs SDK
Receiving deep link events
Conform to the GrovsDelegate protocol to receive deep link callbacks:
class YourViewController: UIViewController, GrovsDelegate {
override func viewDidLoad() {
super.viewDidLoad()
Grovs.delegate = self
}
func grovsReceivedPayloadFromDeeplink(link: String?, payload: [String: Any]?, tracking: [String: Any]?) {
// Route the user based on payload data
if let screen = payload?["screen"] as? String {
navigateTo(screen)
}
}
}Handling SDK errors
GrovsDelegate has an optional grovsDidEncounterError callback. It has a default no-op implementation, so existing delegates keep compiling — implement it to surface failures to your own logging:
func grovsDidEncounterError(_ error: GrovsError, message: String) {
Analytics.log("grovs_error", ["code": error.description, "message": message])
}| Case | Meaning |
|---|---|
.authenticationFailed | Authentication with the backend failed — check the API key and bundle ID. |
.networkRequestFailed | A request failed after retries. The SDK backs off and retries later. |
.eventDispatchFailed | An event batch failed to send. The events stay queued. |
.linkGenerationFailed | Link generation failed. |
Errors are informational — the SDK recovers on its own. Both delegate methods are called on the main thread.
Clipboard-assisted deferred deep linking
When a link with copy-to-clipboard enabled is opened in a browser, the preview page copies it to the visitor's clipboard before sending them to the App Store. On the first launch after install, the SDK reads it and attributes the install deterministically. The deferred link arrives through the same grovsReceivedPayloadFromDeeplink callback as a fingerprint match.
This works with no integration. It runs only on a fresh install, never on an upgrade, and iOS may show its system paste confirmation on that first launch. The prompt is skipped entirely for projects with no clipboard-enabled link clicks in the last 48 hours, and for devices whose clipboard holds no web URL. Denying it simply leaves the install unattributed.
If your project serves links from a custom domain, list it so the SDK recognizes your links — content on any other host is never read or sent:
Grovs.configure(
APIKey: "your-api-key",
useTestEnvironment: false,
clipboardDomains: ["links.yourdomain.com"],
delegate: self
)Enable copy-to-clipboard per link with copyToClipboardiOS, or set the default for the whole project in the dashboard.
Retrieving past payloads
Get the most recent payload:
Grovs.lastReceivedPayload { payload in
print("Last payload: \(payload)")
}Get all payloads received since app launch:
Grovs.allReceivedPayloadsSinceStartup { payloads in
guard let payloads = payloads else { return }
for payload in payloads {
print("Payload: \(payload)")
}
}Getting link details
Retrieve the details for a specific link path:
Grovs.linkDetails(path: "/my-link-path") { details in
print("Link details: \(details)")
}