[ic] Affiliate coding question need some help

Andrew Brown interchange-users@icdevgroup.org
Thu Feb 27 09:07:00 2003


My affliate wants us to set a 48 hour cookie if someone leaves our website. If someone comes back before the 48 hours the affiliate will receive credit for the sale. If someone comes back in 49 hours the affiliate will not get credit. If the person comes back before the 48 hours it has to read the cookie that has been saved on that system, and it won't rewrite over the existing cookie and add another 48 hour cookie. I am able to save the cookie and read the cookie but we can't expire the cookie after 48 hours. Also if the cookie expires after the 48 hours and that same person comes from the affiliate again then another 48 hour cookie will get set. Here is the code we have been working on, and thanks to Kevin for all his help.

We tried setting it to 10 mins to test but when I come back after 10 mins the cookie is still valid. Anyone have any suggestions of why this cookie is not expiring??


 [calc]
     return undef if $Scratch->{affiliate_checked};
     $Scratch->{affiliate_checked} = 1;

     my $cookie = $Tag->read_cookie('AFFILIATE');
     $Session->{source} ||= $cookie;

     if ($Session->{source} && !$cookie) {
         $Tag->set_cookie({
             name => 'AFFILIATE',
             value => $Session->{source},
             expire => ' expires=' . $Tag->time({
                 adjust => '+0010',
                 gmt => 1,
                 body => '%a, %d-%b-%Y %H:%M:%S GMT',
             }),
         });
     }
     undef;
 [/calc]