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

I can't access to "Ad-ID" in the first session #274

Open
Mustafax06 opened this issue Aug 14, 2023 · 2 comments
Open

I can't access to "Ad-ID" in the first session #274

Mustafax06 opened this issue Aug 14, 2023 · 2 comments

Comments

@Mustafax06
Copy link

Mustafax06 commented Aug 14, 2023

I need Ad-ID within 1 minute of the first session. But I could never get the ID in the first session, in the second session, it retrieves immediately. Can I get it in the first second? Here's my code (I'm initializing the SDK automatically, not manually);

private IEnumerator CheckAndSetAdID() { while (string.IsNullOrEmpty(Adjust.getAdid())) { yield return new WaitForSeconds(0.5f); } _purchases.SetAdjustID(Adjust.getAdid()); Debug.Log("Adjust ID has been set: " + Adjust.getAdid()); }

I need this ID because most of our users make their first purchases within the first minute of the first session. And RevenueCat receives the purchase and logs it to Adjust. So I need the Ad-ID ASAP in the first session but I could never get it.

Edit: sorry for the badly formatted code, I couldn't arrange it, sorry

@uerceg
Copy link
Contributor

uerceg commented Aug 23, 2023

Hi @Mustafax06,

adid is a backend-side generated identifier which Adjust SDK gets only after it communicates for the first time ever with our backend and then gets this back in the answer we receive from the backend. When Adjust SDK is launched in the app for the first time ever, it sends a package we call a session to the backend. After backend responds to it, this is the first moment in which SDK gets the adid value, caches it locally and as of that moment on, provides it back if Adjust.getAdid() getter is called. We still do have a (nowadays) misfortunate implementation of this getter which is synchronous and will provide you with null back until SDK obtains the adid value, but this will change with the upcoming major SDK v5 release.

If one would want to capture the moment in which SDK is getting in possession of adid for the first time ever without the need to loop the "poll the getter -> get null -> retry" sequence, way to do that would be to implement session tracking callbacks. These callbacks would get pinged when session sending attempt succeeds / fails and if you'd check AdjustSessionSuccess and AdjustSessionFailure instances, they should contain the field which contains the adid value.

So I'd advise you maybe to give these callbacks a shot and double check if that works for your use case. Feel free to ping in case you have any further questions.

@Nawfel-bel
Copy link

Nawfel-bel commented Jan 15, 2024

Hello there @uerceg,
Can you please make sure that the SessionSuccessCallback and the SessionFailureCallback are working? because they dont seem to be invoked at all despite setting the delegates, just a simple log statement isnt even excecuted. which makes it difficult to understand when the adId is being cached

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