Question
Should I use a client-side library or a server-side one when sending data into Segment?
Product
Twilio Segment
Environment
Segment Console
Answer
There is really no straightforward answer to this question, but these are the instances where we recommend collecting data on the client and on the server:
-
Client-side:
- Things that you wouldn’t usually store in your database;
- Things like UTM tags, operating system, device type, or cookied data like returning visitors;
- When sending data to destinations that can only accept data when the event is sent from the browser.
-
Server-side:
- When handling payment events;
- When accuracy is crucial;
- Things that need to be calculated from a database query;
- Sensitive information.
Additional Information
More details on client and server-side data collection below: