473,394 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Visitor Stats

Jon
Hi,

I'm writing a VERY BASIC stats databse for the default page of my web site.
I'm detecting various stats and saving them:

<%
visitdate = date()
visittime = time()
visitbrowser = Request.ServerVariables("HTTP_USER_AGENT")
visitreferer = Request.ServerVariables("HTTP_REFERER")
' code here for screen size
' code here to save to database
%>

I wish to also get screen resolution/size. I realise this is client side so
I can use:

<script language="JavaScript" type="text/javascript">
<!--
var screenW = screen.width
var screenH = screen.height
document.write(screenW + "x" + screenH)
//-->
</script>
But I can't save that into my database!!

Has anyone solved this problem before?

Thanks

Jon
Jul 19 '05 #1
4 3067
Have a form with a hidden field, use your javascript to populate the hidden
field(s) then post the form.

"Jon" <jon@SPAM_OFFtheexperts.co.uk> wrote in message
news:bs**********@sparta.btinternet.com...
Hi,

I'm writing a VERY BASIC stats databse for the default page of my web site. I'm detecting various stats and saving them:

<%
visitdate = date()
visittime = time()
visitbrowser = Request.ServerVariables("HTTP_USER_AGENT")
visitreferer = Request.ServerVariables("HTTP_REFERER")
' code here for screen size
' code here to save to database
%>

I wish to also get screen resolution/size. I realise this is client side so I can use:

<script language="JavaScript" type="text/javascript">
<!--
var screenW = screen.width
var screenH = screen.height
document.write(screenW + "x" + screenH)
//-->
</script>
But I can't save that into my database!!

Has anyone solved this problem before?

Thanks

Jon

Jul 19 '05 #2


Jon wrote:
Hi,

I'm writing a VERY BASIC stats databse for the default page of my web site.
I'm detecting various stats and saving them:

<%
visitdate = date()
visittime = time()
visitbrowser = Request.ServerVariables("HTTP_USER_AGENT")
visitreferer = Request.ServerVariables("HTTP_REFERER")
' code here for screen size
' code here to save to database
%>

I wish to also get screen resolution/size. I realise this is client side so
I can use:

<script language="JavaScript" type="text/javascript">
<!--
var screenW = screen.width
var screenH = screen.height
document.write(screenW + "x" + screenH)
//-->
</script>
But I can't save that into my database!!


You can try
<script type="text/javascript">
document.write('<img alt="" src="log.asp?width='
+ screen.width
+ '&height=' + screen.height
+ '" width="0" height="0">');
</script>
then in log.asp you store those values from the query string.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 19 '05 #3
Jon
> Have a form with a hidden field, use your javascript to populate the
hidden
field(s) then post the form.
Hi,

I'm writing a VERY BASIC stats databse for the default page of my web

site.
I'm detecting various stats and saving them:

<%
visitdate = date()
visittime = time()
visitbrowser = Request.ServerVariables("HTTP_USER_AGENT")
visitreferer = Request.ServerVariables("HTTP_REFERER")
' code here for screen size
' code here to save to database
%>

I wish to also get screen resolution/size. I realise this is client side

so
I can use:

<script language="JavaScript" type="text/javascript">
<!--
var screenW = screen.width
var screenH = screen.height
document.write(screenW + "x" + screenH)
//-->
</script>
But I can't save that into my database!!

Has anyone solved this problem before?

Thanks

Jon


When I considered the form idea I figured the problem is that it needs
posting, that is it won't work as the visitor goes to the page.

I'm going to have a try with Martins idea. I considered at the 'top' of the
page write the info to a cookie using javascript, at the 'end' of the page
retrieving this information using vbscript for my database?!

Jon
Jul 19 '05 #4
Jon
Sorted, thanks Martin.

The result:

index.htm or whatever:

<script language="JavaScript" type="text/javascript">
document.write('<img alt="" src="log.asp?width=' + screen.width +
'&height=' + screen.height + '" width="0" height="0">');
</script>

log.asp:

<%
dim conn, strsql, rsuser, strMDBPath
set conn=server.createobject("ADODB.Connection")
set rsuser=server.createobject("ADODB.Recordset")
strMDBpath = Server.MapPath("stats.mdb")
conn.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & strMDBPath

visitdate = date()
visittime = time()
visitbrowser = Request.ServerVariables("HTTP_USER_AGENT")
visitreferer = Request.ServerVariables("HTTP_REFERER")
if visitreferer = "" then
visitreferer = "None shown"
end if
visitscreenresolution = request.QueryString("width") & "x" &
request.QueryString(+"height")

sql="INSERT INTO tblVisitors (visitdate, visittime, visitbrowser,
visitreferer, visitscreenresolution) VALUES ('" & visitdate & "', '" &
visittime & "', '" & visitbrowser & "', '" & visitreferer & "', '" &
visitscreenresolution & "');"

conn.Execute sql

conn.close
set rsuser=nothing
set conn=nothing
%>

Almost worthy of an FAQ ?????

Jon
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ben | last post by:
Hi all, This has been asked in the past in different ways. I'm still a bit confused about setting up counters. I'm quite new to php. I've read few tutorials about writing counters using cookie and...
3
by: Bob Bedford | last post by:
My ISP is using webalyser 2.01 to show statistics on my site. As this may be sufficient for many webmasters, It doesn't fit my needs, as it doesn't have enough informations. I'm downloading...
5
by: Peter Jenkins | last post by:
The client for which I do this site www.safenz.org.nz wants stats tracking/a visitor counter, like the one that is there at the moment (at the bottom of the home page). However I would like one...
12
by: FluffyCat | last post by:
New on November 28, 2005 for www.FluffyCat.com PHP 5 Design Pattern Examples - the Visitor Pattern. In the Visitor pattern, one class calls a function in another class and passes an instance of...
9
by: ankitdesai | last post by:
I would like to parse a couple of tables within an individual player's SHTML page. For example, I would like to get the "Actual Pitching Statistics" and the "Translated Pitching Statistics"...
4
by: botenremko | last post by:
Hi! Why can't I see the website statistics of many sites? Why don't they have a counter on their pages that are visible to anyone? What are pros and cons to publish online real time stats on...
2
by: Monu | last post by:
HI All, I am getting problem in using hotshot profiler. When I hotshot with lineevents=0, it works fine, but when I use lineevents=1, I get error in stats here is my code: import hotshot,...
8
by: Spence | last post by:
My web site is built using ASP.NET, the host supporting .NET 3.5, SQL Server Express and Access. I want to start collecting some visitor stats, in particular OS and Browser used, pages visited,...
1
by: virtualweb | last post by:
Hello: I found a very nice Website Stats widget which I copy pasted into my site. What I like about this widget is that not only tells you which URL, country, date, time, IP, refrerrer, etc,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.