Skip to content

Deep Linking

Deep links are available to the following destinations:

  • Main offers feed - poweredbydosh://rewards_feed
  • Detail offer feeds:
    • poweredbydosh://offer_subfeed?id=<id>
    • poweredbydosh://offer_collection?id=<id>
  • Offers map - poweredbydosh://offer_map
  • Account summary - poweredbydosh://account_summary
  • Brand Details - poweredbydosh://brand?id=<brand_id>

The SDK supports being launched via two forms of deep links:

  1. Explicit SDK deep links - Deep links with a poweredbydosh:// url scheme. These links may be manually constructed and passed directly to present the SDK.
1
2
3
4
let url = URL(string: "poweredbydosh://brand?id=CVS")
if let deepLink = DoshDeepLink(url: url) {
    Dosh.instance?.presentRewards(from: self, landingScreen: .deepLink(deepLink))
}
1
2
3
4
5
val url = "poweredbydosh://brand?id=CVS"
DoshDeepLink.from(url)?.let { deepLink ->
    // "this" being an Activity
    PoweredByDosh.instance?.handleDeepLink(this, deepLink)
}
  1. Forwarded deep links from our Marketing API - Deep links with your app's url scheme, and a host of dosh_context. These links are typically provided via our Marketing API, and are intended to be forwarded to the SDK upon app launch.
1
2
3
4
5
6
7
8
9
func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
    if let deepLink = DoshDeepLink(url: url) {
        let viewController = window.rootViewController.topViewController
        Dosh.instance?.presentRewards(from: viewController, landingScreen: .deepLink(deepLink))
    } else {
        // The URL is not sent from the Cardlytics Marketing API.
        // Perform your own deep link handling.
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        ...

        intent?.data?.let { uri ->
            DoshDeepLink.from(uri)?.let {
                PoweredByDosh.instance?.handleDeepLink(this, it)
            } ?: run {
                // The Uri is not sent from the Cardlytics Marketing API.
                // Perform your own deep link handling.
            }
        }
    }
}