What variables do search engines pass

Discussion in 'PHP' started by alphamonk, Oct 7, 2009.

  1. #1
    I am trying to figure out if my site traffic is from a search engine or a referrer. What parameters do search engines pass? This is untest code to give you guys an idea of what I am trying to do.

    
    $se_array = array(google.com, msn.com, yahoo.com, bing.com, altavista.com);
    foreach ($se_array as $se_name) {
        $se_found = preg_grep($se_name, $_REQUEST);
        if($se_found){
            //Do what I want to do to search engine traffic
        }
    } else {
        // Do what I want to do with referrer traffic
    }
    
    PHP:

     
    alphamonk, Oct 7, 2009 IP
  2. kbluhm

    kbluhm Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $_SERVER['HTTP_USER_AGENT'];
    PHP:
    You'll have to research this one. Google calls itself Googlebot, Yahoo! is Slurp, etc. They all come up with creative names to impress themselves.

    Here is a quick snippet to get you on your way:
    http://stackoverflow.com/questions/1154420/how-to-detect-search-engine-visites-on-my-site-like-phpbb
     
    kbluhm, Oct 7, 2009 IP
  3. alphamonk

    alphamonk Peon

    Messages:
    116
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I don't care about bots. Does google initilize the HTTP_USER_AGENT variable when sending, search engine traffic to a site?
     
    alphamonk, Oct 7, 2009 IP
  4. vetrivel

    vetrivel Peon

    Messages:
    147
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Why dont you use google analytics ?
    It will give all the details as you need and also more than what you expect.
     
    vetrivel, Oct 7, 2009 IP
  5. kbluhm

    kbluhm Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    What? Isn't that what you asked for, when a search engine is visiting your site? Please be more specific.
     
    kbluhm, Oct 7, 2009 IP
  6. alphamonk

    alphamonk Peon

    Messages:
    116
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I do use Google Analytics for tracking my website statistics. The data I am trying to get cam be used for more than statistics tracking I am going to use this data for more than that too. I really mean this, thanks for the info.

    If it was, then you need to listen to what I am thinking and not to what I said. I am trying to find out if my traffic was sent from a search engine (organic traffic) or one of my referrers(referral traffic). I will show different pages to organic traffic than I show to referral traffic. I certainly could have worded my question better, than I did in the OP.

    Does Google, Yahoo, MSN, Bing and the other top rated search engines label it's organic traffic so I can distinguish between the organic and referral traffic.
     
    alphamonk, Oct 7, 2009 IP