Heath Posted December 8, 2007 Share Posted December 8, 2007 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. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 8, 2007 Share Posted December 8, 2007 First I would try these search results: http://www.google.com/search?hl=en&q=PHP%2FMySQL+Hit+Counter&btnG=Search They will help you get started and then once you do that; then I would focus on getting the results for my CMS. Quote Link to comment Share on other sites More sharing options...
micah1701 Posted December 8, 2007 Share Posted December 8, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.