Deep links are used to send users directly to specific in-app locations, producing a seamless user journey and improving conversion rates. This chapter will introduce necessary steps to generate deep links in SolarEngine.
If a user already has your app installed and clicks on your deep link, SolarEngine SDK will open your app, parse the deep link information, and direct users to the page where you wanted them to land. To set up a deep link, you'll need to define a unique URI scheme.
If you want to navigate your users to an activity within your app, you can follow the steps below:
1. Define a unique scheme name for your activity in your app's AndroidManifest.xml file.
2. Add an intent-filter for your activity.
3. Add an android:scheme in your intent-filter.
Here is an example code snippet defining the activity name as "MainActivity" and scheme name as "sedemo" in the AndroidManifest.xml file.
<activity
android:name=".activity.MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sedemo" />
</intent-filter>
</activity>
If a user clicks on the following example link, which includes your specified scheme name and follows the accepted URL Scheme protocol format of scheme://yourhost:port/path, the activity will be triggered.
Example:
sedemo://lionmobo.com/goods_detail?param1=value1¶m2=value2
To extract the deep link information from the activity's intent, you can call the getData() method within the onCreate() or onNewIntent() method when the app starts.
Example 1: onNewIntent()
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Uri data = intent.getData();
// data.toString() -> deeplink information.
}
Example 2: onCreate()
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = getIntent();
Uri data = intent.getData();
// data.toString() -> deeplink information.
}
App Links are a special deep link that allows for seamless linking between mobile apps and websites. When a user clicks on a link on the website, App Links facilitates direct opening of the associated app without presenting a a selection dialog for the user to decide which app to use. Another benefit is that it can avoid the problem of duplication that can occur with traditional URL schemes. But this method cannot be called in browsers.
To verify the association between your app and your website, you can check if the assetlinks.json file can be downloaded successfully from your website by typing the URL https://{domain}/.well-known/assetlinks.json in a web browser.
Please replace "domain" as the one you input on SolarEngine platform, such as tlink.solar-engine.com.
Entry: Attribution - Retargeting Attribution Settings - Configure App Links - Subdomain
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "The package name of your app",
"sha256_cert_fingerprints":
["The sha256_cert_fingerprints of your app"]
}
}]
<activity
android:name=".activity.SplashActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="The subdomain you set on SE"
android:pathPattern="The path you set on SE" />
</intent-filter>
</activity>
To re-attribute users, please call the appDeeplinkOpenURI method in SolarEngine SDK when your app receives the deep link content. Then our SDK will extract the re-attribution information from the deep link and send this information to our server for re-attribution.
Function
public void appDeeplinkOpenURI(Uri uri);
Sample Code
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Uri data = intent.getData();
if(data != null) {
SolarEngineManager.getInstance().appDeeplinkOpenURI(data);
}
}
Function
setDeepLinkCallback(DeepLinkCallBack callback);
Sample Code (You need to call this method before initializing the SDK)
SolarEngineManager.getInstance().setDeepLinkCallback(new DeepLinkCallBack() {
@Override
public void onReceived(int code, DeeplinkInfo deeplinkInfo) {
if(code == 0){
// Process deep link callback success
}
}
});
//SDK initiate ...
DeeplinkInfo Parameters Explanation
Parameter | Description | Type |
---|---|---|
sedpLink | redirection parameters | String |
turlId | 7-bit tracking URL | String |
from | link type | String |
customParams | custom parameters | Map<String,Object> |
ErrorCode Explanation
error code | error reason |
---|---|
0 | Success |
1 | Blank URL |
2 | Illegal URL |
Developers can report the deep link successful invocation event for further user re-engagement analysis.
Function
public synchronized void trackAppReEngagement(SEAppReEngagementModel seAppReEngagementModel);
Sample Code
SolarEngineManager.getInstance().trackAppReEngagement(new SEAppReEngagementModel());