> Yes ... basically we want to track which company sent us the
> reference when customers subscribe.
> the ref=xxx where xxx will = some company id
> I want to tack this on to every click so that when the user
> finally submits an application we
> can credit the company that gave us the customer
>
> I will try your solution and thanks for your thoughts
> I appreciate it.   I could not find much documentation regarding
> this issue.

This is so close to what I'm doing right now, you could *ALMOST* drop in my
module and have it work the first time.

For that reason, I'm gonna post it. :-) COMMENTS ALWAYS WELCOME!

Notes:
1. this is an 0.1-0.2 version.
2. in _set_cookie, the line
  domain => ".$ENV{DOMAIN}",
needs clarification:  $ENV{DOMAIN} comes from my httpd.conf:

PerlSetEnv DOMAIN mydomain.com

(I use identical modules on multiple sites whereever possible)
*AND*, the '.' at the beginning is required.  When (if) you use this
yourself, DON'T FORGET IT!!!  Otherwise you WILL have problems (and for the
two months of wondering what the @&#$ was going on: <SIGH>).

3. I'm using Apache::Session::Oracle, because I already have Oracle.  ::File
or ::MySQL or whatever might be better for you.

4. I have a private module called My, which is read-only to root and has my
DB auth stuff in it, that loads at server start.  This explains the odd
DBI->connect parameters.

5. I made path handling vaguely intelligent... if I get a request for
/affiliates/1122334, I read the /1122334 as the referer (see line 53, you'll
prolly wanna change this).  If I get a request for
/affiliates/somethingelse.html, then I DECLINE processing so that Apache can
either serve somethingelse.html or handle the 404 as usual.

The upshot is, when they finally sign up, I import the Apache::Session and
see if C<exists $session{referer}>.  If yes, great, handle it.  If not, just
do a normal signup.

in order to activate this module, do something like this in httpd.conf:
<Location /affiliates>
PerlFixupHandler +Stat::Affiliate
</Location>

Hope this helps!

L8r,
Rob

#!/usr/bin/perl -w
use Disclaimer qw/:standard/;

Affiliate.pm

Reply via email to