How Tracking Works
Follow a visit from page load to report: tags, events, cookies and client IDs, plus why analytics never counts every visitor perfectly.
Welcome back!
Step 1 of 13Learn
What happens when someone visits your page
Imagine Jordan clicks a link to a bakery's website on her phone. In the second it takes the page to load, a lot happens behind the scenes.
- The browser downloads the page's HTML, which includes a small piece of JavaScript called a tag (for GA4, the Google tag, often installed through Google Tag Manager).
- The tag checks for a first-party cookie that identifies the browser. If there isn't one, it creates one with a random ID, the client ID. This is how the tool recognizes the same browser on a later visit.
- The tag sends a small packet of data, a hit or event, to the analytics servers: the page address, page title, referrer (the page Jordan came from), screen size, language, a timestamp and the client ID.
- As Jordan scrolls, clicks or watches a video, more events are sent.
- The analytics servers process these events, often with a delay of hours for full reports, and turn them into users, sessions, page views and other metrics.
Nothing in this process knows Jordan's name. Analytics counts browsers and devices, not people, unless the site deliberately sends its own user ID for logged-in users. That distinction explains many of the quirks you'll see in reports.
Step 2 of 13Practice · Put in order
Put these steps of a tracked page view in order.
Drag the items, or use the arrow buttons, to put them in order.
- The tag sends a page view event to the analytics servers
- The data appears in reports
- The tag reads or creates a first-party cookie with a client ID
- The browser loads the page, including the analytics tag
- The servers process events into users, sessions and views
Step 3 of 13Diagram
The life of one tracked page view
Tap a shape with to see more.
- Page loads
The browser downloads the HTML, which includes the analytics tag.
- Tag runs
A small JavaScript snippet (the Google tag) starts in the browser.
- Cookie and client ID
The tag reads or creates a first-party cookie with a random client ID.
- Event sent
Page address, referrer, screen size, timestamp and client ID go to the analytics servers.
- Servers process
Events are grouped into users, sessions and views, often hours later.
- Reports
What you finally see in the dashboard.
Step 4 of 13Learn
Why analytics never counts everyone
Beginners often assume analytics numbers are exact. They aren't, and knowing why helps you trust them the right amount.
Users are really browsers. If Jordan visits on her phone and later on her laptop, she usually counts as two users. If she clears cookies, she becomes a new user. If a family shares one tablet, they may count as one.
Consent choices. In many regions, sites must ask before setting analytics cookies. Visitors who decline may not be tracked, or are tracked in a limited, cookieless way, depending on how the site is set up.
Ad and tracking blockers. Some browsers and extensions block analytics tags entirely. Tech-savvy audiences often block more.
Pages that close too fast. If someone leaves before the tag loads, the visit isn't recorded.
Bots. Analytics tools filter known bots, but some automated traffic slips through and inflates numbers.
The practical lesson: treat analytics as an accurate trend, not a perfect count. It's very good at telling you that mobile conversion fell 30% after a change, or that email visitors buy more than social visitors. It's less reliable as an exact census. If your store system says 412 orders and analytics says 381, the store system is the source of truth for orders; analytics is the tool for understanding behavior.
Step 5 of 13Practice · Select all that apply
Which of these can make analytics undercount or miscount visitors? Select all that apply.
Select all that apply.
Step 6 of 13Practice · Diagram
Why the count is always lower than reality
In this example, which filter removes the most visits?
Tap the shape that answers the question, then press Check.
- Real visits
Everyone who actually loaded a page.
- Script allowed to run
Ad blockers, privacy browsers and disabled JavaScript stop some tags.
- Analytics consent given
Where consent is required, visitors who decline are not tracked with cookies.
- Fully counted visits
Those whose events reached the servers and were processed.
Step 7 of 13Note
Step 8 of 13Learn
Tags, tag managers and server logs
There are two main ways to collect website data.
Page tagging (client-side tracking) runs JavaScript in the visitor's browser, as described above. It can capture rich behavior: scrolling, clicks, video plays, form starts. It depends on the browser running the script, so blockers and consent affect it. GA4, most marketing tools and heatmap tools work this way.
Server log analysis reads the records your web server keeps of every file request. It sees almost every request, including bots and visitors who block scripts, but captures less about behavior inside the page and needs more cleaning.
Most businesses use page tagging and manage their tags through a tag manager such as Google Tag Manager (GTM). Instead of editing website code for every new tracking need, you add a single GTM container to the site, then configure tags (what to send), triggers (when to send it) and variables (extra information such as a button's text) in a web interface.
A growing option is server-side tagging, where the browser sends data to a server you control, which then forwards it to analytics and ad tools. It offers more control over what data is shared, at the cost of extra setup and hosting.
Step 9 of 13Compare
Page tagging vs server logs
| Aspect | Page tagging | Server logs |
|---|---|---|
| Where it runs | JavaScript in the visitor's browser | Records kept by your web server |
| Behavior inside the page | Rich: scrolls, clicks, video plays, form starts | Little: mostly which files were requested |
| Ad blockers and consent | Affected | Not affected |
| Bots | Mostly filtered out | Included, need cleaning |
| Typical tools | GA4, heatmaps, marketing tags | Log analyzers, server-side setups |
Step 10 of 13Practice · Match the pairs
Match each tracking concept to its description.
Tap an answer, then tap the place where it belongs (or drag it there).
- Tag
- Trigger
- Client ID
- Server log
Step 11 of 13Practice · True or false
If your online store's order system shows 500 orders last month and GA4 shows 470 purchases, GA4 is broken and its data should not be used.
Step 12 of 13Note
Step 13 of 13Practice · What would you do?
What would you do?
A marketing team notices that GA4 reports about 20% fewer users this year, while sales are steady. Their site added a cookie consent banner in March to comply with privacy rules. What is the most likely explanation?
Lesson complete!