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.


Quote Reply
Re: Counting Every Click In reply to
Hi,

I assume this is for Links SQL? =)

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Counting Every Click In reply to
Hi Alex,

Yip, wrong forum huh :)

R.