You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Gary Turner <kk...@sbcglobal.net> on 2003/01/08 07:12:58 UTC

[users@httpd] OT: Tracking clients as they leave site -- means and options

I'm developing a small informational site.  Where customers have their
own sites, a request for more info will send the client off my site to
the customer's.

Additionally, a given customer might be referenced from multiple pages.
For example, a hardware business might be referenced from pages devoted
to woodworking, mechanics, plumbing, or house paint.

I have no problem with clients leaving my site.  In fact, I very much
want clients to maintain control of their own browsers.  Pop-up windows
and new instances of the browser are no-nos.

The requirement is to log where the clients were sent, and which page
sent them.  The customer's own logs have this info, of course, but he
isn't likely to bother developing reports.  Plus, it's much better to be
able to "point with pride" my own self :)

My initial solution is to use CGI,

	<a href="cgi/joeshdwe.pl">Joe's</a>

in the page.  Then in a script,

	print "Location: http://joeshdwe.com/\n\n";

This satisfies the requirements.  The client browser issues the GET, and
so the back button continues to work as expected.  This is a Good Thing.
The access.log will show the unique script name and referer.  That's a
Good Thing, too.  Each reference will require a separate unique script.
This strikes me as a Bad Thing.

An alternative would be to pass the target (not in the HTML sense) as an
argument to a common script.  Now the script would need to parse target,
referer, date, etc., and save to a log/database.

What I do with HTML and Apache, I do reasonably well.  The scope of my
knowledge is not all that broad, though.  There are likely other options
that meet the specs, not to mention side effects to my options that I'm
not aware of.  I will appreciate a rousing discussion of options and
their merits.
--
gt          kk5st@sbcglobal.net
Yes I fear I am living beyond my mental means--Nash

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] OT: Tracking clients as they leave site -- means and options

Posted by Gary Turner <kk...@sbcglobal.net>.
roger@differentpla.net wrote:

>On Wed, Jan 08, 2003 at 12:12:58AM -0600, Gary Turner wrote:
>> An alternative would be to pass the target (not in the HTML sense) as an
>> argument to a common script.  Now the script would need to parse target,
>> referer, date, etc., and save to a log/database.
>
>I don't understand why it has to be so complicated.

Because I can be an idiot if given half a chance :)

>
>Surely the script won't need to save the log information?  You'll
>have:
>
> <a href="/cgi-bin/go.cgi?target=some_unique_hashed_id">go here</a>.
>
>Which will appear in your standard log file as something like:
>
> "GET /cgi-bin/go.cgi?target=some_unique_hashed_id HTTP/1.0"

The sound you hear is the result of my palm slapping my forehead over
and over and ...

I don't know why I forgot about the *complete* URL string.  slap, slap.


Tnx, Roger
--
gt          kk5st@sbcglobal.net
Yes I fear I am living beyond my mental means--Nash

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] OT: Tracking clients as they leave site -- means and options

Posted by ro...@differentpla.net.
On Wed, Jan 08, 2003 at 12:12:58AM -0600, Gary Turner wrote:
> An alternative would be to pass the target (not in the HTML sense) as an
> argument to a common script.  Now the script would need to parse target,
> referer, date, etc., and save to a log/database.

I don't understand why it has to be so complicated.

Surely the script won't need to save the log information?  You'll
have:

 <a href="/cgi-bin/go.cgi?target=some_unique_hashed_id">go here</a>.

Which will appear in your standard log file as something like:

 "GET /cgi-bin/go.cgi?target=some_unique_hashed_id HTTP/1.0"

with referrer, date and everything.

Your script then just looks up the hashed_id in a database (or perhaps
the target is encoded directly, and can be parsed out directly), and
issues the Location: response.  It should work fine.

In fact, I just tried it.  Go to:

http://www.beerology.net/cgi-bin/go.rb?http://www.slashdot.org/

...and it'll redirect you to http://www.slashdot.org/  The script looks like this:

#!/usr/bin/env ruby

print "Location: " + ENV['QUERY_STRING'] + "\r\n"
print "\r\n"

Error handling is left as an exercise for the reader.  The log file looks like this:

193.119.19.130 - - [08/Jan/2003:12:54:44 +0000] "GET /cgi-bin/go.rb?http://www.slashdot.org/ HTTP/1.1" 302 323 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)"

I'll disable the script shortly, so it might not be there when you try it.

Cheers,
Roger.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org