Static Sites & Deployment

Web Analytics

Definition

Web analytics turns requests into visits, views, referrers and countries. There are two mechanisms, and the difference between them is not a detail. Client-side analytics loads a small JavaScript file on each page; it runs once the page renders and can report things only the browser knows, such as viewport size, scroll depth and which button was pressed. Server-side or edge analytics counts the request itself as the web server or edge node delivers it, before anything executes in the browser, so it sees every request for every file — HTML, images, PDFs, zip archives — but knows nothing about what happened after delivery. Google Analytics is the familiar client-side tool; log-based and edge products are the other kind. The same site measured both ways routinely differs by 10 to 40 percent.

Why It Matters

The gap matters most when what you published is a file rather than a page. A script can only run inside an HTML document, so a PDF behind a download link, a photograph or a zip fetched directly is invisible to it — a report pulled down 2,000 times from a page with 300 views is recorded by a browser script as 300 of something and nothing of the thing that mattered. Counting at the edge records all 2,300 requests, because every one of them passed through the same point. Client-side totals are also thinned by ad blockers and tracking protection, which suppress the common analytics scripts for somewhere between 10 and 30 percent of visitors, and considerably more for a technical readership. Knowing which method produced a number tells you what that number is missing.

How It Works

In the client-side model the browser parses the page, fetches the analytics script, and the script sends a small request carrying the address, the referrer and an identifier usually kept in a cookie or in local storage — that identifier is what lets it call two visits the same person. In the other model the node of the edge network that serves the file writes the request down as it goes: path, status, referrer header, the country resolved from the IP address, the user agent. No cookie is involved, so there is nothing to consent to under the ePrivacy rules and nothing follows anyone between sites; the trade is that telling two visitors apart becomes an estimate, usually from a hash that rotates daily. 99helpers counts at the edge without cookies, which is why a download of a hosted file registers exactly as a view of a hosted page does. Both models filter bots, which is a further reason two tools rarely agree on a total.

Real-World Example

A trade association publishes its annual salary survey as a 9 MB PDF on 99helpers at guildhall-survey.99helpers.site and links to it from a newsletter. The dashboard shows 1,840 downloads in the first week, 61 percent of them from the UK, with most referrals coming from the mail provider's link tracker. Had the same PDF sat beside a site measured only by a browser script, that week would have shown nothing at all, since no HTML page was ever loaded. The association used the country breakdown to justify commissioning a separate Irish edition the following year.

Common Mistakes

  • Comparing a client-side total with a server-side one and deciding one is broken — they count different events and will never agree
  • Expecting a browser script to record PDF or image downloads — no page loads, so no script runs and the file is simply absent from the report
  • Reading raw request counts as people — bots, prefetchers and link scanners all make requests, and one real visitor makes dozens
  • Adding a cookie-based tracker to a site that never needed one, then owing a consent banner that costs more visitors than the data is worth

Related Terms

Put a file online in seconds

Drop in a document, an image, a page or a whole static website and share the link — free, with no build step and no server to set up.

Host a file free →