Forum Moderators: open

Message Too Old, No Replies

Problem w/ Duplicate Google Entries because of Dynamic URLs

Back Links Pointing to Different Pages

         

apfinlaw

4:52 pm on Mar 26, 2003 (gmt 0)

10+ Year Member



Here's what happened:
We set up several links to our home page via outside sites. To track these links, we added a "source code", similar to mysite.com/?source=outsidelink.
When google crawled last month, they captured ALL of these links (several thousand) COMPLETE with the source code. Now, the site has two results: mysite.com and mysite.com/?source=outsidelink. Both show up fairly well in SERP, but would do MUCH better if combined back links to the one page.

Here's what we've done thus far: We have changed ALL of the links to point to the home page without the "source code". (This was done prior to last deep crawl"). Will the "source code" page simply go away, or should we run a robots.txt script to prevent google from viewing the source code page?
If we do this, Therefore, the question is: How do we set up so that google will "combine" these pages, and attribute all backlinks to ONE page?

(While we're discussing this, does any php guru know a better way to track source codes (without using cookies)?

tstaheli

7:17 pm on Mar 26, 2003 (gmt 0)

10+ Year Member


apfinlaw,

You could use the HTTP_REFERER function in PHP to track where your traffic came from.

Leave the links pointing to the homepage.

In your homepage code you could write something like this:

<?
$referraladdress=$HTTP_REFERER;

$refcon = mysql_pconnect("localhost","username","password") or die ("Can't connect to DB");
mysql_select_db("database_name",$refcon);

$referralquery="insert into referrals (referraladdress,date_submit)
values ('".$referraladdress."',NOW())";
mysql_query($referralquery);

?>

I've made a table in my database called referrals.
It has 3 fields:
id (auto_increment),
referraladdress (HTTP_REFERER)
and date_submit (when the HTTP_REFERER was click).

When a link to the homepage is clicked the PHP script gets the referer and writes it to the database with a timestamp.

Now your outside links that are clicked will be stored in a database for you to analyse.

I hope this helps!

FYI, I just inserted this code into my header file on a site and I've had 20 referers in the time it took to post this code.

Thanks for the idea!

One drawback, I quote from php.net
"The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted."

Nevertheless, I'm going to use it!