Deep links are used to send users directly to specific in-app locations, producing a seamless user journey and improving conversion rates. 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. This chapter will introduce necessary steps to generate deep links in SolarEngine.
Universal Link Example: test1.link.solar-engine.com
URL Scheme Example: test1://
In your iOS project, select TARGETS > Signing & Capabilities > Associated Domains, and input the Universal Link you created on SolarEngine.
In your iOS project, select TARGETS > Info > URL Types, and click on the "+". Then input the URL Scheme you created on SolarEngine.
After you set up the Universal Link and URL Scheme in the SDK, your app can be opened successfully through them. You can use the method below in AppDelegate to listen for Deep Link invocation.
Deep Link URL Handling Method
- (void)appDeeplinkOpenURL:(NSURL *)url;
Here, the URL is returned from the iOS system.
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
[[SolarEngineSDK sharedInstance] appDeeplinkOpenURL:url];
return YES;
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
[[SolarEngineSDK sharedInstance] appDeeplinkOpenURL:userActivity.webpageURL];
return YES;
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
[[SolarEngineSDK sharedInstance] appDeeplinkOpenURL:url];
return YES;
}
Function
- (void)setDeepLinkCallback:(SEDeeplinkCallback)callback;
Parameters:
Parameter | Description | Data Type |
---|---|---|
sedpLink | redirection parameters | NSString |
turlId | 7-bit tracking URL | NSString |
from | link type | NSString |
customParams | custom parameters | NSDictionary |
Error Code Explanation:
error code | error reason |
---|---|
0 | Success |
1 | Illegal or blank URL |
2 | Fail to parse URL parameters |
Sample Code
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[SolarEngineSDK sharedInstance] setDeepLinkCallback:^(int code, SEDeeplinkInfo * _Nullable deeplinkInfo) {
if (code == 0) {
// Callback success
NSLog(@"from: %@, sedpLink: %@",deeplinkInfo.from,deeplinkInfo.sedpLink);
} else {
// Callback failed
NSLog(@"code: %d",code);
}
}];
SEConfig *config = [[SEConfig alloc] init];
[[SolarEngineSDK sharedInstance] preInitWithAppKey:@"your_appKey"];
[[SolarEngineSDK sharedInstance] startWithAppKey:@"your_appKey" config:config];
return YES;
}
Developers can use this function for user reactivation attribution and business analysis.
Note:
If you have called appDeeplinkOpenURL
plugin, then you don't have to call trackAppReEngagement:
function.
Function
- (void)trackAppReEngagement:( NSDictionary * _Nullable)customProperties;
Sample Code
NSDictionary *customProperties = @{@"test_key":@"xxx"};
[[SolarEngineSDK sharedInstance] trackAppReEngagement:customProperties];