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. Android Deep Linking

Configure Scheme

?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
  <application>
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:theme="@style/UnityThemeSelector" >
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <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="place_your_scheme_here" />
      </intent-filter>
    </activity>
  </application>
</manifest>

3. IOS Deep linking

       Please refer to the "Universal Link" and "URL Scheme" configuration part in https://help.solar-engine.com/en/docs/Deep-Linking-NAvH.

4. Reattribution through Deep Linking

       To re-attribute users, please call the appDeeplinkOpenURL method when the app receives deep link content. The SDK will search for new attribution information in the deep link. If found, it will forward it to the server for re-attribution.

function appDeeplinkOpenURL(){
  let urlString:string = "https://your_deeplink_url_dummy";
  SolarEngine.appDeeplinkOpenURL(urlString);
}

Call Timing

import React, { Component } from 'react';
import { Linking, Platform, Text, View } from 'react-native';
class App extends Component {
  componentDidMount() {
    // Check whether the app was opened via the initial URL
    Linking.getInitialURL().then((url) => {
      if (url) {
        console.log('Initial URL:', url);
        // Here the initial URL can be handled, such as parsing parameters
        SolarEngine.appDeeplinkOpenURL(url);
      }
    });
    // Listen for URL change events
    Linking.addEventListener('url', (event) => {
      console.log('Received URL:', event.url);
      // Process URL received
      SolarEngine.appDeeplinkOpenURL(url);
    });
  }
  render() {
    return (
      <View>
        <Text>React Native Linking Example</Text>
      </View>
    );
  }
}
export default App;

5. Receive Deep Link Callbacks

       The callback will occur after the SDK has parsed the deep link URL. You can use the callback parameters to handle some business logic.

       Note: Please set the callback method before initializing the SDK, otherwise, you will not receive the callback result.

Sample Code

function buildDeeplinkResponse():deeplink{
  const handleDeepLink: deeplink = (code:number,deepLinkInfo?: DeepLinkInfo) => {
    if(code === 0){
      if(deepLinkInfo){
        console.log("deepLinkInfo.sedpLink: " + deepLinkInfo.sedpLink);
      }
    }else{
      console.log("code: " + code);
    }
  };
  return handleDeepLink;
}

async function Initiate(){
  let appKey = "";
  if (Platform.OS === 'ios') {
     appKey = "your_iOS_appKey";
  } else if (Platform.OS === 'android') {
     appKey = "your_Android_appKey";
  }    

  let deeplink:deeplink = buildDeeplinkResponse();

  let initiateOptions:SolarEngineInitiateOptions = {
  ...
    deeplink:deeplink,
  ...
  }
  SolarEngine.initialize(appKey,initiateOptions,(result:InitiateCompletionInfo) => {
    if (result.success) {
      Alert.alert('SolarEngine SDK Initiate Complete!')
    }
  });

}

6. Report Re-engagement Event

       If the appDeeplinkOpenURL interface is called, there is no need to call the trackAppReEngagement: method.

Function

export function trackAppReEngagement(customProperties:Object);

Sample Code

  let customProperties:Object = {  ...  };
  SolarEngine.trackAppReEngagement(customProperties);

Deferred Deep Linking

       After you enable deferred deep linking, the SE SDK will request the related parameters during initialization.

If callback success (code: 0), the parameters will be:

- sedpLink: The parameter for redirection.

- turlId: A 7-digit short link.

- sedpUrlscheme: The URL scheme filled in when creating the deep link.

If callback failed, errorCode will be:

- 1101: Error in SDK;

- 1102: Failed to establish a connection with the server;

- 1103: Timeout in establishing a connection with the server;

- 1104: Server-side error;

- 1105: Server returns data to the SDK;

- 1106: Deep link matching failed, server callback is empty.

Note:

       There is no need to report a re-engagement event when deferred deep linking is called.

Sample Code

function buildDelayDeeplinkResponse():delayDeeplink{
  const handleDelayDeeplink: delayDeeplink = (code:number,delaydeeplink?:DelayDeepLinkInfo) => {
    if(code === 0){
      if(delaydeeplink){
        console.log("delaydeeplink.sedpLink: " + delaydeeplink.sedpLink);
      }
    }else{
      console.log("code: " + code);
    }  
  }
  return handleDelayDeeplink;
}

async function Initiate(){

let delayDeeplink:delayDeeplink = buildDelayDeeplinkResponse();

let initiateOptions:SolarEngineInitiateOptions = {
...
  delayDeeplink:delayDeeplink
...
}
SolarEngine.initialize(appKey,initiateOptions,(result:InitiateCompletionInfo) => {

});


Previous
Set SKAdNetwork and Conversion Values
Next
Deferred Deep Linking
Last modified: 2024-12-05Powered by