| Click Through Counting |
Here's a click-thru counter you can use to count how many times a
link and/or graphic has been clicked. What you need are three things:
Here's the code:
We'll be assuming that you're making a click-thru counter for www.psacake.com.
;)
<%
Set
FileObject = Server.CreateObject("Scripting.FileSystemObject")
HitsFile = Server.MapPath ("/counter") & "\psacake_hits.txt"
Set
InStream= FileObject.OpenTextFile (HitsFile, 1, false
)
Oldpsacake_hits = Trim(InStream.ReadLine)
Newpsacake_hits = Oldpsacake_hits + 1
Set
OutStream= FileObject.CreateTextFile (HitsFile, True)
OutStream.WriteLine(Newpsacake_hits)
%>
<%
Response.Buffer = True
%>
<!--#include file="psacake_counter.asp"-->
<% Response.Redirect
"http://www.psacake.com" %>
Instead of having <a
href="http://www.psacake.com">
use
<a
href="www.yourURL.com/psacake_redirect.asp">Click Here</a>