A deep link is a link that directs users to specific events or pages in your app. They offer a seamless experience by ensuring that users are directly routed to what they have seen in the smart banner. The Smart Banner SDK supports plain string dynamic deep links and deep link templates containing placeholders. Placeholders are filled by the SDK using provided deep link context or GET parameters of the web page URL.
There are two ways to configure a dynamic deep link in the Smart Banner SDK:
- Pass parameters to the
AdjustSmartBanner.init
function.- Provide context by configuring the
context
object.
- Provide context by configuring the
- Call the
setAndroidDeepLinkPath
andsetIosDeepLinkPath
setters.- Provide context by calling the
setContext
setter - Provide context by using GET parameters
- Provide context by calling the
Configure your deep link path and context setters
Use these functions to configure your dynamic deep links and set dynamic context.
Set your deep link path
You must configure deep link paths for your target mobile platform using the setAndroidDeepLinkPath
and setIosDeepLinkPath
setter functions. These functions accept a string value that can be either an absolute path or a template path.
To set your deep link paths, call the AdjustSmartBanner.setIosDeepLinkPath
and AdjustSmartBanner.setAndroidDeepLinkPath
functions with the relevant paths to events or screens for each platform.
The deep link path may contain any number of parameters enclosed in curly braces.
The Smart Banner SDK replaces these parameters with values from the context provided:
Set dynamic deep link context
You can add your dynamic deep link context by calling the AdjustSmartBanner.setContext
function with an object containing key-value pairs of context values.
The Smart Banner SDK replaces any placeholder that matches a context key with the corresponding context value.
In this example, the resulting dynamic deep link path for iOS is products/jeans/?product=cool-jeans&promo=spring_10
.
In this example, the resulting dynamic deep link path for Android is products/jeans/?product=&promo=
.
In this example, the second call to setContext
overwrites the context from the first call. The resulting dynamic deep link path is products//?product_id=blue_jeans
as a blank string is substituted for the non-matching {category}
parameter.
In this example, the context is set correctly and the resulting dynamic deep link path is products/shoes/?product=red-sneakers
.
Use GET parameters as context
If any of the parameters in your deep link path are missing in the context
, the SDK will attempt to use parameters in the current page URL.
In the following example:
- The
category
parameter is filled out using the value provided in thesetContext
setter. - The current page URL is
https://my-shop.com/spring-promo?product_id=cool-jeans&promo=spring_10
.
The SDK reads the values for product_id
and promo
from the page URL. The resulting dynamic deep link path is products/jeans/?product=cool-jeans&promo=spring_10
.
In the following example:
- The
product_id
parameter is set by thesetContext
setter. - The current page URL is
https://my-shop.com/spring-promo?product_id=cool-jeans&promo=spring_10
.
Since the product_id
value is set by the setContext
setter, the value in the URL parameters is overridden. The resulting dynamic deep link path is products/jeans/?product=floral-jeans&promo=spring_10
.