Home » Developer & Programmer » Application Express, ORDS & MOD_PLSQL » Hit Counter
Hit Counter [message #218332] Wed, 07 February 2007 15:33 Go to next message
tkstock
Messages: 28
Registered: April 2006
Location: Richmond
Junior Member
Has anyone created some sort of hit counter in OAE? I've got a public page that I'd like to implement a hit counter, and since IE makes it difficult to grab IP addresses (and I don't have SSI available), this is proving to be a difficult task.

Edit: I want it to log UNIQUE visitors, therein lies the difficulty.

Any thoughts?

[Updated on: Thu, 08 February 2007 07:51]

Report message to a moderator

Re: Hit Counter [message #244396 is a reply to message #218332] Tue, 12 June 2007 10:58 Go to previous message
tkstock
Messages: 28
Registered: April 2006
Location: Richmond
Junior Member
Just to answer my own question in case anyone else needs it:

I implemented a hit counter on an application I wrote - I store the hits in a table. You can get the user's IP address by using owa_util.get_cgi_env('REMOTE_ADDR').

This page process grabs the user's IP addy and inserts it with the page number into the database:

begin
    [package].log_hit(owa_util.get_cgi_env('REMOTE_ADDR'),[page number],'O');
end;


And here is the package procedure I'm calling:

procedure LOG_HIT(IP_ADDRESS in Varchar2, PAGE in Number, OPEN_CLOSE in Varchar2) is
    begin
        insert into [database table]
             values (IP_ADDRESS, OPEN_CLOSE, sysdate, PAGE);
    exception
        when others then
            htp.prn('Error in log hit:  ' || sqlerrm);
    end LOG_HIT;

I have an OPEN_CLOSE column that logs whether a person is opening or closing the page. I also log when they leave a page, that way I know how long they were there.

Hope that helps!

[Updated on: Tue, 12 June 2007 11:02]

Report message to a moderator

Previous Topic: Problem in adding the User into Portal
Next Topic: Deployment script
Goto Forum:
  


Current Time: Thu Dec 08 16:12:44 CST 2016

Total time taken to generate the page: 0.09422 seconds