Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deferred deep linking with Flutter SDK #152

Open
nambv opened this issue Dec 14, 2024 · 7 comments
Open

Deferred deep linking with Flutter SDK #152

nambv opened this issue Dec 14, 2024 · 7 comments

Comments

@nambv
Copy link

nambv commented Dec 14, 2024

Hi @uerceg ,
I am intergrating Adjust SDK into our Flutter app with latest version 5.0.3.

I want to handle deferred deep link callback in our Flutter app. So when using Flutter adjust_sdk , do I need to add implementation code in native ( Kotlin & Swift ) or the SDK handle it already?

The official documentation: https://dev.adjust.com/en/sdk/flutter/features/deep-links

I saw we have the example code:

import 'package:adjust_sdk/adjust.dart';
import 'package:adjust_sdk/adjust_config.dart';

initPlatformState() async {
   AdjustConfig config =
      new AdjustConfig('2fm9gkqubvpc', AdjustEnvironment.sandbox);
   config.logLevel = AdjustLogLevel.verbose;

   config.deferredDeeplinkCallback = (String? uri) {
      print('[Adjust]: Received deferred deeplink: ' + uri!);
   };

   Adjust.initSdk(config);
}

Beside, the deep linking to open the app from the branded domain is working normally.

@uerceg
Copy link
Contributor

uerceg commented Dec 14, 2024

Hey @nambv,

When it comes to the deferred deep linking, you don't really need to do anything natively. The entire deferred deep linking mechanism is a matter of communication between the Adjust SDK and our backend and if the deferred deep link was part of the attribution, the SDK will get this information from the backend and ping your callback with its content.

However, when it comes to opening your already installed app with deep links, the Adjust SDK is not providing any out of the box support for that. This is something you should set up in your app on your own. You can do that by intercepting deep links on native level (and then invoking processDeeplink method natively), but it seems that there are plugins like this in Flutter which sound like they should help you with that so that you obtain deep link that has opened your app directly in Dart. And then you can pass that link to processDeeplink method in Dart (makes no difference whether you do it from Dart or natively).

In case you have any further questions, feel free to ping.

@arthurgiani
Copy link

@uerceg

my setup is the same as @nambv described, but the callback is not being triggered for me. I'm doing the following steps

  • Uninstalled the app
  • Clicked on one of our deep links
  • The redirection to play store was made, but then I closed the store and built the app on my code editor so I can see the logs
  • At the app init, I’m triggering the following Adjust setup to enable verbosity and adding print statements to see if the callbacks are being called.
  • attributionCallback is being called, but deferredDeeplinkCallback doesn't.

@uerceg
Copy link
Contributor

uerceg commented Dec 23, 2024

Hey @arthurgiani,

A few things that come up to my mind to be checked:

  1. Adjust URL should be valid and have deep link properly added. I somehow assume that this is the case, but just for the record.
  2. Between your step of uninstalling the app and clicking the link, are you forgetting device from testing console?
  3. If you are not attaching your device ID (idfa or gps_adid) to the URL, are you having probabilistic attribution enabled for the clicks for your link token?

@arthurgiani
Copy link

Hey @arthurgiani,

A few things that come up to my mind to be checked:

  1. Adjust URL should be valid and have deep link properly added. I somehow assume that this is the case, but just for the record.
  2. Between your step of uninstalling the app and clicking the link, are you forgetting device from testing console?
  3. If you are not attaching your device ID (idfa or gps_adid) to the URL, are you having probabilistic attribution enabled for the clicks for your link token?
  1. The link is valid, but what do you mean by 'and have deep link properly added'?
  2. Yes
  3. I'm not attaching gps_adid on the URL. Why this is necessary? And how can I check if I'm having probabilistic attribution enabled for the clicks for my link token?

Also, if you can send documentation for this it'd be great. I didn't find enough information.

Thanks!

@uerceg
Copy link
Contributor

uerceg commented Dec 23, 2024

Regarding questions from 3: It's not a must to do that, but in case you do attach it, then the attribution of your install to the click on that link will be done based on device ID and having the probabilistic attribution enabled for the link token wouldn't matter. In theory, regardless of the approach you take, as long as you are observing that your install is being attributed to the attribution data from your link, things should be just fine (I would need to consult our support team to share some docs on this topic).

Is there a chance for you to run this test and share verbose logs from your test run? Feel free to omit anything you consider to be sensitive data from the logs.

@arthurgiani
Copy link

arthurgiani commented Dec 23, 2024

Regarding questions from 3: It's not a must to do that, but in case you do attach it, then the attribution of your install to the click on that link will be done based on device ID and having the probabilistic attribution enabled for the link token wouldn't matter. In theory, regardless of the approach you take, as long as you are observing that your install is being attributed to the attribution data from your link, things should be just fine (I would need to consult our support team to share some docs on this topic).

Is there a chance for you to run this test and share verbose logs from your test run? Feel free to omit anything you consider to be sensitive data from the logs.

I enabled the probabilistic attribution and now the callback worked

image

But the SDK is saying that it can't open the deep link

@uerceg
Copy link
Contributor

uerceg commented Dec 23, 2024

🥳 Good news!

Not being able to open deep link might be fine, it depends on what are you trying to achieve. You omitted the content of it, but if we assume that it's some scheme based link (something like scheme://some/content), native Adjust Android SDK under the hood will try to launch an activity for that intent, if there's any to be opened. If you have configured intent filter with this scheme for some particular activity in your Android manifest file, then that activity should be launched. However, not sure if this is something you are actually trying to achieve? Not impossible to be attempted, but not exactly sure how interesting running all these extra native miles might be for Flutter devs.

In case you are trying to see some specific Android activity launched and that's not happening, lemme know and we can try to see what's happening under the hood. But if you're just interested in getting deferred deep link triggered with the content of the deep link based on which you wanna do some in app actions in Dart, then it's safe to ignore that log message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants