Modules

[MODULE] myReferer: track your referers, search engine, webspiders and keywords

solo71  10-Aug-2005 07:01 19270 Reads   12 Comment(s) 
Resized Image

Extra explications

When coding this module, and after several test on various sites, I had to decisions which may not suits every users. Here are some of them:

1) Keywords selection

In the 'record.php' file, the keyword selection is running through a filter process:

// Keyword analyser //////////////////////////////////////////////////
    
$array explode(' '$query);
    foreach ( 
$array as $query ) {
    
$query strip_tags($query);

// Uncomment the following line if you have problems with special characters.
// Attention: this option may cause your site to crash if not accepted by your server!
// $query = mb_convert_encoding($query, "", "auto");

// Check keyword lenght
    
$query_lenght strlen($query);
if ( 
$query_lenght $min AND $query_lenght $max ) {
// if you want to remove puncutation except the '.'
    
$query str_replace('.''xzy'$query);
    
$query eregi_replace("[[:punct:]]"," "$query);
    
$query str_replace('xzy''.'$query);

// if you want numbers
//     $query = eregi_replace("[[:digit:]]"," ", $query);

// All charaters minuscules and remove blank spaces
    
$query strtolower($query);
    
$query trim($query);

// End Keyword analyser //////////////////////////////////////////////


Minimu and maximum keyword size is set in the head of the file.

2) Targeted page records

I got a long discussion wether we should record each and every page targeted by search engine, referers and linked to keywords with Marco. We finally decided not to record all of them, but only to link the latest page visited to the latest query/referer. The main objective of this was to keep control of the database size. Plus, having too much result would lose the webmaster in a data overweight.

3) Record operation

The 'record.php' file is activated on each and every page of your site. In the hope to limit database queries, the record functions are activated in the following cases :

a. the referers url is different from the current site and not a direct call.
b. if the referer has keywords, it is considered as a search engine, and thus record the used keywords.
c. to check wether the visitor is a bot or not, its useragent must be different from Mozilla and Opera.

Some errors may arise from this control. Please let me know about recurrent errors so I can adapt the code.
Rating 0/5
Rating: 0/5 (0 votes)
Voting is disabled!


Login

Who's Online

337 user(s) are online (28 user(s) are browsing Publisher)


Members: 0


Guests: 337


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits

Categories