Forum Moderators: open

Message Too Old, No Replies

Problem processing a document.write from another page

trying to track hits the way HitsLink and Webtrends do

         

witsom

12:13 pm on Jul 29, 2003 (gmt 0)

10+ Year Member



I have two sites that are all HTML pages and a third site that's ASP. I want to track traffic on the HTML sites. I put the following javascript at the bottom of each page:

<script language="javascript">
document.write('<img border=0 hspace=0 vspace=0 width=1 height=1 src="http://208.21.162.221/gat-traffic-get.asp?table=trafficChilhowee&javaScript=yes">'); </script>

The ASP page stores the data in an Access database.
The code I have works intermittantly. Many hits are not getting recorded. Some people coming to the site (doing QA for me) didn't get any of their hits recorded. (The sites each only get about 1000 - 2000 hits per day.) Here is the very straightforward ASP code:

sub subGetHits()
dim dcnDB, rsData, strSQL
dim strTableForSite
strTableForSite = request.QueryString("table")
set dcnDB = funcOpenDatabase(gatdata)
strSQL = "SELECT * FROM " & strTableForSite & " WHERE 1 = 2;"
set rsData = server.createObject("ADODB.recordSet")
rsData.open strSQL, dcnDB, adOpenDynamic, adLockPessimistic
rsData.AddNew
rsData("whatBrowser") = request.ServerVariables("HTTP_USER_AGENT")
rsData("IP") = request.ServerVariables("REMOTE_ADDR")
rsData("referredBy") = request.ServerVariables( "HTTP_REFERER" )
rsData("javaScript") = request.QueryString("javaScript")
rsData("date") = date()
rsData.update
rsData.close
dcnDB.close
set dcnDB = nothing
end sub

Can someone tell me how to do this right?
Thanks

gangstah

3:28 pm on Jul 29, 2003 (gmt 0)

10+ Year Member



I've never really worked much with the .AddNew method in ADO (mostly DAO) but I wonder if it would be better just to do an INSERT SQL statement into the table with the browser, IP, etc., info? It'd take a lot less code.

Just a thought.