Docs /
... / Proxy / HTTP Analytics
Esta página aún no está traducida a tu idioma, así que se muestra en inglés.

HTTP Analytics

ODAC measures the traffic of your domains at the proxy, the place every request already passes through. There is no script to add, no cookie and no change to your app. Analytics is part of ODAC Cloud: a server sends data only while it is linked to the Cloud and the Cloud has turned analytics on for it, and the dashboard is where you read it and switch it off per domain.

What is collected

The proxy looks at each request after it has been answered and keeps only coarse, sanitized values.

Pageviews. A request counts as a pageview when it is a GET that returned an HTML page (or a 304 for a page), or an in-site navigation of a supported framework, did not come from a bot and was not a prefetch (see What counts as a page view). For each pageview ODAC keeps:

Field What is kept
Path The URL path only, cleaned and capped at 512 bytes, with secret-looking segments replaced by :id (see below). The query string is dropped, except the campaign parameters utm_source, utm_medium, utm_campaign, utm_term, utm_content (and ref or source as the source)
Referrer The referring host only (for example news.ycombinator.com), never its path. Empty for links within your own site
Location Country, region and city, looked up on your server from a local GeoIP database
Language The primary language of the browser (en, tr, ...)
Device Device type, operating system and browser, with their major versions
Visitor A hash of the site, the visitor's address and user agent with a salt that changes every day (see below)
Visit A random number that groups the pageviews of one visit (30 minutes without a pageview, or midnight UTC, ends a visit)
Status and timing The response status and how long the request took

HTTP health. Per domain and per 1 or 5 minute window: request counts by status code and content type, bytes sent and a response time histogram, for the busiest paths of that window (the rest are summed into one * row).

404 report. The paths that answered 404, with the referring host, or self when the broken link is on your own site. Requests from bots are left out of this report.

Secrets in paths. URLs often carry tokens: webhook endpoints, password reset links, signed downloads. Before a path is kept for any of the reports above, each segment between two / that looks like a credential or an opaque id is replaced by :id, so /api/webhook/3f9a...c21e is stored as /api/webhook/:id. A segment is replaced when it is:

  • at least 16 hexadecimal digits, dashes allowed (hex tokens, UUIDs, long numeric ids);
  • at least 24 characters of letters, digits, - and _, mixing letters and digits, unless it reads as a slug: it needs a stretch of 16 or more characters without - or _ that mixes letters and digits, or at least four switches between letters and digits inside such stretches (API keys and random tokens);
  • a JSON Web Token: three parts separated by dots, the first starting with eyJ.

Readable paths such as /blog/2024-annual-report-final, /products/abc123 or /js/jquery.min.js are kept as they are. ODAC Cloud applies the same rule again when it receives the data.

Bots. How many requests known crawlers made, per domain and per 1 or 5 minute window. For each crawler request ODAC keeps:

Field What it holds
Crawler Its name and group (search engines, AI crawlers, SEO tools, social previews, monitors)
Path The path it requested, cleaned and masked like every other path; per crawler, its busiest paths of the window keep their own rows and the rest are summed into one * row
Status The response status code
Country The country of the crawler's address, from the same local GeoIP database; never a region or a city

This lets the dashboard show, for one crawler or one group, which pages it fetched, what it got back and where it came from. Bots get no visitor hash, never count as pageviews and are left out of the visitor reports.

Live requests. For the live map of the dashboard, ODAC keeps a small sample of recent requests: per domain, the newest 50 between two collections (every 10 seconds), and at most 2000 for the whole server. Page assets that loaded fine (scripts, stylesheets, images, fonts, media) are left out; every other request is sampled, and so is any request that failed, assets included. For each sample ODAC keeps:

Field What it holds
Time When the request ended
Path The path, cleaned and masked like every other path, without the query string
Status and type The response status code and the kind of content (HTML, JSON, script, ...)
Bot Whether the request came from a crawler
Location Country, region and city, as for a pageview. A crawler's sample has its country only

The location is looked up when the sample is collected, only for the samples kept; the address used for it stays in the proxy's memory until then and is never sent. A sample has no visitor hash, visit, user agent or referrer, and older samples replaced by newer ones are not reported as lost.

What counts as a page view

A page view is a GET that ends in a 2xx HTML page, or in a 304 for a page the browser asked for as a document. Bots never count, and neither does a prefetch the browser makes on its own (Sec-Purpose, Purpose or the older Firefox X-Moz header), which can fetch every link of a page. Where a library prefetches a page and the click then uses that response, ODAC counts the prefetch, since the click itself never reaches the server: a few hovers that are not clicked are counted rather than losing real visits.

Many sites change pages without a full page load. When the next page still arrives as HTML, it is counted like any other page. Some libraries mark their requests, and ODAC uses those marks:

Library Counted Not counted
ODAC framework (Odac.load) In-site navigations, which arrive as JSON Lazy parts and token refreshes. A navigation that changes the page layout is counted once, by the full page load that follows
Inertia Page visits, including prefetched ones: a click on a prefetched link uses that response, so the prefetch is counted in its place, and a prefetch that is never clicked (on hover, or on mount with prefetch="mount") is counted too Partial reloads (only, except), and reloads or polls of the page already shown. A visit is recognized as such by its Referer, so with a Referrer-Policy of no-referrer Inertia visits are not counted
htmx Boosted links and forms (hx-boost), back navigations restored from the server Requests that swap part of a page, and preloads of the htmx 2 preload extension (the click sends its own request, which is the one counted)
Hotwire Turbo Turbo Drive visits, including Turbo's prefetch on hover: a click on a prefetched link uses that response, so the prefetch is counted in its place. A link hovered for a moment but not clicked is counted too, and so is a link marked data-turbo-preload, which is fetched on page load and fetched again when clicked Turbo Frame requests
Next.js The first page load App Router navigations (RSC requests): a navigation, a prefetch and a router.refresh() look the same to the server, and a navigation to a prefetched page may send no request at all
Livewire (wire:navigate), Swup, Barba.js, Astro view transitions, Unpoly, pjax, Turbolinks Every page they fetch as HTML Nothing can be told apart: their prefetches and, for Unpoly, fragment updates and polls are counted too

Not counted at all: data requests of SvelteKit (__data.json), Remix (?_data=), React Router (.data) and the Next.js Pages Router (/_next/data/), because a navigation, a preload and a revalidation send the same request. Single page apps that change pages without asking the server anything are invisible to the proxy.

What is never collected

  • The visitor's IP address. It is used in memory for the location lookup (and, for a crawler, its country) and the visitor hash, then forgotten; a live request sample holds it in memory only until its location is looked up at the next collection. It is never written to disk and never leaves your server.
  • The full user agent, cookies, request or response headers and bodies, and any query parameter outside the campaign list above.
  • The daily salt. It is generated on your server, stored only there and replaced at midnight UTC; the old one is overwritten, not archived.

Privacy

Analytics is designed to run without a consent banner under the GDPR: no cookie or other identifier is stored in the visitor's browser, and nothing sent to ODAC Cloud identifies a person. Because the salt changes every day and never leaves your server, the visitor hash cannot be linked from one day to the next, by you or by ODAC. This is also why ODAC does not report new versus returning visitors.

ODAC Cloud processes this data on your behalf, so the location and visitor counts in your dashboard come with the terms you accepted for ODAC Cloud. Location data is provided by DB-IP (IP to City Lite, CC BY 4.0).

How data travels

The proxy keeps its counters in memory. Every 10 seconds the ODAC server collects them and writes them, compressed, to a spool on disk. While the server is connected to ODAC Cloud it sends the oldest spooled batches every minute (every 10 seconds while someone has the analytics page open), and deletes each batch once the Cloud confirms it. A batch that is not confirmed within 5 minutes is sent again; the Cloud recognizes a batch it already has and does not count it twice.

If the connection is down, batches wait in the spool. The spool is capped at 64 MiB and 48 hours; past either limit the oldest batches are dropped and how many rows were lost is counted in the next batch.

When ODAC updates itself, the outgoing server collects what the proxy still holds before it stops it, so an update does not lose the last seconds of traffic.

Files on your server

All paths are under ODAC's data directory: ~/.odac for the user running ODAC, which is /var/lib/odac/.odac on the host in the default Docker setup.

Path Content
proxy/analytics_salt The salt of the current day (private to ODAC's user)
analytics/spool/ Batches waiting for the Cloud, one compressed file each (private to ODAC's user)
geo/city.mmdb The GeoIP database. ODAC downloads each monthly release over HTTPS, checks its SHA-256, verifies the database and swaps it in with an atomic rename, keeping the previous file if anything fails
config/analytics.json The analytics settings the Cloud sent last

Turning it off

  • One domain: use the analytics toggle of that domain in the ODAC Cloud dashboard. The proxy stops collecting for it within seconds.
  • The whole server: set the environment variable ODAC_ANALYTICS=off for the ODAC container (for example under environment: in docker-compose.yml) and restart it. The proxy is told to collect nothing for any domain, and nothing is kept, spooled or sent, whatever the Cloud's settings.
  • A server that is not linked to ODAC Cloud collects nothing: analytics stays off until the Cloud sends its settings, and anything the proxy counted before that is discarded, never stored.