#1
  1. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Jul 2012
    Posts
    10
    Rep Power
    0

    Question Detecting bot visits with php


    Hi

    If do something like this, at the top of my website home page

    <?php

    $bot=$_SERVER['HTTP_USER_AGENT'];

    if ($bot=="googleBot") //or any of the search engines
    {
    //code here for simple HTML of site
    ie HTML BODY DIV etc....

    just raw HTML to do with the site in question,
    About text
    Service text
    Site maps, links
    so.. all of this is for the spider to pick up and hopefully index
    alt img text

    nothing is dynamic, all is hard coded into the markup
    no human would ever see this!
    }
    else
    {
    //code here for
    for Jquery site, which dynically loads in,
    everything on one page, but uses # in url bar, fully utilises browser back buttons history
    ajax calls, all the works

    bots never see this
    }

    ?>


    In short could this be considered good practice? Or not, and if not are the spiders 'clever' enough to know this has been attempted and not index the site? Would this approach stand any chance of working - ie indexing a site with is heavy on Jquery and ajax!

    I am going to set it up with a site anyway, to test, and will include my findings here, but anyone out there who could help.... with any experience you have, thank you!

    RogueIkon
    Last edited by rogueIkon; Jul 4th, 2012 at 08:33 AM.
  2. #2
  3. SEO Insultant
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Oct 2005
    Location
    sharing a room with my ego
    Posts
    5,568
    Rep Power
    1773
    If bots don't use jQ etc. anyway, then why hide it from them?

    This looks like cloaking - for whatever reason - and search engines are pretty good at spotting it nowadays. Needless to say they don't like it...

    So: why?
  4. #3
  5. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Jul 2012
    Posts
    10
    Rep Power
    0
    Hi

    thanks for your reply, dzine

    It's not that I understood bots to 'not use jQuery' or that I am 'hiding it from them' but rather, that they don't see the Javascript, at all, anyway, right?

    If I have, say, the About text in an append command, then that About text would never be seen by the bot, so, it will never be indexed, no matter what keywords I put in it, that match the meta keywords!

    As for the why?- I am trying to find best practices for having a website that uses Javascript, get indexed by the search engines, for good page ranking results.


    In the example php I gave, how exactly is it, that the bot would 'know' that there is one version of the site for bots and another for the humans! Once it requested the page all it would get back is simple yummy HTML, with all the trappings that bots like (or I am told they like) - nothing dynamic at all?

    How do bots know? They would have to first of all read the php script itself, then be able to understand the syntax. But the php is returned to the bot as HTML from the server, isn't it?

    What am I missing here?

    rogueIkon
  6. #4
  7. SEO Insultant
    SEO Chat Mastermind (5000+ posts)

    Join Date
    Oct 2005
    Location
    sharing a room with my ego
    Posts
    5,568
    Rep Power
    1773
    Personally, I'd still go for the old tried and tested <noscript> element.
    As long as the content within that element closely matches the scripted content, it is fine to use the tag. That's what it was intended for, without the need for 'cloaking' etc...

Similar Threads

  1. Visits from SERPS fall down
    By Valkano in forum Google Optimization
    Replies: 3
    Last Post: Jan 18th, 2006, 05:30 AM
  2. Googlebot only visits default.asp page....???
    By thall89553 in forum Google Optimization
    Replies: 2
    Last Post: Jun 14th, 2005, 02:40 AM
  3. After Detecting Click Fraud Then What?
    By bixby27 in forum Other PPC
    Replies: 2
    Last Post: Nov 13th, 2004, 05:12 AM
  4. Yahoo only visits index page
    By GayClarke in forum BING/Yahoo Search Optimization
    Replies: 16
    Last Post: Jun 23rd, 2004, 11:20 PM

IMN logo majestic logo threadwatch logo seochat tools logo