Depending on your project/app you don't necessarily want to use Google Analytics in your website for various reasons, and you might consider an open-source service/software

There is a list of open source and free web analytics software that I recommend to see :

Kibana - The powerful

Kibana is my favorite, it's a solution that uses server logs to show data, it's extremely powerful and you can get very precise data about activity in your website and your server It can even use Machine Learning, also you can personalize the dashboard as you like

Matomo - The revolutionary

Matomo is web analytics much like Google Analytics, that you can install on your server and manage it yourself or you can use the managed paid version

Mataomo includes features like Heatmaps, Sessions Recordings, A/B Testing, Funnels, Goals, Form Analytics

Open web analytics - The Classic

It's literally Google Analytics but in open-source they even have the same design, you have the features that you can find in Google analytics, plus Heatmaps, Privacy controls and more...

Aws Stats - Good old log analyzer

The good old log analyzer, it's a software you can install on your server it shows data depending on your web server logs ( NGINX logs, apache logs)

Fathom - the simple one

Fathom is a simple-yet-powerful analytics software it's built on Go and React and provide the most important data you need, It's available in GitHub ( MIT License )

Ackee - the beautiful one

Ackee Analytics is self-hosting software solution you need to install on your server to work, it tracks data for you without using cookies, so you get anonymized data which is good for your users' privacy ( and no GDPR to worry about lol )