Jump to content

I Need some help finding/writing a php script to track incoming hits from sites


Heath

Recommended Posts

I am looking to make or find some sort of referral script that will save the hits and domains that send my sites hits. I would like it to automatically store and display the top sites of the day and week and be able to embed the script easily in my current cms.

 

Any help would be greatly appreciated.  I've been looking for 2 days and can't seem to find any thing with a demo.

Link to comment
Share on other sites

set up a table in your database, at a minimum it should have an auto incremental primary id column, a timestamp field and a column to put the referring url in.

 

then stick something like this at the top of every page you want to track

<?php

$referrer = $_SERVER['HTTP_REFERER'];

if($referrer != "" && $referrer != "your_domain.com"){
mysql_query("INSERT INTO tracking_table (referring_url) VALUES ('$referrer') ");
}

?>

 

wahlah, now you have a table filled links that linked to you site.  Then just write a script to query the table, based on your time stamp, to figure out the sites with the greatest hits.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.