SEO - Crawler interpreting external links - - Web Development, Programming, SEO

Friday, May 22, 2009

SEO - Crawler interpreting external links

The following is in relation to my previous post Php: Log Clicks on Links to External Sites.

The post demonstrates how to log a clock on a link pointing to an external address. This may cause some search engines to get confused when crawling the page, as the link will be pointing the the load.php script on your site, when it actually reads and takes the user to an external site.

A solution for this would be to use the actual address of the external site as the value for the href attribute, and call a javascript function which changes the href value to toint to the redirect script which logs click / hit statistics. Links would then appear to search engine crawlers to point to the correct address, and not a page on your site. If javascript is not enabled, the user will still reach the required destination, but statistics for the click will not be logged.

<a id="item-3" href="" onclick="logStats('3')" >Google</a>


function logStats(item_id)
var url = document.getElementById("item-" + item_id);
var address = url.href;
url.href = "load.php?id=" + item_id;


Post a Comment

This website is using cookies. More details