Re: Apache+Modperl & Website Statistics

2002-03-27 Thread wsheldah



One solution would be to put the javascript in its own .js file, and have every
page on your site reference that js file. Now every page will send a cookie with
the resolution information. You may want to adjust the server-side processing to
avoid duplicate database work, but that shouldn't be a big issue.

Wes




"Philip M. Gollucci" <[EMAIL PROTECTED]>
on 03/27/2002 05:40:47 AM

To:   darren chamberlain <[EMAIL PROTECTED]>
cc:   [EMAIL PROTECTED] (bcc: Wesley
  Sheldahl/Lex/Lexmark)
Subject:  Re: Apache+Modperl & Website Statistics


Well I've basically taken your route the first time I tried to do this a
year ago.  The other problem is that this requires the vistors go to
this particular page.  If they bookmark to another page or type the url
of a sublink, this is bypassed, and I loose the statistical information.
My problem is that the PerlLogHandler I've set up isn't actually supposed
to ever display anything to the browser.  (I don't think any PerLogHandler
anyone writes should send anything to the browser as is basically
an extension to use instead of the apache's access_log file.  Although
it could if you had a good reason.  In order for the javascript I gave to
get values it has to be sent to the browser on a page so its processed my the
javascript engine
in the browsers.

END
--
Philip M. Gollucci (p6m7g8) [EMAIL PROTECTED] 301.314.3118




On Wed, 27 Mar 2002, darren chamberlain wrote:

> * Philip M. Gollucci <[EMAIL PROTECTED]> [2002-03-27 09:59]:
> > I know perl is server side and javascript is client side.
> > AFAIK, getting the resolution is a client side thing.  I know I
> > can embed an html page with javascript in it that redirects to
> > a perl file setting the query string with width=1024;height=768
>
> [-- snip --]
>
> > But, I need to find someway to do this without the extra
> > redirect.
>
> Since, as you already realize, there is no way to get the client
> information from the server size, I think the best you can do
> would be something along the lines of: have a javascript
> enabled page that gets the height and width of the client (as
> you've shown), that then redirects the client to a location
> that can read the height and width from the query string and set
> a session cookie, which can then be read and acted upon for every
> subsequent request by a PerlTransHandler or RewriteRule.
>
> Does that sound reasonable?
>
> (darren)
>








Re: Apache+Modperl & Website Statistics

2002-03-27 Thread Stephen Gray

On Wed, 27 Mar 2002, darren chamberlain wrote:

> If you are using a PerlTransHandler anyway, you can have one that
> sends the client to a particular page if a cookie is not set:
> 
>   (a) Client requests /foo.html
>   (b) TransHandler sees that cookie is not set, does an internal
>   redirect to /js-set-cookie.html, which does some (client
>   size) js magic and transparantly redirects to the
>   cookie-setting page, which sets the cookie and does its
>   own redirect.
>   (c) TransHandler gets this request as well (it was an external
>   redirect instigated by the client-side javascript), sees
>   that the cookie it is looking for is set, and does the 
>   appropriate redirecting (to the right sized page).

Better take care to avoid an infinite loop for clients who refuse 
cookies.

Steve

===
Stephen M. Gray
www.frontiermedia.net





RE: Apache+Modperl & Website Statistics

2002-03-27 Thread Joe Breeden

Of course you could include a js snippet on every page that checks for a cookie and 
sets it if necessary or just sets it and forgoes the checking. Then on you LogHandler 
read the cookie and insert the proper info into the log if the cookie is set. No 
redirects, no worries about how they got there. Of course they need to access two 
pages on your site - one to initially set the cookie via js and another for you 
LogHandler to read the cookie.

> -Original Message-
> From: darren chamberlain [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 27, 2002 9:56 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Apache+Modperl & Website Statistics
> 
> 
> * Philip M. Gollucci <[EMAIL PROTECTED]> 
> [2002-03-27 10:38]:
> > Well I've basically taken your route the first time I tried to
> > do this a year ago.  The other problem is that this requires
> > the vistors go to this particular page.  If they bookmark to
> > another page or type the url of a sublink, this is bypassed,
> > and I loose the statistical information.  My problem is that
> > the PerlLogHandler I've set up isn't actually supposed to ever
> > display anything to the browser.  (I don't think any
> > PerLogHandler anyone writes should send anything to the browser
> > as is basically an extension to use instead of the apache's
> > access_log file.  Although it could if you had a good reason.
> > In order for the javascript I gave to get values it has to be
> > sent to the browser on a page so its processed my the
> > javascript engine in the browsers.
> 
> If you are using a PerlTransHandler anyway, you can have one that
> sends the client to a particular page if a cookie is not set:
> 
>   (a) Client requests /foo.html
>   (b) TransHandler sees that cookie is not set, does an internal
>   redirect to /js-set-cookie.html, which does some (client
>   size) js magic and transparantly redirects to the
>   cookie-setting page, which sets the cookie and does its
>   own redirect.
>   (c) TransHandler gets this request as well (it was an external
>   redirect instigated by the client-side javascript), sees
>   that the cookie it is looking for is set, and does the 
>   appropriate redirecting (to the right sized page).
> 
> Pretty straightforward.  mod_dir does this sort of thing all the
> time, under the covers (although sans javascript, of course).
> 
> (darren)
> 
> -- 
> You can't wake a person who is pretending to be asleep.
> -- Navajo Proverb
> 



Re: Apache+Modperl & Website Statistics

2002-03-27 Thread darren chamberlain

* Philip M. Gollucci <[EMAIL PROTECTED]> [2002-03-27 10:38]:
> Well I've basically taken your route the first time I tried to
> do this a year ago.  The other problem is that this requires
> the vistors go to this particular page.  If they bookmark to
> another page or type the url of a sublink, this is bypassed,
> and I loose the statistical information.  My problem is that
> the PerlLogHandler I've set up isn't actually supposed to ever
> display anything to the browser.  (I don't think any
> PerLogHandler anyone writes should send anything to the browser
> as is basically an extension to use instead of the apache's
> access_log file.  Although it could if you had a good reason.
> In order for the javascript I gave to get values it has to be
> sent to the browser on a page so its processed my the
> javascript engine in the browsers.

If you are using a PerlTransHandler anyway, you can have one that
sends the client to a particular page if a cookie is not set:

  (a) Client requests /foo.html
  (b) TransHandler sees that cookie is not set, does an internal
  redirect to /js-set-cookie.html, which does some (client
  size) js magic and transparantly redirects to the
  cookie-setting page, which sets the cookie and does its
  own redirect.
  (c) TransHandler gets this request as well (it was an external
  redirect instigated by the client-side javascript), sees
  that the cookie it is looking for is set, and does the 
  appropriate redirecting (to the right sized page).

Pretty straightforward.  mod_dir does this sort of thing all the
time, under the covers (although sans javascript, of course).

(darren)

-- 
You can't wake a person who is pretending to be asleep.
-- Navajo Proverb



Re: Apache+Modperl & Website Statistics

2002-03-27 Thread Philip M. Gollucci

Well I've basically taken your route the first time I tried to do this a
year ago.  The other problem is that this requires the vistors go to
this particular page.  If they bookmark to another page or type the url
of a sublink, this is bypassed, and I loose the statistical information.
My problem is that the PerlLogHandler I've set up isn't actually supposed
to ever display anything to the browser.  (I don't think any PerLogHandler
anyone writes should send anything to the browser as is basically
an extension to use instead of the apache's access_log file.  Although
it could if you had a good reason.  In order for the javascript I gave to
get values it has to be sent to the browser on a page so its processed my the 
javascript engine
in the browsers.

END
--
Philip M. Gollucci (p6m7g8) [EMAIL PROTECTED] 301.314.3118

Science, Discovery, & the Universe (UMCP)
Webmaster & Webship Teacher
URL: http://www.sdu.umd.edu

EJPress.com
Database/PERL Programmer & System Admin
URL : http://www.ejournalpress.com

Resume  : http://p6m7g8.com/Work/index.html



On Wed, 27 Mar 2002, darren chamberlain wrote:

> * Philip M. Gollucci <[EMAIL PROTECTED]> [2002-03-27 09:59]:
> > I know perl is server side and javascript is client side.
> > AFAIK, getting the resolution is a client side thing.  I know I
> > can embed an html page with javascript in it that redirects to
> > a perl file setting the query string with width=1024;height=768
>
> [-- snip --]
>
> > But, I need to find someway to do this without the extra
> > redirect.
>
> Since, as you already realize, there is no way to get the client
> information from the server size, I think the best you can do
> would be something along the lines of: have a javascript
> enabled page that gets the height and width of the client (as
> you've shown), that then redirects the client to a location
> that can read the height and width from the query string and set
> a session cookie, which can then be read and acted upon for every
> subsequent request by a PerlTransHandler or RewriteRule.
>
> Does that sound reasonable?
>
> (darren)
>
> --
> Pessimests are right more often, but optimists are happy more often.
>




Re: Apache+Modperl & Website Statistics

2002-03-27 Thread Andrew Ho

Hello,

FF>Can you not just set a cookie from the javascript itself, rather than
FF>having it redirect to a location which then has to read it from the
FF>query string and set the cookie. Saves you one step, if it's possible
FF>to set the cookie directly from the javascript (which it seems like
FF>should be possible, but I don't know for sure).

This is indeed possible and will save you a step. It also avoids the issue
of setting a cookie in a redirect.

http://www.mozilla.org/docs/dom/domref/dom_doc_ref10.html#1003548

Humbly,

Andrew

--
Andrew Ho   http://www.tellme.com/   [EMAIL PROTECTED]
Engineer   [EMAIL PROTECTED]  Voice 650-930-9062
Tellme Networks, Inc.   1-800-555-TELLFax 650-930-9101
--




Re: Apache+Modperl & Website Statistics

2002-03-27 Thread Fran Fabrizio


>>But, I need to find someway to do this without the extra
>>redirect. 
> 
> would be something along the lines of: have a javascript
> enabled page that gets the height and width of the client (as
> you've shown), that then redirects the client to a location
> that can read the height and width from the query string and set
> a session cookie, which can then be read and acted upon for every
> subsequent request by a PerlTransHandler or RewriteRule.
> 
> Does that sound reasonable?

Can you not just set a cookie from the javascript itself, rather than 
having it redirect to a location which then has to read it from the 
query string and set the cookie.  Saves you one step, if it's possible 
to set the cookie directly from the javascript (which it seems like 
should be possible, but I don't know for sure).

-Fran





Re: Apache+Modperl & Website Statistics

2002-03-27 Thread darren chamberlain

* Philip M. Gollucci <[EMAIL PROTECTED]> [2002-03-27 09:59]:
> I know perl is server side and javascript is client side.
> AFAIK, getting the resolution is a client side thing.  I know I
> can embed an html page with javascript in it that redirects to
> a perl file setting the query string with width=1024;height=768

[-- snip --]

> But, I need to find someway to do this without the extra
> redirect. 

Since, as you already realize, there is no way to get the client
information from the server size, I think the best you can do
would be something along the lines of: have a javascript
enabled page that gets the height and width of the client (as
you've shown), that then redirects the client to a location
that can read the height and width from the query string and set
a session cookie, which can then be read and acted upon for every
subsequent request by a PerlTransHandler or RewriteRule.

Does that sound reasonable?

(darren)

-- 
Pessimests are right more often, but optimists are happy more often.



Apache+Modperl & Website Statistics

2002-03-27 Thread Philip M. Gollucci

Alright, I've been getting along pretty well so far here. Now I need an
extra feature though.  Resolution Stats (i.e. 1024x768 or 800x600)

I've got an apache-1.3.24 server with mod_perl-1.26
running.
in my httpd.conf, I've added
PerlLogHandler P6M7G8::Stats::DBILog

Which I have already written.
It gets Operating System Types, Browser Types, Date/Time, Cookie
information, Bytes transfered, CPU time taken, etc...

I know perl is server side and javascript is client side.
AFAIK, getting the resolution is a client side thing.
I know I can embed an html page with javascript in it that redirects to
a perl file setting the query string with width=1024;height=768
i.e.
#!/usr/bin/perl
use strict;
use CGI;

print "Content-Type: text/html\n\n";

print CGI->start_html();
print qq {
  

  
  };
print CGI->end_html();

But, I need to find someway to do this without the extra redirect.
Is their anyway I can assign a perl scalar to the value of height and
width ? Also, it has to at least work in IE4.0+ NS4.0+ and Mozilla .98+ on
Windos, Linux, and Unix platforms.

As you can see the PerlLogHandler runs once for every request, and this
redirect would really get annoying and slow.

Any great ideas ?


END
--
Philip M. Gollucci (p6m7g8) [EMAIL PROTECTED] 301.314.3118

Science, Discovery, & the Universe (UMCP)
Webmaster & Webship Teacher
URL: http://www.sdu.umd.edu

EJPress.com
Database/PERL Programmer & System Admin
URL : http://www.ejournalpress.com

Resume  : http://p6m7g8.com/Work/index.html



On Thu, 21 Mar 2002, Murugan K wrote:

> Hi
>Thanks in advance for your reply.
>
> How can i  maintain session informations  without cookie , hidden
> variables  through forms  in Perl.
>
> Is there any separate Apache module is available?
>
> Regards
> K.Murugan
>
>
>