1

As always, I would like to thank all of your help and assistance in advance.

I am looking for a way to automatically redirect a user to a site and maintain the redirect site as the referral site. Let me explain the process and what is needed in a step by step format.

  • User clicks on a desired link in an email
  • User is navigated to testdomain.com
  • User is automatically redirected to test.com/landing
  • test.com sees testdomain.com as the referral site
  • Data is gathered via Google Analytics

I am unsure as if this PHP code will take care of it, or not -

header("Location: http://google.com", true, 303);

I could test and that is most likely what I am going to do. But I would like to understand a little more as to WHY this would or WHY this wouldn't work.

nsearle
  • 11
  • 1

2 Answers2

0

I believe that the "Referer" field is controlled on the client browser. There is nothing that you can do to guarantee that the operation that you want will happen. Browsers can choose to send a fixed/false referer or none at all.

The RFC does not seem to indicate that the referer needs to be preserved either way.

Because the source of a link might be private information or might reveal an otherwise private information source, it is strongly recommended that the user be able to select whether or not the Referer field is sent. For example, a browser client could have a toggle switch for browsing openly/anonymously, which would respectively enable/disable the sending of Referer and From
information.

sybreon
  • 7,405
  • 1
  • 21
  • 20
0

I don't think it will work the way you want it too. The referer header is controlled by the client. Most browsers only set the referer if you click on a link. They do not set it on redirects.

If a person clicked on a link in Google that linked to testdomain.com, test.com/landing would show them as coming from google. If they typed in testdomain.com they would be redirected and the referer would be blank.

Perhaps you could set up logging on testdomain.com and find out how many people get redirected to test.com/landing.

racyclist
  • 624
  • 5
  • 9