CodeAve.com CodeAve.com - ASP - Read/Write
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Count Click Throughs (Without a db)
Need to track where your users are clicking to from your site? Easily count and display the number of click throughs from your site without a data base. The following example utilizes three identical documents (linka.asp,linkb.asp,linkc.asp) and click_counter.asp which takes the input reads a text document on the server adds one to that value and writes it back to the server.
View the Output
Text View
Print View
Mail this Link
Download the Code

linka.asp, linkb.asp, linkc.asp
<%
set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath("linka.txt"))
counter = clng(act.readline)
act.close
%>

<a href="click_counter.asp?u_link=linka.asp">Link A</a> (<%= counter %> clicks)
<br>

<%
set act = fso.opentextfile(server.mappath("linkb.txt"))
counter = clng(act.readline)
act.close
%>


<a href="click_counter.asp?u_link=linkb.asp">Link B</a> (<%= counter %> clicks)
<br>

<%
set act = fso.opentextfile(server.mappath("linkc.txt"))
counter = clng(act.readline)
act.close
%>


<a href="click_counter.asp?u_link=linkc.asp">Link C</a> (<%= counter %> clicks)

 

click_counter.asp
<% 
u_link=request.querystring("u_link")
counter_add= replace(u_link,".asp",".txt")

set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath(counter_add))

counter = clng(act.readline)
act.close

counter = counter + 1

Set act = fso.CreateTextFile(server.mappath(counter_add), true)
act.WriteLine(counter)
act.Close

response.redirect (u_link)
%>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3