adjust / android_sdk

This is the Android SDK of
http://www.adjust.com
Other
593 stars 299 forks source link

CleverTap integration #591

Closed giacomuzzi closed 10 months ago

giacomuzzi commented 10 months ago

Hi, I am integrating Adjust with CleverTap to ensure that Clevertap receives the install events.

I have been reviewing the documentation provided on Clevertap's site (https://developer.clevertap.com/docs/adjust), but I need some additional clarification.

The documentation only suggests to add this code:

cleverTapInstance.getCleverTapID(new OnInitCleverTapIDListener() {
   @Override
   public void onInitCleverTapID(final String cleverTapID) {
       Adjust.addSessionPartnerParameter("clevertapId", cleverTapID);
   }   
});

It does not mention the adjustConfig.setDelayStart method, but I wonder if it is necessary to use this method to ensure that Adjust begins transmitting data only after the Adjust.addSessionPartnerParameter("clevertapId", cleverTapID) call is made.

uerceg commented 10 months ago

Hi @giacomuzzi,

Thank you for the detailed description you provided.

Having in mind that the way of obtaining the cleverTapID, you have two options how to make sure to see this ID ending up in partner params of the install session:

  1. Initialize Adjust SDK inside of the onInitCleverTapID after you make a call to the Adjust.addSessionPartnerParameter method. In this way, the timestamp of when the install is actually tracked on our end will be around the moment when CleverTap callback was triggered.
  2. Initialize SDK as our docs advise you to do, but if you're sure that CleverTap callback will be triggered within 10 seconds after Adjust SDK initialization, then you can follow that path: Initialize SDK as docs advise, set delay start to the value you think it's gonna be enough to get CleverTap ID and the code you wrote regarding adding partner parameter remains like that. In this case, install timestamp will be the moment when SDK is initialized (when your app was opened) and post delay, install session will be tracked (hopefully) with the CleverTap ID attached.

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

giacomuzzi commented 10 months ago

Hi @uerceg

Thank you so much for your help.

I like your first approach. I've moved the Adjust SDK initialization into the onInitCleverTapID. Just one thing to take into account, the first Activity.onResume is called before the initialization, so I had to add Adjust.onResume() at the end of onInitCleverTapID to ensure that Adjust starts sending data.

Now, I can see the CleverTap ID in the parameters when the /session and /sdk_click requests are made.

uerceg commented 10 months ago

Exactly. That was the thing which I was about to write in case you said that you'd be up for that scenario, but seems like you are already pretty well aware how the SDK works. 👌

I'll close this ticket for now, but in case you end up having any follow up questions down the road, feel free to comment / reopen.

Cheers.