Here's an interesting question. I've started a new website that for now I'm relying heavily on search engine traffic, and I'm wondering if anyone knows of a PHP script that can grab the search term which got the user to the site. I know of the obvious $HTTP_REFERER script which tells what site a user supposedly came from (although it's unreliable), however does anyone have a script for logging what search phrase was actually used on Google, MSN, Yahoo, etc. to find the site?

Ian

    im not aware of any scripts in perticular that do this (im sure there are many i just never needed one) but pretty much all stats programs (AWStats, Webalizer, etc) will show you search engine keywords.

    i suppose it wouldnt be too hard to make your own script to do it, google and yahoo both send the keywords in the query string of the referrer.

    just parse q=xxxx for google and p=xxxx for yahoo out of the url and you have your keyword. im sure you could check out the format of all the other search engines you are interested in seeing stats on.

      Originally posted by drew010
      im not aware of any scripts in perticular that do this (im sure there are many i just never needed one) but pretty much all stats programs (AWStats, Webalizer, etc) will show you search engine keywords.

      i suppose it wouldnt be too hard to make your own script to do it, google and yahoo both send the keywords in the query string of the referrer.

      just parse q=xxxx for google and p=xxxx for yahoo out of the url and you have your keyword. im sure you could check out the format of all the other search engines you are interested in seeing stats on.

      I noticed that Wedbalizer has it, but they limit the number of terms and I was trying to track just how users found the individual items in my store. I have a variable added for Froogle so I can tell when I get a referral from there, but I was hoping to put in a script to track referrals via search terms to find out and tweak the pages for search engine placement.

      Ian

        I havn't looked yet, but I'd recommend checking out HotScripts (yes im so shameless i put my referral number in there)

        If you don't really find anything, this seems like an interesting script to write, so I would be interested in creating something very small and portable to do this task, so any suggestions or feature requests would be cool.

          Originally posted by drew010
          I havn't looked yet, but I'd recommend checking out HotScripts (yes im so shameless i put my referral number in there)

          If you don't really find anything, this seems like an interesting script to write, so I would be interested in creating something very small and portable to do this task, so any suggestions or feature requests would be cool.

          LOL...Thanks Drew, I'll check it out and see what I can find 😉

          Ian

            6 days later

            I still haven't figured this out yet and wanted to take another shot to put it in front of some fresh eyes to see if anyone had any insight on this one. I'm trying to track what keywords people are using to find the site as well as what search engine they came from.

            Ian

              Write a Reply...