Menu

Deep Linking

       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.

1. Login to SolarEngine

Universal Link Example:  test1.link.solar-engine.com

URL Scheme Example: test1://

2. Set up Universal Link

       In your iOS project, select TARGETS > Signing & Capabilities > Associated Domains, and input the Universal Link you created on SolarEngine.

3. Set up URL Scheme

       In your iOS project, select TARGETS > Info > URL Types, and click on the "+". Then input the URL Scheme you created on SolarEngine.

4. Listen for Deep Link Open

       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;
    
}

5. Set Deep Link Callback

Function

- (void)setDeepLinkCallback:(SEDeeplinkCallback)callback;

Parameters:

ParameterDescriptionData Type
sedpLinkredirection parametersNSString
turlId7-bit tracking URLNSString
fromlink typeNSString
customParamscustom parametersNSDictionary

Error Code Explanation:

error codeerror reason
0Success
1Illegal or blank URL
2Fail 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;
}
 

6. Report appDeeplinkOpen Event

       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];


Previous
iOS ATT Authorization
Next
Deferred Deep Linking
Last modified: 2024-12-03Powered by