segmentio / analytics-react-native

The hassle-free way to add analytics to your React-Native app.
https://segment.com/docs/sources/mobile/react-native/
MIT License
367 stars 191 forks source link

Inconsistent max session time between Analytics V2 and react native #997

Closed lennartschoch closed 1 month ago

lennartschoch commented 2 months ago

Hey there!

We're using Segment to integrate with Amplitude (through the Amplitude Actions destination) in both our web app (using Analytics V2) and React Native App. While working on a bug ticket, I took a look at your implementation of the Segment plugin that handles the session ID both on JS and on RN and I noticed that the implementations seem to differ quite a bit. Mainly, in Analytics V2, the sessions are limited to 30 minutes (and are kept longer as long as the user keeps sending events) while on RN, there is a hardcoded 5 min limit in the plugin:

const MAX_SESSION_TIME_IN_MS = 300000;

Just wanted to check in if this is intentional or if this is a bug?

Thanks!

alanjcharles commented 2 months ago

Hi @lennartschoch thank you for bringing this to our attention- I will take a look over the next sprint

alanjcharles commented 1 month ago

Hi @lennartschoch so, our analytics-react-native-plugin-amplitude is in line with our other mobile offerings, rather than the web sdk, as typically react native architecture is more similar to other mobile architectures than it is to web. Please refer to this Swift PR for more information https://github.com/segment-integrations/analytics-swift-amplitude/pull/21

With that in mind, is the hard-coded value not working for you as in its leading to lost data or inconsistent reporting downstream? I'm not against updating this to work as you would expect, I just need to make sure it's in line with existing implementations and/or expectations on the Amplitude side. Please just let me know and we can go from there. Thanks!

alanjcharles commented 1 month ago

if you need any additional support please reach out the friends@segment.com thanks!

lennartschoch commented 2 weeks ago

Thanks a lot for the reply @alanjcharles and sorry for my delay in getting back to you. I was mainly wondering if this discrepancy was intentional, your explanation makes perfect sense!