Define your objectives
What type of web site are you planning to track?
Personal web site, blog, portfolio, online shop.
Objectives might vary - from number of visitors to how many customers are buying on your platform.
Once you know your objectives, define what are key metrics you want to track.
It can be page views, sign ups, purchases and many more.
Pick a tool that fulfil your needs.
It can be Google Analytics, Adobe Analytics, Piwik, Matomo or any other. Also do not underestimate free versions.
Implement the tool and configure it to process the data from the data layer.
It might require a support from developers, as some of the data might be only available on the backend.
Run tests to ensure your analytical tool collects all the data you need.
Validate the data afterwards.
Implement the consent and setup it properly.
Be legal complaint. Follow the guidelines based on the location you operate (e.g., GDPR, CCPA).