Skip to main content
Solved

How to get device-related data on the client and send it to the server

  • June 21, 2023
  • 1 reply
  • 1044 views

Hey guys,

 

I'm working on integrating Amplitude into my application, which is a platform built using ReactJS for the frontend and Node.js for the backend. I am currently using the "@amplitude/analytics-browser" library (~1.10.3) on the frontend and "@amplitude/analytics-node" library (^1.1.7) on the backend.

My current implementation is configured to make an API request from the frontend to the backend, sending information that will be useful to generate an event on the backend (sessionId, userId, deviceId, user properties and event properties). Then, the backend uses this information to log an event to Amplitude.

What I'm trying to achieve now is to include more user properties, specifically device related data such as device type, device family, platform, and operating system. I am aware that the Amplitude JavaScript SDK can automatically fetch this data from the user agent string on the client side, but I can't seem to find a way to access this data and send it to the backend.

I am wondering if there is a built in solution to get this device related data on the client and send it to the server. I understand the limitations of not having direct access to the User Agent string on the server side, but any ideas or recommendations on how I might get this information would be greatly appreciated.

 

Thank you in advance for your help.

Best answer by Saish Redkar

Hi @kelvin jose hernandez cabrera
Are you sending events from client side ( via browser SDK ) and capturing the available default Amplitude user properties values? 

From the above link you can see that Amplitude is able to capture some key device info like device type, os,etc ( but not browser info by default) using the client SDKs.

But if you are ONLY sending events server-side ( using node sdk ), then you must instead set those properties explicitly. 

If you are already setting the device related info using the default Amplitude properties via browser sdk, then these properties will be applied to all events from that user until their values are changed.

So even if you aren’t able to capture these explicitly and send via backend events, the previous values will be applied to all the events.

Let me know if I understood your use case here.

 

 

View original
Did this topic help you find an answer to your question?

1 reply

Saish Redkar
Expert
Forum|alt.badge.img+10
  • Expert
  • 1380 replies
  • Answer
  • June 21, 2023

Hi @kelvin jose hernandez cabrera
Are you sending events from client side ( via browser SDK ) and capturing the available default Amplitude user properties values? 

From the above link you can see that Amplitude is able to capture some key device info like device type, os,etc ( but not browser info by default) using the client SDKs.

But if you are ONLY sending events server-side ( using node sdk ), then you must instead set those properties explicitly. 

If you are already setting the device related info using the default Amplitude properties via browser sdk, then these properties will be applied to all events from that user until their values are changed.

So even if you aren’t able to capture these explicitly and send via backend events, the previous values will be applied to all the events.

Let me know if I understood your use case here.

 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings