Skip to main content

Hi, I have a segment library (2.0) added to my Vue JS app that is sending the data to Amplitude Actions destination.

A magical thing happens with the new Amplitude Action destination - It sets the Session Id automagically :)

Question 1: Once a user logs out in our web app, I’d like to force the session restart. I am not sure how to do it. I’d expect that analytics.reset() resets it, but it does nothing to the localStorage.analytics_session_id .

I also tried sending my custom properties object within the identify() call or the .page(), but this gets ignored:

integrations {

    Actions Amplitude {

    session_id: 1647499028386

   }

}

 

So the question is how could achieve clearing session id once the user logs out the app?

Question 2 if Segment is session agnostic and leaves that to us to implement (at least it used to be before the analytics 2.0) how is it that Segment debugger shows the integrations.Actions Amplitude.session_id then?

 

 

The weird thing is there is no mention of SESSION in the source settings and in the Segment destinations mapping for Amplitude Action the only thing I see is that by default the mapping the following:

 So, I’d expect to be able to do something like this to reset the session:

analytics.track(“Event name”, { integrations: ‘Actions Amplitude’: {session_id: WHATEVER}})

 

The only thing I can think of is that Amplitude Action destination somehow does it through the Segment JS SDK that’s loaded in the app and there is no way to override this? Is that right?
 

Also, I guessed wrong that if I changed the session duration in my Amplitude project to to 5min, for example, that Segment JS will somehow pick this up and will reset the SESSION ID after 5 min of being idle 😕 I just tried that and reloading my app after 5 min it still sends the same SESSION ID value.

Anyway, there must be some bundling going on or API calls between the 2 tools that I’m unaware of :)

 

Best regards

Luka

 

 

Hi Luigi,

 

I recommend reaching out to Segment for more details on these questions because this is an integretion they built on their end. I can give details that I know about but most of those topics will need to be referred to Segment.

 

To begin, in Segment Actions they user our HTTP v2 for cloud mode. Additionally,  Actions will not automatically capture user properties our SDKs collect like Platform since it is completely in cloud-mode.

 

Question 1: Once a user logs out in our web app, I’d like to force the session restart. So the question is how could achieve clearing session id once the user logs out the app?

Our HTTP API does not usually capture session_id. You have to set it each time an event happens or it will auto set to ‘-1’ which is the default value given for a event with not session_id value sent in. There is not a reset session function since we do not set it in general for our HTTP API the analytics.reset() you mentioned might be something Segment came up with so I would ask them the expected behavior of it. It looks like there is a Session Plug in that is what Segment uses to track sessions: https://segment.com/docs/connections/destinations/catalog/actions-amplitude/#session-plugin-1 I would ask Segment for more help on this!

Question 2 if Segment is session agnostic and leaves that to us to implement (at least it used to be before the analytics 2.0) how is it that Segment debugger shows the integrations.Actions Amplitude.session_id then? The only thing I can think of is that Amplitude Action destination somehow does it through the Segment JS SDK that’s loaded in the app and there is no way to override this? Is that right?
 

I recommend reaching out to Segment support for this. The only session that we will track is if you used the first version of Segment on Device mode since that uses our Javascript SDK and bundles our session tracking logic. For Segment V1 cloud mode and the new Amplitude Actions we do not do any session tracking so you will need to ask Segment for details on that!

 

Since this was built on their end I unfortunately do not have more than those details. I hope this helps you get started and puts you on the right track. If there is something I can help with on my end let me know!

 

Best,

Sydney

 

 


Hi Sydney! Thank you for your reply 🙂 It’s funny you say I should reach out to Segment because it was them who  told me to reach out to you. Hahahaha

 

That being said, I made my point pretty clear to the Segment team that it makes little sense to talk t Amplitude since the only SDK we’re loading is Segment’s so I doubt Amplitude can do much if it’s not even directly loaded and all events fly to Amplitude probably through API calls.

They also mention the Session plugin in their docs that seems to be setting the SESSION ID and sends it to Amplitude. Nevertheless, they tell almost nothing about how it works, can it be changed or modified : /

 

Thank you very much for your reply.

I’ll go back to them, then :)


Reply