Friday, July 9, 2010

Who Are Coming to Our Site And Where Are They Coming From ?

We sometimes wonder where our visitors or members are coming from and we want to learn where they are coming from. Because of this, we’ll reach this information with php by using some function.
$_SERVER['HTTP_REFERER'] = We can reach visitors address, if they reach our site with clicking the link.
For Example, we can use this codes for learning some information about our visitors or members which are click our link from google :
$referer = strtolower($_SERVER['HTTP_REFERER']);
//If there is a google term, it means it is coming from google,
if(strpos($referer,"google")){
echo $referer;
}
There is 2 more codes and these are string codes:
strtolower= It maximize phrase’s size which is string code.
strpos($stringvariable, “word or letter which will search”)= This code is using for searching variable in string.
If we use these codes like that, we can’t see where are they coming from. We have to save information to database for reach them. In this way, we can only see visitors information.

No comments:

Post a Comment