Warning: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in ..../includes/class_bbcode.php on line 2083
Search engine bots "seeing through" Javascript?
Results 1 to 3 of 3

Thread: Search engine bots "seeing through" Javascript?

  1. #1
    Registered Shockt's Avatar
    Join Date
    Oct 2005

    Search engine bots "seeing through" Javascript?

    In my efforts to build my website's backlinks, I have come across many sites that like to track the number of clicks their links get on their links page or directory. Example:
    You will notice my site, Photoshop Guides, has not recieved a direct link. Instead, my link goes to:
    From what I understand, I will only benefit from the traffic of this link. I do not gain any PR benefit.

    In an effort to improve these link click counting/tracking scripts, I was going to make a Javascript-based script. At first, I thought AJAX would be the best solution. When the user clicks the link, an AJAX request is sent to record the click and in the meantime, the user is taken to their destination via direct link. But certain ways of clicking that link aren't tracked.

    The onclick event triggers when clicked, but using my scroll wheel to click it and open the link in a new Firefox tab, the AJAX function isn't called.

    So I moved to onmouseup but realized that if you are tabbing through links and hit Enter, the "click" isn't recorded either.

    Then I decided to try onfocus to just change the link to the tracking script's URL. So when the page loads, you have a direct link. But when the link is in focus (clicked, tabbed through, etc), the URL changes to your tracking script. This then lead to me researching about Googlebot's ability to "read through" and possibly execute Javascript.

    Now finally, my question. If I have a link that looks like this:
    HTML Code:
    <a href="http://www.photoshopguides.com" onfocus="this.href='track.php?url=http://www.photoshopguides.com'">Photoshop Guides</a>
    ...will I gain the PR benefit of the direct link via href? Or will Googlebot, and other search engine bots, be able to "see through" my Javascript mask and give the PR gain to the tracking script or give no PR gain at all?

  2. #2
    Site Contributor KLB's Avatar
    Join Date
    Feb 2006
    Saco Maine
    I do find that some bots (particularly bad bots) try to sleuth out URLs from JavaScript and visit those URLs. For best SEO practices one should not rely on SE bots seeing or following any JavaScript URLs. At the same time it might be a good idea to structure tracking URLs like the one above such that they can be added to a deny list in your robots.txt file. For example you might do:
    <a href="http://www.photoshopguides.com" onfocus="this.href='track.php?page=/index'">Photoshop Guides</a>
    <a href="/contact.html" onfocus="this.href='track.php?page=/contact'">Contact us</a>
    Then add the following to your robots.txt file:
    User-agent: *
    Disallow:  /track.php
    On the back side in (in PHP or whatever) you could append the ".html" if you so desired. Renaming "URL=" "page=" and removing the domain name and ".html" will stop some bots from trying to sleuth out the URL of the JavaScript. The robots.txt file will stop legitimate bots (e.g. Google bot) from trying to index your tracking script page.
    Ken Barbalace - EnvironmentalChemistry.com (Environmental Careers, Blog)
    InternetSAR.org: Volunteers Assisting Search and Rescue via the Internet
    My Firefox Theme Classic Compact: Based onFirefox's classic theme but uses much less window space

  3. #3
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    East Lansing, MI USA
    Using event handlers in a link do not hinder SEs. So feel free.
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

Similar Threads

  1. Running a search engine: What's important?
    By Dan Grossman in forum Website Programming & Databases
    Replies: 13
    Last Post: 03-12-2006, 05:20 PM
  2. SEO paying someone to do it.
    By jr1966 in forum Search Engine Optimization
    Replies: 21
    Last Post: 09-08-2004, 06:21 AM
  3. Replies: 5
    Last Post: 01-09-2004, 12:44 PM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts