Name
Hits —
objPgCntr
.Hits(
[strPathInfo
])
Synopsis
Retrieves a Long from the Page Counter hits file representing the total number of times a given page has been requested.
Parameters
-
strPathInfo The virtual path and filename for the page whose hit count you wish to retrieve. If you do not include a
strPathInfoargument, the Page Counter object will retrieve the number of times the current page has been requested.
Example
<%
' Declare local variables.
Dim objPgCntr
Dim lngHitCount
' Instantiate a Page Counter object.
Set objPgCntr = Server.CreateObject( _
"MSWC.PageCounter")
' Retrieve the hit count for the home page.
lngHitCount = objPgCntr.Hits("/Apps/Homepage.asp")
%>
The home page has been served <%= lngHitCount %> times.Notes
As explained earlier, a page's hit count is updated automatically (assuming that page contains a Page Counter object) any time a user requests it. This number shows both "new" requests and those produced from simply clicking on the Refresh button.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access