Link to home
Start Free TrialLog in
Avatar of amit_dutta
amit_dutta

asked on

Hit count on a domino web page

i have launched a web page on domino server of my organization, now i want to know that how many people have hit that page. How can can i get the hit count and show it on my web page. I am using release 4.6.2
ASKER CERTIFIED SOLUTION
Avatar of dmpdmpdmp
dmpdmpdmp

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stamp
stamp

Without agents it looks like this:

FIELD CountDate := CountDate;
FIELD Counter := Counter;
count := @GetProfileField("WebCounter";"Counter";"Anonymous");
date := @Now;
@If(count='';@Do(@SetField("count";1);@SetProfileField("WebCounter";"CountDate";date;"Anonymous"));@SetField("count";count+1));
@SetProfileField("WebCounter";"Counter";count;"Anonymous");
@SetField("Counter";count);
@SetField("CountDate";@GetProfileField("WebCounter";"CountDate";"Anonymous"))

Put above code into "Value" event of a field named "CountDate" of type "Time: Sow Date".
Have another filed named "Counter" of type "Number".

This code in a value event do the same as the agent from dmpdmpdmp above. It's up to you what you like to use.

Here is a modification to the same agent that do almost the same, the difference is that in this case the hit counter is independent for each document a user access from the website (using the same form)


Sub Initialize
     Dim Session As New NotesSession
     Dim doc As NotesDocument
     Dim counter As Double
     Dim countStr As String
     
     Set db = Session.CurrentDatabase
     Set doc = Session.DocumentContext
     
     countStr = doc.FCounter(0)
   
     If countStr = "" Then
          counter = 1
     Else
          counter = Cdbl(countStr) + 1
     End If
     
     doc.FCounter = counter
     Call doc.save(False,False)
End Sub

Put this code on an agent, which should be on the WebQueryOpen of your form.
FCounter should be on your form and its type is Number and Computed

Good Luck!