Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

Counting Every Click

Quote Reply
Counting Every Click
Hi,

I've written a small script that is going to take over jump.cgi. What I want it to do though it count 'every' click on a link rather than miss duplicate clicks from the same ip as currently happens.

Can anyone tell me if this will cause problems anywhere? Below is the modified code I intend on using, I've basically just changed the order of some of the original jump code...


# first get the ip or identifier from user
my $ip = $ENV{REMOTE_HOST} || $ENV{REMOTE_ADDR} || 'None';
# Update the clickthrus to record the send
$db_links->update ( { Hits => \"Hits + 1" }, { ID => $id }, { GT_SQL_SKIP_INDEX => 1 } );
# see if this user already exists in the ClickTrack table
my $click_db = $DB->table ('ClickTrack');
my $rows = $click_db->count ( { LinkID => $id, IP => $ip, ClickType => 'Hits' } );
# if no record exists for this ip and id, insert a new one.
if (! $rows) {
$click_db->insert ( { LinkID => $id, IP => $ip, ClickType => 'Hits', Created => \"NOW()"} );
}




Cheers,
Regan.


Subject Author Views Date
Thread Counting Every Click ryel01 1467 Sep 2, 2001, 2:35 PM
Thread Re: Counting Every Click
Alex 1408 Sep 4, 2001, 9:42 AM
Post Re: Counting Every Click
ryel01 1408 Sep 4, 2001, 1:19 PM