
Ask HN: Why do sites do tracking on the client side? - aabbcc1241
It is a common pattern to send user behavior data from the client (web&#x2F;app) to the 3rd party trackers. This attempt can be blocked by the client, e.g. by browser extension or DNS filtering (like pihole or nextdns).<p>Why don&#x27;t the websites track users from the server instead? Because it&#x27;s &quot;eaasier&quot; for the site owner to just drop-in the google analytic&#x2F;whatever 3rd tracker script in the head, then setting up the server to proxy the submission?<p>I may understand why the sites don&#x27;t do analytics on their own (because it&#x27;s easier to just hand to the 3rd party provider, and the site owner may not be programmer at all). However I don&#x27;t see why they prefer to do the tracking from the client side.
======
XCSme
Because tracking on the client-side gives you can give you a lot more info on
what the visitor is doing.

For example, if you have a landing page and only track on the server side, you
can not know the session length as you only know when the request to that page
happened, but not when the user left.

I am considering to also add a server-only tracking option for for my
analytics platform[0], but the data it provides will be limited by a lot. For
example now you can tag users based on the actions they do (click a button,
scroll on the page, encounter an error, etc.) and it's gonna be lot harder, if
not impossible to track those actions on the server-side, thus user
segmentation and other useful features are vastly restricted.

Also, as you mentioned, tracking server-side means that your server should be
able to run the analytics platform and it might be harder to integrate
analytics than simply including a JS on your pages. Imagine you have a static
website, hosted for free, in that case you don't even have the option to add
analytics on the server-side.

[0]: [https://usertrack.net/](https://usertrack.net/)

------
codingdave
The people in my company who do it want to track mouse movements to help the
UX team find areas of improvement.

Personally, I feel the negatives of client-side tracking outweigh the
benefits, in no small part because of the lack of focus on privacy that it
shows. So far I've fought off their desires to put it in my product. But it is
a battle - too many of the people who are not tech-savvy think client-side is
the best answer.

------
throwaway888abc
Agree with your thinking, few why points:

\- anti-fraud

\- sales conversion verification

\- bot filtering

\- ads and ads network policies

\- heatmaps and session recording

All above brings money/revenue to home.

