Solved

How to link clientside and serverside events

  • 17 February 2023
  • 1 reply
  • 134 views

My scenario is simple:
 

  • Im sending events from the browser using the SDK (with GTM)
  • Im also sending events from the backend using webhooks 

 

How can I ensure that these events are linked to the same session/user?

Someone said use session_id - but that isnt unqiue so how would Amplitude know which user to associate the event with?

icon

Best answer by Saish Redkar 17 February 2023, 21:00

View original

1 reply

Userlevel 7
Badge +10

Hey @sebastianFromGrowthPod 

You need to ensure that your server side calls are sent with the user id or device id at least so that Amplitude can identify and tie these events to the proper user.

For the sessions, you will have to pass in the sessionId for your server-side calls if you want them to be included in a session. If there isn’t a session id, then these calls will appear as out of session events.
Mostly this is applicable to events sent via HTTP API and I’m not familiar of the webhook way.

You can read more on sessions here- https://help.amplitude.com/hc/en-us/articles/115002323627#h_e0307573-ebb5-4712-ad6b-0bb4c8cc6966

Here’s another post discussing sending session ID with server side events

Hope this helps.

Reply