Typically trackers are implemented client side because it’s more convenient. It’s closer to the user, it can collect more data, and there is only one programming language it needs to support, Javascript.
But the disadvantage is that it can be blocked by the users. Data collection and user tracking can also be done on the server side. There are many analytics packages that support it, including Google Analytics. This is much easier to hide from the users. Here is an article I found on the topic.
It’s not hacking because the website developers integrate it willingly.