On way to track the number of hits that your website receives is by using a text file counter.
The first thing to do is create a text file called totalhits.txt and save it within a directory called statistics.
Then, all you have to do is include the code below at the top of every page that you want hits counted from:
<% Set FileObject = Server.CreateObject("Scripting.FileSystemObject") HitsFile = Server.MapPath ("/statistics") & "\totalhits.txt" Set InStream= FileObject.OpenTextFile (HitsFile, 1, false ) OldHits = Trim(InStream.ReadLine) NewHits = OldHits + 1 Set OutStream= FileObject.CreateTextFile (HitsFile, True) OutStream.WriteLine(NewHits) %>
That's it. Now, you've got yourself a hit counter that uses a good old fashioned text file
http://www.aspwebpro.com/aspscripts/statistics/totalhitstxt.asp
No comments:
Post a Comment