adjust-icon

Deep linking

You can create deep links to take users to specific pages in your app. The Adjust SDK uses different logic depending on if the user already has your app installed on their device:

  • Direct deep linking: occurs if the user already has your app installed. The link takes the user to the page specified in the link
  • Deferred deep linking: occurs if the user doesn’t have your app installed. The link takes the user to a storefront to install your app first. After the user installs the app, it opens to the page specified in the link.

The SDK can read deep link data after a user opens your app from a link.

Direct deep linking

Direct deep linking must be set up at the platform level. It isn’t possible to set it up in your Cocos2d-x C++ code. Follow the instructions for setting up deep linking for your target platform:

Deferred deep linking

Method signature
void AdjustConfig2dx::setDeferredDeeplinkCallback(bool(*deferredDeeplinkCallback)(std::string deeplink));

You can configure the Adjust SDK to call a callback function when it receives a deferred deep link. This callback function receives the deep link as a string argument.

#include "Adjust/Adjust2dx.h"
static bool deferredDeeplinkCallbackMethod(std::string deeplink) {
//...
}
// ...
bool AppDelegate::applicationDidFinishLaunching() {
std::string appToken = "{YourAppToken}";
std::string environment = AdjustEnvironmentSandbox2dx;
AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment);
adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose);
adjustConfig.setDeferredDeeplinkCallback(deferredDeeplinkCallbackMethod);
Adjust2dx::start(adjustConfig);
}

Example

This example shows how to log a deep link address when the user opens a deferred deep link.

#include "Adjust/Adjust2dx.h"
//...
static bool deferredDeeplinkCallbackMethod(std::string deeplink) {
CCLOG("\nDeferred deep link received!");
CCLOG("\nURL: %s", deeplink.c_str());
CCLOG("\n");
Adjust2dx::appWillOpenUrl(deeplink);
return true;
}
// ...
bool AppDelegate::applicationDidFinishLaunching() {
std::string appToken = "{YourAppToken}";
std::string environment = AdjustEnvironmentSandbox2dx;
AdjustConfig2dx adjustConfig = AdjustConfig2dx(appToken, environment);
adjustConfig.setLogLevel(AdjustLogLevel2dxVerbose);
adjustConfig.setDeferredDeeplinkCallback(deferredDeeplinkCallbackMethod);
Adjust2dx::start(adjustConfig);
// ...
}