How do services such as Google Analytics discover the website that a user was using prior to them clicking through to your site. These are commonly called referrals.
I'm not talking about affiliate accounts where 'special links' tend to have a URL variable included but instead services that only appear on your site, how can they possibly see where the user came from?
My开发者_运维百科 educated guesses so far include:
- The referral website also includes the services code
- The referral website used a centralised service to read tracking cookies which are also read on your site
Neither of these seem quite correct - so how do they do it?
The browser sends along a "Referer" header, which has the url of the link they clicked that triggered the load of a new page.
http://en.wikipedia.org/wiki/HTTP_referrer
It's up to client (in the case the browser) to pass along that proper value. Which means it can't be 100% trusted. In fact some very old school "security" measures involved protecting content unless access through a certain site or page. You could fool this method of security with Referer "spoofing" where you make your browser lie about where it came from by sending different referer headers.
http://en.wikipedia.org/wiki/Referrer_spoofing
精彩评论