Quick answer
An HTTP header is a case-insensitive name–value field sent with an HTTP request or response to carry metadata. Request headers such as User-Agent, Referer, Accept-Language and Sec-GPC tell the server about the client and decide what analytics records about a visit.
What is an HTTP header?
An HTTP header is a name–value pair sent at the start of an HTTP request or response that carries metadata about the message: who is asking, what formats they accept, where they came from, how the response may be cached. MDN puts it simply: headers let the client and the server pass additional information with a request or a response. The current HTTP standard, RFC 9110, calls them fields, and the ones in the header section of a message are header fields.
Each header is a case-insensitive name, a colon and a value, for example Accept-Language: en-US,en;q=0.9. Request headers travel from the browser (or any client) to the server; response headers travel back. This page focuses on request headers, because a handful of them decide what web analytics records about a visit: browser and device, traffic source, language, privacy preferences and whether the visitor is a bot.
Anatomy of a request: an annotated example
A browser following a link from a search result to a pricing page might send:
GET /pricing?plan=pro HTTP/1.1
Host: shop.example
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml
Accept-Language: en-US,en;q=0.9
Referer: https://www.search.example/
Sec-CH-UA: "Chromium";v="131", "Google Chrome";v="131"
Sec-CH-UA-Mobile: ?0
Sec-CH-UA-Platform: "macOS"
Sec-GPC: 1
Cookie: session=…
Read line by line:
- Request line: method
GET, path/pricing?plan=pro, protocol version. - Host: which site on the server is meant; required in HTTP/1.1. In HTTP/2 and HTTP/3 its role is taken by the
:authoritypseudo-header. - User-Agent: the browser and platform, in a historically convoluted format. Chromium-based browsers now send a reduced string in which the minor version reads
0.0.0. - Accept / Accept-Language: preferred content types and languages, with
qweights from 0 to 1. - Referer (spelled with one "r" since the original specification): the page that linked here. It shows only the origin, not the path, because the default referrer policy trims it for cross-site requests.
- Sec-CH-UA headers: User-Agent Client Hints, structured browser data that replaces parsing the User-Agent string.
- Sec-GPC: 1: the Global Privacy Control signal, the user's request not to have their data sold or shared.
- Cookie: values the site stored earlier, often including identifiers.
Request headers vs response headers
| Request headers | Response headers | |
|---|---|---|
| Direction | Client → server | Server → client |
| Describe | The client and its preferences | The response and how to handle it |
| Examples | User-Agent, Referer, Accept-Language, Cookie, Authorization, Sec-GPC | Content-Type, Cache-Control, Set-Cookie, Location, Referrer-Policy, X-Robots-Tag |
| Who controls them | Browser (many cannot be set by page scripts) | Your server or CDN |
| Analytics relevance | Feed device, source, language, consent and bot fields | Shape what future requests send (Referrer-Policy, Set-Cookie) and how crawlers index (X-Robots-Tag) |
The two interact. A Referrer-Policy response header on your page decides how much of that page's URL the browser will put in the Referer request header of the next click. A Set-Cookie response header decides what the Cookie request header carries next time. Names prefixed with X- were the old convention for custom headers; RFC 6648 deprecated that convention in 2012, though many X- headers remain in use.
Which request headers analytics reads
| Request header | Analytics field it feeds | What changes it |
|---|---|---|
| User-Agent | Browser, OS, device type; bot detection | Reduced strings in Chromium; spoofing by bots; see User-Agent |
| Sec-CH-UA, Sec-CH-UA-Mobile, Sec-CH-UA-Platform | Browser brand, mobile flag, platform | Detailed hints only after the server asks with Accept-CH |
| Referer | Traffic source and channel | Referrer-Policy, HTTPS → HTTP downgrades, in-app browsers; see referrer |
| Accept-Language | Visitor language | Browser and OS settings |
| Sec-GPC (and the older DNT) | Opt-out of sale or sharing; tool-specific collection limits | User or browser privacy settings |
| X-Forwarded-For / Forwarded | Client IP behind a proxy or CDN, used for geography | Each proxy appends; the client can forge the first value |
| Cookie | Returning-visitor and session identifiers | Consent, browser cookie limits, user deletion |
Two of these are often misunderstood. The client IP address is not a header at all; the server sees it on the connection, and a proxy passes the original address on in X-Forwarded-For or the standard Forwarded header (RFC 7239). Only the entries added by proxies you control can be trusted. And the source of a visit is usually read by the analytics script from document.referrer rather than from the header, but the browser applies the same referrer policy to both.
Worked example: what Referer is sent under each policy
Sample case: a visitor on https://shop.example/pricing?plan=pro clicks a link.
| Destination | strict-origin-when-cross-origin (default) | no-referrer | unsafe-url |
|---|---|---|---|
https://shop.example/signup (same origin) | https://shop.example/pricing?plan=pro | none | full URL |
https://partner.example/ (other HTTPS site) | https://shop.example/ | none | full URL |
http://old.example/ (HTTPS → HTTP) | none | none | full URL |
So under the default policy, a site you link to learns only your origin, never the page or query string. MDN documents strict-origin-when-cross-origin as the default when no policy is set. In HTTP Archive's 2024 Web Almanac crawl, a Referrer-Policy was deployed on about 34% of desktop pages and 32% of mobile pages, and strict-origin-when-cross-origin was the most common explicit value, on 8% of pages. For analytics, the consequence is that referral reports show domains, not the exact referring article, unless the linking site chose a looser policy.
Client hints are adopted far more slowly: the same Almanac found Accept-CH on 15.8% of the top 1,000 mobile sites but only about 0.5% of all mobile sites, so most servers still see only the low-entropy hints sent by default.
HTTP headers vs URL parameters vs script data
| Data source | Example | Set by | Visible in server logs |
|---|---|---|---|
| Request header | Referer, User-Agent | Browser | Yes, if the log format includes it |
| URL parameter | utm_source=newsletter | Whoever wrote the link | Yes, in the request path |
| Script data | document.referrer, navigator.language, screen size | Page script reading browser APIs | No, only in the analytics hit |
A source can be decided by any of the three. UTM parameters in the URL override the referrer in most tools because the link author stated the source explicitly; the referrer header is the fallback when no parameters exist.
How to inspect HTTP headers
- Browser DevTools: open the Network tab, reload, select the document request and read Request Headers and Response Headers. Under HTTP/2 names appear in lowercase.
- curl for response headers:
curl -I https://shop.example/prints only the response headers;curl -vprints both directions. - Send a custom request header:
curl -H "Sec-GPC: 1" https://shop.example/tests how your server reacts to a privacy signal. - Check the referrer policy of a page in the response headers or in a
<meta name="referrer">tag before blaming analytics for missing referrers.
Common mistakes: trusting the first X-Forwarded-For value from the open internet; parsing exact browser versions from a reduced User-Agent; logging Cookie or Authorization headers in plain text; and treating header names as case-sensitive.
How TapCub uses request data
Here is what happens to the example request's headers when the page runs the TapCub script:
- Visitor recognition from address and User-Agent. The collector computes the visitor ID as an HMAC of the address and the user agent on the server; the script writes no cookie. Version numbers are dropped from the user agent and IPv6 uses only the first 64 bits, so a browser update or a rotating IPv6 address does not create a new visitor.
- The address is not stored. It is used for geography and the visitor hash, then discarded; by default two bytes are truncated before the city lookup. Settings are in Configuration › Privacy center.
- Source from the referrer. On the first load the script uses
document.referrer, so your Referrer-Policy and the linking site's policy apply exactly as in the table above; UTM parameters are checked before the referrer in Web analytics › Sources. - Privacy signals. Global Privacy Control (
Sec-GPC: 1) and Do Not Track are honored by default: the website script does not run when the browser reports either signal, and a hit that arrives with one is stored at tier 1, anonymous aggregate counting. - Bots counted separately. Brand and model come from the user agent; browsers with automation signals such as
navigator.webdriveror a headless user agent are classified as bots and shown on Web analytics › Bots, not in human reports. Exclusion rules can also match by user agent. Server-side events can passipanduser_agentin their context.
Sources
- IETF, RFC 9110: HTTP Semantics (fields, Referer, User-Agent, Accept-Language), June 2022.
- MDN Web Docs, HTTP headers and Referrer-Policy.
- HTTP Archive, Web Almanac 2024: Privacy (Referrer-Policy and Accept-CH adoption).
- IETF, RFC 8942: HTTP Client Hints, February 2021.
- Global Privacy Control, GPC specification (the
Sec-GPCrequest header).
Was this explanation clear?
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.

Technical Engineer
Focuses on tracking code, SDKs, and API integrations, with practical guidance on implementation checks and troubleshooting.