amplitude / Amplitude-Kotlin

Amplitude Kotlin SDK
MIT License
27 stars 10 forks source link

The session id value is not set #154

Open KChernenko opened 9 months ago

KChernenko commented 9 months ago

Summary

Hi, I'm trying to migrate to this brand-new SDK. However, the Session ID property is always -1 despite the following configuration:

Configuration(
   apiKey = "the-key-value"
   optOut = true, // Disable data collection due to GDPR (will be enabled after user consent)
   context = application,
   locationListening = false,
   defaultTracking = DefaultTrackingOptions(
       appLifecycles = false,
       sessions = true,
       deepLinks = false,
       screenViews = false
      )
)

UPD: The event stream has two groups of events: green and blue. The blue ones have a value for the Session ID set correctly, but the green ones have a -1 value. What am I doing wrong? Or maybe I am missing something? Screenshot 2023-10-23 at 22 38 56

qingzhuozhen commented 9 months ago

Hi @KChernenko, thanks for reporting the issue. Would you mind sharing the link to the event you posted?

KChernenko commented 9 months ago

@qingzhuozhen, can I do this via private DM?

qingzhuozhen commented 9 months ago

Hi @KChernenko, it is fine to share the link here since it is behind authentication so others won't be able to access it. Or you can submit via our support if your org is a paying customer.

KChernenko commented 9 months ago

@qingzhuozhen okay, no problem.

This is the link: https://app.amplitude.com/analytics/betterme/project/231475/search/amplitude_id%3D752794883738

qingzhuozhen commented 9 months ago

Hi @KChernenko, I found the issue. It is basically for during optOut, some logic from our lifecycle got skipped and then later optIn, the session value is not updated. This is an edge case and we are trying to figure out the best ways to solve it.

KChernenko commented 8 months ago

@qingzhuozhen Hi! Do you have any updates on the issue?

satyajitvure91 commented 1 month ago

Hello, I think this issue affects my application as well. My amplitude setup is similar to OP's with optOut set to true initially and set to false later after a successful login and some conditions are met.

Steps to Reproduce:

  1. a current session is in progress with optOut set to false
  2. App is backgrounded
  3. Tap push notification.
  4. Set a user property using amplitude.identify(identify.set(KEY, value))

Expected result: User property can now be seen on the following events.

Actual Result: User property is not attached to the events.

I can provide more information if needed.