Not able to capture correct referrer using javascript document.referrer

We are trying to capture referrer using javascript code document.referrer. But in some cases we are getting wrong output.

In my case open and then search for “zalando” and then click on a Paid Search Ad. When I landed on the page it should have actually showed “” as the referrer but instead it is showing us “”. Please find attached screenshot for reference.

Hope this is something related to website. But I am a bit curious to know the following things:

  1. Why document.referrer is not working in my case?
  2. What are the techniques that website owners are following to change the referrer?
  3. Is there a way to get correct referrer using javascript in above case?

Help would be appreciated 🙂

enter image description here


The problem with Google is, that it is SSL secured (HTTPS).

The referer get’s removed by changing from a secured host to a non-secured host.

Google changed their encryption to default SSL for almost all users (excluding countries where encryption is not allowed like some in Asia, …). This problem also occures in many web statistics and Google searches, google for “encrypted_search_terms in WordPress” – many ppl encounter the problem not beeing able to access the referer – simply because it is removed during HTTP requests.

If a website is accessed from a HTTP Secure (HTTPS) connection and a
link points to anywhere except another secure location, then the
referer field is not sent.

The upcoming standard HTML5 will support the attribute/value rel =
“noreferrer” in order to instruct the user agent not to send a



Request URL:


Actually the referer gets sent and there is no secured connection.

The problem now is, that from the google search to the shop site you have a chain of different pages and requests. You are capturing the referer at the wrong place.

Google Search -> Google Ad Redirect 1 -> Google Ad Redirect 2 … -> Zalando landing page -> zalando website

The referer must be captured on the first request after leaving the google sites. Actually, you capture the referer at the end of that chain.

This is your landing page:

That’s the point where you have to capture the referer (probably with your server side language, not with Javascript).