Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can inspect the incoming HTTP Referer header to see where a request came from, but it may contain only Google’s origin—or be missing entirely. It also is not a reliable way to recover the visitor’s exact Google search or query. For aggregate search queries and clicks, use Google Search Console’s Performance report.

What a referrer URL means

A referrer is the webpage that sends visitors to your site through a link. In a browser request, that information is carried in the HTTP header spelled Referer—with one “r” after “refe.” The spelling is a historical misspelling in the HTTP standard; “referrer” remains the normal term in documentation.

When present, the header can include the referring URL’s origin, path, and query string. It does not include URL fragments or embedded username and password credentials. The amount of detail depends on the referring page’s referrer policy and the navigation context.

How to read the Referer header

Your web server or application can inspect the header on each incoming request. For example, in server-side pseudocode:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
referrer = request.headers.get("Referer")

Log or display the value only after treating it as optional input. A request may have no header, and the value should not be trusted as proof of a user’s identity or intent.

Possible values

  • https://www.google.com/ — an origin-only value.
  • https://www.google.com/search?q=example — a fuller URL, when the browser and policy permit it.
  • No value — the browser, policy, privacy feature, or navigation type withheld the referrer.

Why Google may not reveal the exact search query

Do not build a report that assumes every Google click carries a complete results-page URL. Google documented that, for supported browsers, some organic-search clicks could send a simplified, origin-only referrer. Referrer policy can also reduce the URL detail sent between documents.

Consequently, a destination may see https://www.google.com, a country-specific Google origin, a partial URL, or nothing at all. Even when a query string appears, it is not a guaranteed or complete record of the search that led to the visit.

Use Search Console for queries and clicks

If your question is “Which Google searches brought visitors to my site?” use Google Search Console’s Performance report rather than parsing request headers. Google’s guidance for Google Images specifically directs site owners there for query and click measurement. That report provides aggregate search data, not a guaranteed query attached to each individual request.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the right measurement layer

Need Best source What you can expect
Understand one incoming request’s previous page HTTP Referer header A URL, origin, or no value, depending on browser and referrer policy.
Find searches and clicks driving traffic overall Google Search Console Performance report Aggregate query and click reporting, as documented by Google.
Identify Google Images referral domains Search Console and request data together Google documents https://www.google.com or the applicable country-code Google domain for that traffic; do not generalize this detail to every Google Search surface.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Google Search versus Google Images

Google’s July 17, 2018 Google Images guidance says the referrer URL is part of the HTTP header and identifies the last page a user visited before clicking to the destination. It also describes Google Images traffic using Google’s main domain or the relevant country-code domain and points site owners to Search Console for queries and clicks.

That statement is specific to the documented Google Images behavior. Google’s March 19, 2012 announcement about simplifying organic-search referrers is historical documentation, not a promise that every current browser and Google Search surface sends the same value.

Best Value
Search+ For Google
  • google search
  • google map
  • google plus
  • youtube music
  • youtube

Practical implementation checklist

  1. Read the request’s Referer header when it exists.
  2. Handle an empty or absent value without treating it as an error.
  3. Store only the detail you need, and protect logs because URLs can contain sensitive paths or parameters.
  4. Use the value for coarse referral context, not guaranteed query attribution.
  5. Open Search Console and use Performance when you need Google search queries, clicks, impressions, or aggregate traffic analysis.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.