1

This must be a stupid question, but I was wondering. How do I know if a certain visitor who visit my site came from another site by clicking a redirected link going to my website?

it's like redirecting a traffic.

is it possible to track if that user came from a specific site by clicking a link there going to my site?

Thanks in Advance

Sam Teng Wong
  • 2,379
  • 5
  • 34
  • 56
  • You mean like who was the referring website? – etrey Oct 01 '15 at 06:13
  • @etrey Yes, it's like referring.. – Sam Teng Wong Oct 01 '15 at 06:14
  • 1
    Well, in most cases you can use `$_SERVER['HTTP_REFER']` but it's not always accurate, other than that, if the site sends a parameter with the URL / HTTP then you can also use that (Although that requires that you know / have a deal with the other site). – Epodax Oct 01 '15 at 06:15
  • Should be able to see the referrer via most analytics packages installed to your site. Google Analytics for example will provide the exact page. EDIT: I assumed you were asking for general knowledge, if this is specifically for PHP than I agree with @Epodax , HTTP Refer not generally reliable. – etrey Oct 01 '15 at 06:15
  • use a referring url like index.php?ref=1234. Then collect hit count – Sajitha Rathnayake Oct 01 '15 at 06:17
  • @Epodax I see... Yes, it must have a deal with both parties.. thanks this gives me an idea. – Sam Teng Wong Oct 01 '15 at 06:17
  • @etrey how about in asp.net? how can I do that? is there an equivalent code for `$_SERVER['HTTP_REFER']` in ASP.NET? or the only choice is google analytics? – Sam Teng Wong Oct 01 '15 at 06:20
  • @etrey Hence why I said "It's not always accurate," Although it should properly have been worded as not accurate :) – Epodax Oct 01 '15 at 06:21
  • It's not necessarily that Google Analytics is the only option for this, but it is an option to track incoming traffic for general data gathering. Are you trying to program this into something, however? Or just want to keep general stats – etrey Oct 01 '15 at 06:22
  • @etrey I am going to program this.. to know if that user came from an affiliated site... I want to see in the userdetails where this user came from. is it from affiliated sites or direct visit. – Sam Teng Wong Oct 01 '15 at 06:26
  • 1
    http://stackoverflow.com/questions/4258217/getting-the-http-referrer-in-asp-net You could use the UrlReferrer property of the current request: `Request.UrlReferrer` – Twisty Oct 01 '15 at 06:44

0 Answers0