Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I determine if the document.referrer is from my own site?

Each time a page is requested I get the referrer of the page it came from. I need to track just referrer from other sites, I don't want to track going from one page to another within my site. How can I do that?

like image 818
David Thielen Avatar asked Dec 06 '10 02:12

David Thielen


People also ask

How do I check my referrer?

To check the Referer in action go to Inspect Element -> Network check the request header for Referer like below. Referer header is highlighted. Supported Browsers: The browsers are compatible with HTTP header Referer are listed below: Google Chrome.

How is document referrer set?

The Referer header is set by your browser and sent to the server when you request a page. The value of this header is the URL of the previous page that linked to the newly requested page. It is where you came from, essentially.

How do I find my referral URL?

There is a global variable available in PHP which contains the referral URL. The $_SERVER global variable has the element “HTTP_REFERER” that will return the referer URL. $_SERVER['HTTP_REFERER'] is the element or code that returns the complete URL of the web page from where the current page was called.

What is referrer website?

The address of the webpage where a person clicked a link that sent them to your page. The referrer is the webpage that sends visitors to your site using a link. In other words, it's the webpage that a person was on right before they landed on your page.


1 Answers

document.referrer.indexOf(location.protocol + "//" + location.host) === 0;
like image 83
Eli Grey Avatar answered Sep 18 '22 19:09

Eli Grey