+31 (0) 35 646 63 00 info@spilgames.com

Deep Linking

Deep linking (also known as dynamic linking) is the process of redirecting users to an app via a link. If the app is not yet installed a deep link guides the user through the installation process and then starts the app. Once the app is started, data from the link can also be used to automatically direct users to a specific part of an app. This eliminates the need for users to manually download and install an app and search for the content developers want them to see. A DeepLink works just like a normal hyperlink and can be clicked in a browser or other app, it is the mobile equivalent of hyperlinks on websites. If a user opens a dynamic link in a desktop browser, they can be taken to the relevant content on your website instead of a mobile app.

Game developers can use deep linking to drive up user engagement and acquisition. It helps determine effective campaigns and properly measure attributions. In addition, deep linking can also simplify and amplify referral tracking and the onboarding process.

Important

The Spil SDK support deeplinking via Firebase and Adjust SDK’s, which are included with the SpilSDK. Deeplinking may also have to be implemented via the Facebook SDK, which should be done by developers themselves in Unity. See the “Facebook SDK” section for more details. Your Spil contact person should inform you if/when deeplinks should be implemented and via which platform(s).

For more information on Firebase deeplinking, see: https://firebase.google.com/docs/dynamic-links.

Prerequisites

The procedure to integrate deep linking into your game depends on whether you are developing for the Android or iOS platform.

Android
Do the following:

  1. Enable the two module using the “SpilSDK->Configuration->Android” window.
  2. Add the following to your androidmanifest inside the application node:

Base URL and URL scheme should be provided by Spil. A base url looks like this: “www.tappyplane.com”, a url scheme looks like this: “tappyplane”.

Important:
Ensure the host name is specified in your manifest file.

  • Obtain the required SHA-256 (and preferably the SHA-1) fingerprints from your Spil Games Account Manager. Confirm that the keys have been correctly configured in Google Firebase.

 

iOS

  1. Integrate the iOS SpilSDK and build to XCode from Unity.
  2. In XCode, enable the “Associated domains” capability in XCode and add the Firebase domain as provided by Spil. Associated domains use the following syntax “applinks:{FIREBASE_DOMAIN_NAME}.app.goo.gl” (old) or “applinks:{FIREBASE_DOMAIN_NAME}.page.link”, for instance: “applinks:pu68v.app.goo.gl” (old) or “applinks:tappyplane.page.link” (new). Add the Adjust domain as well (as provided by Spil, using the following syntax: “applinks:{ADJUST_DOMAIN_NAME}.adj.st”, for instance: “applinks:mbuj.adj.st”.
  3. To support iOS < 9 devices also add two URL Types in the XCode info tab, the URL scheme should be the bundle identifier of the app. For example, for “com.spilgames.tappyplane” we add two URL Types: “Id: tappyplane URLscheme: tappyplane” and “Id: com.spilgames.tappyplane URLscheme: com.spilgames.tappyplane”.

Implementing the Reward-Claiming Logic

Deep links can have rewards added to them via SLOT, this adds a reward token to the link. When the app receives a deep link the SpilSDK notifies the developer that a reward token is available for claiming, the developer can then proceed to claim it and show a message for the user. For setting up a DeepLink with rewards via SLOT see here. When a user clicks a deep link (such as a Facebook campaign or an advertisement) within the Spil Games framework, the reward-claiming mechanism is shown in Figure 6.


Figure 6: Reward-Claiming Mechanism.

If the app already exists, they are taken directly to it. Otherwise, they are directed to the appropriate store and, after installing it, the app is opened. In either case, the reward is then triggered. Within your game, use the following code to listen for the callbacks and claim the reward attached to the link.

Note:
This code can be used for all the Spil Games SDK features that use a reward-token mechanism.

Passing data to your app via deep link

The Spil SDK offers the “deepLinkReceived” event (Spil.Instance.OnDeepLinkReceived) to notify developers that a deep link has been clicked, it also passes any data from the deep link to the app. The deepLinkReceived event has a “payload” parameter which is a JSONObject containing any data that was added when creating the deep link. This could for instance be “{ “redirectLocation” : “shop” }”. A developer could read this data and respond by redirecting the user to the in-game shop.

Showing a splash screen when clicking a deep link

If a splash screen parameter was added when creating the DeepLink, for instance, “&splashscreen=splashScreen1”, then the SpilSDK will automatically request and show the splash screen (“splashScreen1” in this case). A splash screen campaign must be configured in SLOT with a trigger for requestSplashScreen and value “splashScreen1” in this case.

Setting up deep links via SLOT

Documentation for setting up deep links via SLOT is currently only available for Spil employees. If you need help setting up a new deep link, please contact your Spil representative.

Facebook SDK deep linking

Sometimes Spil will request a deep linking implementation that includes Facebook SDK deeplinks, which are not a part of the Spil SDK by default. In this case developers will have to integrate the Facebook SDK’s deeplinking features and pass any received deeplinks to the Spil SDK to be processed. This can be done as follows:

After initialising the Facebook SDK via FB.Init(OnFBInitComplete), in your OnFBInitComplete call you’ll have to call:

FB.GetAppLink(DeepLinkCallback);
FB.Mobile.FetchDeferredAppLinkData(DeepLinkCallback);

In your DeepLinkCallback handler, you’ll have to fetch the deeplink, parse its parameters and pass them to the revelant SpilSDK / game methods.