Page 1 of 1
Tracking clicks to other sites
Posted: Tue Jan 21, 2003 9:40 am
by mr_griff
I maintain a directory of local business websites. All the websites are stored in a MySQL db and we have been counting each time someone clicks on one of the sites. When someone clicks on a link, we pass the websiteID to a redirect page, increment the counter and do a header redirect.
It's great to be able to see how many people are clicking on the various links, but the problem is that Google doesn't recognize this as a link to another website. Since google places you high in the search results for having people link to your site, etc. we have to decide whether to count the clicks or get placed higher in Google.
Has anyone come across this type of problem before?
no, but i have an idea
Posted: Tue Jan 21, 2003 6:10 pm
by uberpolak
I've never encountered this, but I do have an idea. It might make sense if you're saying what I think you are.
Do you mean you get a higher ranking for having direct links to other sites? (ie <A HREF="
http://www.site.com/"> instead of <A HREF="redir.php?id=site">), if so, maybe at the end of your script you could try putting a switch that, based on the link being passed to the script, could echo one to the page, and then change the header redirect for a JavaScript redirect so the page gets loaded before sending them off? You'd sacrifice a bit of load time, but I think you might get the results you're looking for. Just an idea, let me know how it works if you decide to try it.
Posted: Tue Jan 21, 2003 7:08 pm
by mr_griff
From what we have been reading, having direct links to other sites and having them link back to you, really helps get you ranked higher up in the list. All search engines can find keywords for a website. So if there are a bunch of sites linking to a website, it must be good so they rank it higher on the list.
You can check how many websites that Google has found that link to your site by typing something like this into the search string: "link:forums.devnetwork.net"
When checking the sites that we link to directly, we show up. When checking the sites that we link to through a redirect page, we don't show up on the list. So using PHP's header("Location:
http://www.mysite.com"); function, it doesn't count. I can see why it doesn't know that it's a link to an external site.
Maybe check the user agent to see if it's the "Google Bot" and making the links direct in that case would work.
Posted: Tue Jan 21, 2003 7:12 pm
by evilcoder
Yeh that or have your clients link to a page called: main.php
so on google your site is shown as
http://yoursite.com/main.php
Then when someone clicks either from google or from the business sites, you use PHP $PHP_REFERRER variable to place the URL into the database.
Then add like
$Check_URL = "SELECT url FROM `tablename` WHERE url LIKE '$PHP_REFERRER' ";
$Check_Exist = mysql_num_rows( $Check_URL );
if ( $Check_Exist == 1 )
{
$Counts = "UPDATE `tablename` SET counts = counts+1 WHERE url = '$PHP_REFERRER' "
$Update_Counts = mysql_query( $Counts );
}
else
{
$AddNew = "INSERT INTO `tablename` ( 'id' , 'counts', 'url' ) VALUES ( '1', '$PHP_REFERRER' );
$AddURL = mysql_query( $AddNew );
}
header( "Location:
http://yoursite.com" );
?>
Get what i mean?
Posted: Thu Jan 23, 2003 4:16 am
by f1nutter
Just a comment about Googles ranking. I think, reading their site, that they only count links to your site and not those from your site.
Sites that are ranked higher that link to you, will have a higher weighting then a link from a lower ranked site.
So if you do stuff about Windows, and have a link to your site from Microsoft, then you will be ranked higher then a link from Joe Bloggs Computing.
As far as I can tell, links from your site don't count, because you could do a search on Google for Microsoft, then link to every site in the top 50, and move yourself up the rankings. This does not give a true indication of your sites popularity.