How is it calculated?
The browser sends it in the HTTP Referer header (the misspelling is part of the specification) and exposes it to scripts as document.referrer.
Browsers now default to the strict-origin-when-cross-origin policy, so a click from another site usually carries only the origin, such as https://news.ycombinator.com/, and not the full path. The referrer is empty for typed addresses, bookmarks, many native apps and links with rel="noreferrer".
Example
A reader clicks your link in a forum thread at https://forum.example.com/t/analytics/123. Your site receives the referrer https://forum.example.com/. You learn which site sent the visit, but not which thread.
Common mistakes
- Expecting the full referring URL. With the default browser policy you usually get the origin only.
- Treating an empty referrer as proof that someone typed the address. Apps and privacy settings strip it all the time.
- Relying on the referrer for campaigns. It tells you the site, never the campaign. Use UTM parameters for that.