Jump to content

get url that user entered your site from.


vxda
 Share

Recommended Posts

Hi, is there a posibility to check from what site / url  user entered your site in php or js ?

example... i have a baner on some other site, user clicks it and he is redirected to my site.
Is there a way to tell from what site he was redirected from?

Link to comment
Share on other sites

You can get it in a PHP section of your template files like this...

$ref = $_SERVER['HTTP_REFERER'];

Be aware that this variable can be unreliable as it is up to the visiting browser to send it and it can also be forged. Most of the time it will be correct though. More info here.

  • Like 4
Link to comment
Share on other sites

Most advertising providers just use get variables to track where someone has clicked an ad. So as long as you can dictate the url you could also count all visits coming with specific variables.

Yes i know i could user parameter in url for that but i would want to have other ways of doing that and:

$ref = $_SERVER['HTTP_REFERER'];

Does the job :) so thank you guys.

Meaby i will use both ways to be sure :P

Thank you.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...