how to keep track of a number of visits to a particular page in a website

I am new to post a question in here, but not new to Java Ranch. This is a very helpful site for people like me. Thanks to everyone responsible to keep this site up and running.

Here is my problem

I have user with multiple contracts. Depending on the contract, i need to display an offers page. So the offers page is contract specific. I have to keep track of the number of visits to offer page for that contract. I have to increment the count only once in a session.

How can I do that?

For the same page, if the session is idle for 15seconds on that page, I need to popup some information.