Solved

Link Client/Server events into a single Session

  • 7 February 2022
  • 1 reply
  • 183 views

Badge

We have a web application and we are trying to link both client/server side events into sessions.

At the same time, we are using Segment as a data source for the Amplitude.

What we are trying to achieve is a similar to the default behavior: link all events happened within less than 30 minutes delay.

For this purpose, it is necessary to generate the session Id on the server, and pass it to the client for the further usage. And to track the last event time for the 30 minutes tracking.

One of solutions is to use cookies with the expiration time and track it both on server and client side.

 

  1. is there is a more straightforward solution for this quite standard procedure?
  2. are there best practices to synchronize events order on client/server side?
icon

Best answer by Yuanyuan Zhang 15 February 2022, 11:47

View original

1 reply

Userlevel 5
Badge +5

Hi @user73

This is Yuanyuan from the Amplitude Support team - thank you for writing this post!

When sending events via Segment, you have the options of using client mode or cloud mode. 

If you use client mode, which bundles the Segment SDKs with Amplitude SDKS, sesisons will be captured automatically. Please see detailed documentation here: https://developers.amplitude.com/docs/segment-amplitude-integration#pros--cons-of-client-side-bundled-integration

If you use cloud mode, you will need to set the session_id and send it to Amplitude in order to track user sessions: https://segment.com/docs/connections/destinations/catalog/amplitude/#sessionid

 

I hope it helps. Please do not hesitate to reach out if you have any other questions!

Reply