4
votes

According to the W3C HTTPS sites shouldn't pass referrer to HTTP sites:

Clients SHOULD NOT include a Referer header field in a (non-secure) HTTP request if the referring page was transferred with a secure protocol.

Google is an HTTPS site, yet I still see Referrer Information in Google Analytics for all my HTTP sites. While Google hides the keywords in the q= parameter, I can still see the visitors as coming from Google.

According to spec Google Traffic should come in as direct to HTTP sites. What am I missing here?

2

2 Answers

2
votes

The links from Google Results page to your site are not simple links. If you look closely you'll notice that the link pass through javascript and a redirect before actually reaching your site.

Google does that for measuring the click through of organic results page on their end and also to pass a referral so marketers can attribute those visits back to Google Search.

Google does take privacy into consideration and doesn't pass along the actual query the user searched for. That's why you can't see the keyword in Google, instead it says (not provided).

Previously, when some Google searches were through HTTP Google used to pass the query along, that doesn't happen anymore as 100% of the searches are now through HTTPS.

So to answer your question: Yes, the spec require browsers to not pass referrals while on HTTPS and all browsers follow that, but Google uses some custom JS and redirects to pass a referral anyway.

UPDATE

In Google's case the redirect lives on www.google.com/url

Here's the code on that page for reference, the code has been modified for clarification:

<script>
window.googleJavaScriptRedirect=1
</script>
<META name="referrer" content="origin">
<script>
var m = {
  navigateTo:function(b,a,d){
    if(b!=a&&b.google){
      if(b.google.r{ 
        b.google.r=0;
        b.location.href=d;
        a.location.replace("about:blank");
      }
    } else {
      a.location.replace(d);
    }
  }
};
m.navigateTo(
  window.parent,
  window,
  "http://www.cutestpaw.com/articles/50-cute-puppies-make-your-girlfriend-smile/"
);
</script>
<noscript>
<META http-equiv="refresh" content="0;URL='http://www.cutestpaw.com/articles/50-cute-puppies-make-your-girlfriend-smile/'">
</noscript>

You can see that it includes a Meta name="referral" that is used to pass referral information. Origin is actually a HTTP parameter passed to the request of google.com/url.

2
votes

There are 2 kinds of META that can be used to pass the referer from HTTPS to HTTP. The HTTPS server of Google implements:

<meta name="referrer" content="origin">

Google

or

<meta name="referrer" content="origin-when-crossorigin">

YouTUBE