If I search for something on google and click on a result (mytestsite.com), the referer to that site will be URL of the google search.
Now on that site, there is a JS file include that is used for tracking purposes..however the referrer to that JS file request is mytestsite.com...is there no way for the server handling the JS request to know that it originated from a google search?
referrer ) and add it to the url of the pixel you get. For example: var referer = document. referrer; var pixelUrl = 'http://website3/pixel?referrer=' + escape(referrer); // create pixel...
There is a global variable in PHP that contains the referred URLs, called “$_SERVER.” The “$_SERVER” variable includes the “HTTP_REFERER” element that will return the referrer URLs. The combining “$_SERVER['HTTP_REFERER']” variable will display the complete URLs of the webpage that the current page is linked from.
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.
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.
I'm a little unclear on what you are trying to do, but you can grab the referrer with JavaScript using:
document.referrer
...and pass it along to the server in your request for the JS file. Several ways to do this...here's one:
<script> var e = document.createElement("script"); e.src = 'someJSfile.js?referrer='+document.referrer; e.type="text/javascript"; document.getElementsByTagName("head")[0].appendChild(e); </script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With