Client Side + Server side tracking best practice : duplication ?


My question is not about when to track from back-end or front-end, since it's not about choosing one or the other.

Let's say I want to track orders from back-end, since it's strategic data. What if I choose an integration without back-end compatibility. It's most likely to happen for pixels tracking integration. I will then not be able to track back-end events, including my orders.

Let's say one integration can only track e-commerce event on the front-end. It means that all my back-end tracking will not work.

The solution would be either to duplicate all events on back-end and front-end, but it could lead to a duplication of all events on integrations that can accept both front-end and back-end OR to create 2 different naming convention for both front-end and back-end, but it could lead to a compatibility issue with naming convention not following Segment's convention.

What is your recommendation ? Do you have any other recommendations ? I'm struggling with choosing the best practice.

For example, Facebook Pixels is only compatible on the front-end side, as well as some non existing integrations that we plugged via Tag Manager.

I read carefully this document : https://segment.com/academy/collecting-data/when-to-track-on-the-client-vs-server/ and made some researches as well but I can't find anything.

Thank you !

2replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Vincent Broucke thanks for writing in! That is a great question and it really depends on your needs and your specific use case. It should not be necessary to track all events both client and server-side.

    Tracking the same events client-side and server-side will imply that you have those events twice. Some of our customers track them twice, server-side in order to ensure no events are lost and client-side because there is more information captured automatically. 

    A good way to differentiate where they are coming from would be by sending them through a different source (one source for the client-side events and another one for the server-side) and not necessarily to the same destination account in order to prevent to see the duplicate events.

    We encourage our customers to always use the same event convention.

    Reply Upvote
  • Thank you for your answer !

    I came across something that I thought could be interesting in our case : https://segment.com/docs/guides/best-practices/should-i-instrument-data-collection-on-the-client-or-server/#selecting-destinations & https://segment.com/docs/sources/website/analytics.js/#selecting-destinations

    For EC spec. event, we can track them from both client AND server side, but then only filter client side event for client side only integrations, like Facebook Pixel. In that way, all server side friendly integrations will not suffer from duplicates, and can still receive all custom tracking/page view from client side since we can filter individually by track events.

    Is it a right approach ? It's exactly this kind of "fallback" option that I was looking for.

    Reply Upvote