Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

So I put this basic code on my website, and alert with document.referrer:

alert(document.referrer);

And when I do a search the link is:

https://www.google.com/webhp?sourceid=chrome-instant&rlz=1C1ASUM_enUS494US494&ion=1&ie=UTF-8#hl=en&sugexp=les%3B&gs_rn=1&gs_ri=serp&tok=1r7LlSJjT_AkzPDie7y_qw&pq=document.referrer%20test&cp=6&gs_id=n&xhr=t&q=websiteurlblahblahblah&pf=p&safe=off&tbo=d&rlz=1C1ASUM_enUS494US494&sclient=psy-ab&oq=jacked&gs_l=&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.&fp=b120f3e780b613e5&bpcl=40096503&biw=1680&bih=925&ion=1

But when I click on my website the alert that pops up is:

https://www.google.com

I am trying to make a script that reacts based on different search terms that people use to enter my website, but this is stopping me dead in my tracks.

share|improve this question

migrated from stackoverflow.com Jan 3 '13 at 12:47

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 4 down vote accepted

This is deliberate. To quote from this post on the Official Google Webmaster Central blog:

"Starting in April, for browsers with the appropriate support, we will be using the "referrer" meta tag to automatically simplify the referring URL that is sent by the browser when visiting a page linked from an organic search result. This results in a faster time to result and more streamlined experience for the user.

What does this mean for sites that receive clicks from Google search results? You may start to see "origin" referrers—Google’s homepages (see the meta referrer specification for further detail)—as a source of organic SSL search traffic. This change will only affect the subset of SSL search referrers which already didn’t include the query terms. Non-HTTPS referrals will continue to behave as they do today."

The fundamental reason for this feature is privacy: if you're using HTTPS to protect your search queries and results from eavesdropping, it's a pretty good bet that you also wouldn't want those same search terms sent out along with any link you click from those results (possibly over an unsecured HTTP connection, too).

For details, see What can I expect from search over SSL? on Google Web Search Help pages.

share|improve this answer
1  
...of course, since Google now serves search results over HTTPS by default for logged in users, I doubt most users are using SSL deliberately to protect the privacy of search queries. –  josh3736 Jan 3 '13 at 1:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.