Try it on your own data
Every report in this article is in the free plan. One snippet for web and apps, up to 10 sites.
Start freeWeb analytics works in five stages: a script on the page builds a hit, the browser sends it to a collector, the collector adds time, location, device and a visitor ID, bots are set aside and hits are grouped into sessions, and the result is added up into reports. Each stage can drop or reshape data, which is why two tools rarely match.
What you will learn
- A report number passes through five stages, script, request, collector, bot filter and sessions, aggregation, and each one can lose or change it
- Identity method, bot handling and session rules explain most gaps between two analytics tools on the same site
- Test each stage directly and compare goal counts with your own database to know how much data your setup loses
What happens between a page load and a report number?
Web analytics works as a pipeline with five stages. Each stage changes the data, and each one is a place where a visit can be dropped or counted differently:
| Stage | What happens | Where data can be lost or changed |
|---|---|---|
| 1. Tag | A script on the page reads the URL, title, referrer and screen size | Blockers, consent settings, script errors, people who leave before it loads |
| 2. Request | The browser sends a small "hit" to a collection endpoint | Page closes before the hit leaves; network or content security policy blocks it |
| 3. Collector | The server adds time, location from the IP address, device from the user agent, and a visitor ID | Identity method decides who counts as the same visitor |
| 4. Bot filter and sessions | Automated traffic is set aside; hits from one visitor are cut into sessions | Different bot rules and session rules give different totals |
| 5. Aggregation | Sessions and hits are rolled up into pageviews, visitors, time on page and conversions | Definitions of each metric, time zones, deduplication |
The rest of this guide walks a single sample visit through those stages, hit by hit, so you can see where each number in a report comes from. That is also the practical answer to the most common question about analytics: why two tools installed on the same site never show the same numbers. Server log analysis, which skips stage 1 and reads the web server's own records, works differently and is mentioned where it matters. If you are planning an installation rather than trying to understand one, start with how to implement web analytics.
Stage 1: what does the analytics script do in the browser?
The tag is a few lines of HTML that load a JavaScript file. When the page loads, the script:
- Reads the page address (
location.href), the title (document.title) and the previous page (document.referrer). - Reads device context the browser exposes: screen size, language, time zone.
- Listens for later activity: route changes in single-page apps, clicks on outbound links, file downloads, form submits, and the page being hidden or closed.
- Builds a hit and sends it (stage 2).
The script can also be prevented from running at all. Check these before blaming the collector:
- Content blockers and privacy extensions that block the script's domain or its requests.
- Consent and privacy signals. Depending on the tool and your settings, a missing consent or a browser signal such as Global Privacy Control can stop collection or switch it to a reduced mode.
- Content security policy. If the page's
connect-srcdoes not allow the collection host, the request fails silently. - Early exits. Someone who leaves before a deferred script runs is never recorded.
None of these show up in the report as a "lost" row. They simply never become data, which is why script-based analytics always undercounts compared with server logs.
Stage 2: how does a hit reach the analytics server?
A hit is a small HTTP request carrying a few fields. Sample data for the first page of our example visit:
| Field | Example value | Set by |
|---|---|---|
| Event | pageview | Script |
| URL | https://example.com/blog/crash-rate?utm_source=newsletter | Browser |
| Referrer | https://www.google.com/ | Browser |
| Title | "Crash rate explained" | Page |
| Screen | 412 × 915 | Browser |
| Language and time zone | en-US, America/Chicago | Browser |
| Site key | the property or project ID in the tag | Tag |
Modern scripts send hits with navigator.sendBeacon, a browser API the W3C Beacon specification describes as asynchronous, non-blocking delivery of data. The specification says beacon requests are guaranteed to be initiated before the page is unloaded, and its example sends session data on visibilitychange, noting that this is the only event guaranteed to fire on mobile devices. That matters for anything measured at the end of a page view, such as time on page: if a script waits for an unload event, phones often never send it.
Two practical consequences:
- The last hit of a visit is the fragile one. If the browser is killed, the phone loses signal or the tab crashes, that final hit never leaves.
- A success response does not prove storage. Many collectors return the same status code whether they keep or discard a hit. To check delivery, look for the event in a realtime view, not at the network status.
Stage 3: what does the collector add?
The collection server receives the hit and adds what the browser did not send:
- Receive time. Reports use server time, so a visitor's clock does not matter.
- Location. The IP address of the request is looked up to a country, sometimes region or city. Privacy-focused tools then truncate or discard the IP address rather than store it.
- Device and browser. Parsed from the user agent string and client hints: browser, operating system, device type.
- Visitor identity. The collector decides whether this hit belongs to a visitor it has seen before. There are two common methods:
- A cookie or stored ID in the browser, which persists until it expires or is cleared.
- A hash of a server-side salt with request data such as the IP address and user agent. No cookie is written. If the salt rotates daily, the same browser is a new visitor every day.
The identity method is the biggest single reason visitor counts differ between tools. A cookie-based tool counts one person on a phone and a laptop as two visitors, and one person who clears cookies weekly as four a month. A daily-salt hash cannot recognise anyone across midnight, so its "returning visitors" over a week are lower. Neither is wrong; they count different things, and logged-in user IDs are the only way to join devices reliably.
Stage 4a: how are bots filtered out?
A large share of requests to websites are automated. Imperva's 2025 Bad Bot Report, published in April 2025, found that automated traffic made up 51% of all web traffic in 2024, the first time in a decade it surpassed human activity, with malicious bots at 37% of all internet traffic.
Most of that never reaches a script-based tool, because many crawlers do not execute JavaScript. The ones that do, such as headless browsers and some AI agents, have to be recognised by the collector. Common checks, usually combined:
- User agent lists. Known crawlers identify themselves (search engines, SEO tools, AI crawlers).
- Automation signals. A browser with
navigator.webdriverset, or a headless user agent, is flagged. - Network origin. Requests from data-centre address ranges are suspect.
- Behaviour. Dozens of pages per second, or no scrolling or input ever.
What happens next is a setting, and it changes your numbers: some tools delete bot hits, some keep them in a separate report, and some leave them in the totals. A traffic spike from one city on one day with a 100% bounce rate is the classic sign that bots are still in the denominator. Server logs show far more bots than a script does, because they see every request, including crawlers that never run JavaScript.
Stage 4b: how are hits grouped into sessions?
A session is a group of hits from one visitor with no long gap between them. Google's Analytics documentation states that a session times out after 30 minutes of user inactivity by default, and most tools use the same 30-minute idle rule, often with extra rules such as a maximum length or a split at midnight or when the campaign changes. The full definition is in our glossary entry on sessions.
Here is the complete sample visit after stages 1–4. One visitor, on a phone, arrives from Google:
| # | Time | What the browser sent | What the collector decided | Session |
|---|---|---|---|---|
| 1 | 21:40:00 | pageview /blog/crash-rate, referrer google.com | Country from IP, Chrome on Android, visitor V1, human | S1 starts, source: Google organic |
| 2 | 21:41:12 | pageview /blog/crash-rate from a headless browser | Automation signal: bot, kept out of human reports | none |
| 3 | 21:43:20 | time-on-page 200 s, then pageview /pricing | Route change inside the site | S1 |
| 4 | 21:44:50 | time-on-page 90 s (tab hidden) | /pricing viewed for 90 s | S1 |
| 5 | 22:31:00 | pageview /pricing (tab reopened) | 46 min since last hit, over 30 min idle | S2 starts, source: direct |
| 6 | 22:33:00 | time-on-page 120 s, then pageview /signup | Route change | S2 |
| 7 | 22:33:01 | pageview /signup again (double reload) | Same visitor, same page within 2 s: dropped | S2 |
| 8 | 22:36:30 | event signup_completed | Goal | S2 |
| 9 | never | time-on-page for /signup | Phone ran out of battery; the hit never left | none |
The browser attempted 11 hits (rows 3 and 6 each carried two). Ten arrived. One went to the bot report, one was dropped as a duplicate, and eight human hits remain: four pageviews, three time-on-page records and one goal event.
The session rule decides the session count. Under a 30-minute idle rule this visit is 2 sessions, and the second one is credited to "direct" even though the person first came from Google. Under a 60-minute idle rule the 46-minute gap does not split it, so it is 1 session credited to Google. Same hits, different sessions, different channel report.
Where the visit's 11 hits ended up
sample visitStage 5: how do hits become report rows?
Aggregation counts the cleaned, sessionised hits. From the sample visit, under the 30-minute rule:
| Metric | Value | How it was counted |
|---|---|---|
| Pageviews | 4 | Rows 1, 3, 5 and 6; the bot hit and the duplicate are excluded |
| Sessions | 2 | S1 and S2 |
| Visitors | 1 | One visitor ID, V1 |
| Pages per session | 2.0 | 4 pageviews ÷ 2 sessions |
| Bounced sessions | 0 | Each session has two pageviews |
| Goal conversions | 1 | signup_completed in S2 |
| Average time on page | 136.7 s | (200 + 90 + 120) ÷ 3 measured pages; /signup has no measurement |
| Bot requests | 1 | Shown only in a bot report |
Time on page shows how much the measurement method matters. Our sample script sends a time-on-page record when the page changes or is hidden, so three of four pages have a value and the average is 410 ÷ 3 = 136.7 seconds. A tool that only measures the gap between two pageviews would get 200 seconds for /blog/crash-rate and 120 seconds for the second /pricing, but nothing for the first /pricing (the session ended there) or /signup. Its average would be (200 + 120) ÷ 2 = 160 seconds. Same visit, a 23-second difference, with no tool doing anything wrong.
Reports are also usually built from pre-computed daily rollups, so the day boundary depends on the reporting time zone you set. A visit at 23:50 in New York is "tomorrow" in a report set to UTC.
Why do two analytics tools show different numbers?
Now map the pipeline to the differences you see when two tools run on one site. Check them in this order, because the first ones usually explain the largest gaps:
- The tag did not run in one tool. Different blocker lists, consent rules or a tag missing on some templates. Compare pageviews for one URL you know well.
- Bot handling. One tool keeps bots in totals, the other removes them. Compare a day with an obvious spike.
- Identity. Cookie versus cookieless hash, and how long an ID lives. This mostly moves visitors and returning visitors, not pageviews.
- Session rules. Idle timeout, midnight split and campaign split. This moves sessions, bounce rate and channel credit.
- Metric definitions. Time on page, engagement and bounce are defined differently in different tools, as the 136.7 s versus 160 s example shows.
- Reporting settings. Time zone, filters, URL normalisation such as dropping query strings, and data thresholds or sampling.
A rule of thumb: if pageviews agree within a few percent but visitors differ a lot, it is identity. If pageviews differ, it is the tag, consent or bots. If only sessions and bounce rate differ, it is the session rule.
| What differs | Main metric it moves | How to check |
|---|---|---|
| Tag blocked or missing | Pageviews and everything below | Compare pageviews for one known URL |
| Bots kept vs removed | Visitors, bounce rate | Compare a day with an obvious spike |
| Cookie vs cookieless identity | Visitors, returning visitors | Pageviews match but visitors differ |
| Session rules | Sessions, bounce rate, channel credit | Idle timeout, midnight and campaign splits |
| Metric definitions | Time on page, engagement | Read each tool's definition |
| Reporting settings | Daily totals | Time zone, filters, URL normalisation, sampling |
Check in this order; the first rows usually explain the largest gaps.
How can you check that your analytics is not losing data?
Each stage has a test you can run in under ten minutes:
| Stage | Test | What a pass looks like |
|---|---|---|
| Tag | Open the page with browser developer tools; check the console and that the script file loads | Script loads once, no errors |
| Request | In the network panel, filter for the collection host; navigate and switch tabs | One request per pageview, another when the tab is hidden |
| Collector | Visit from your phone and watch the realtime view | Your visit appears with the right page, country and device |
| Bots and sessions | Visit, wait 31 minutes, return | A second session appears in the session list |
| Aggregation | Compare a goal count with your own records for a full day, such as orders in your database | Within a few percent, with the gap explained by blockers and consent |
The last test is the one most teams skip. Your order database or signup table is the ground truth for conversions. If analytics shows 180 signups and the database shows 200, a 10% gap tells you how much stages 1 and 2 lose on your audience, which is a number to keep in mind every time you read a conversion rate.
How a visit becomes a report in TapCub
Here is the same sample visit in TapCub, stage by stage, with where to look at each step.
- Tag and request. The website script reads the page and sends each pageview to the collection endpoint with
navigator.sendBeacon, falling back tofetchwithkeepalive. On a route change, when the tab is hidden or when the page closes, it sends the time spent on the page if it was open for more than one second; there is no heartbeat. The script writes no cookie or local storage, and does not run when the browser sends Do Not Track or Global Privacy Control. Install and check it under Web analytics › Configuration › SDK code, and watch hits arrive in Web analytics › Realtime. - Collector and identity. The collector derives the visitor ID from a site salt hashed with address and browser data. The default balanced preset keeps a site-level salt so new and returning visitors can be compared; the strict preset rotates the salt daily. IP addresses are not stored on events. These choices live in Configuration › Privacy center.
- Bots. New projects default to detecting bots and reporting them separately: row 2 of the sample would appear under Web analytics › Bots, not in human visitors, sessions or pageviews. With only the page script, only bots that execute JavaScript are visible; crawlers that do not run scripts need server-side collection or a log import.
- Sessions and duplicates. The default session rule is 30 minutes idle and 24 hours maximum, adjustable per project; a tab that returns after more than 30 minutes in the background records a new pageview that starts a new session, as in row 5. The collector keeps one pageview when the same visitor repeats it within 2 seconds, as in row 7. Inspect real visits in Web analytics › Sessions.
- Reports. Pageviews, visitors and time on page roll up into Web analytics › Overview and Web analytics › Pages, and
signup_completedcounts as a conversion once it is set up under Web analytics › Goals. Compare that goal count with your own signup table, as in the data-loss test above.
For the beacon itself, see the glossary entry on beacons.
FAQ
How does web analytics work in simple terms?
A script on each page sends a small message to an analytics server whenever someone views a page or does something tracked. The server adds the time, an approximate location and the device, filters out bots, groups each visitor's hits into sessions, and adds everything up into reports such as pageviews, visitors and conversions.
How do analytics tools collect data without cookies?
Instead of storing an ID in the browser, the collector computes one from data in each request, typically a hash of the IP address and user agent with a secret salt. The browser stores nothing. The trade-off is that recognition only lasts as long as the salt and the request data stay the same, so returning-visitor counts are less precise.
Why does my analytics show fewer visitors than my server logs?
Server logs record every request, including bots that never run JavaScript, images, and visitors whose blockers stop the analytics script. Script-based analytics only counts browsers that load and run the tag, and usually removes the bots it can identify. A gap is normal; check how much of it is bots before treating it as lost data.
How does web analytics track a session?
It groups hits from one visitor into a session until there is a long enough gap. The common default is 30 minutes of inactivity; some tools also split at midnight or when the campaign changes. In the sample visit, a 46-minute gap made two sessions under a 30-minute rule and one session under a 60-minute rule.
Can web analytics see who I am?
Not by name unless the site tells it. The tool sees a visitor ID, an approximate location derived from the IP address, and device details. It knows who a person is only when the site sends a logged-in user ID or an email with a hit, which is a separate, deliberate setup.
Sources
- W3C Web Performance Working Group. Beacon, Candidate Recommendation Draft, 3 August 2022 — non-blocking delivery, beacons initiated before unload,
visibilitychangeas the event guaranteed to fire on mobile. Checked 2026-11-28. - Google Analytics Help. About Analytics sessions — session defined as a period of interaction, 30-minute inactivity timeout by default. Checked 2026-11-28.
- Imperva. 2025 Imperva Bad Bot Report: How AI is Supercharging the Bot Threat, 15 April 2025 — automated traffic 51% of web traffic in 2024; malicious bots 37%. Checked 2026-11-28.
Was this article helpful?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Data Analyst
Explores traffic sources, conversion funnels, and retention, using clear metric definitions and concrete examples to explain what the numbers mean.



