473,573 Members | 2,390 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.ServerV ariables("HTTP_ USER_AGENT")
visitreferer = Request.ServerV ariables("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="JavaS cript" 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 3075
Have a form with a hidden field, use your javascript to populate the hidden
field(s) then post the form.

"Jon" <jon@SPAM_OFFth eexperts.co.uk> wrote in message
news:bs******** **@sparta.btint ernet.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.ServerV ariables("HTTP_ USER_AGENT")
visitreferer = Request.ServerV ariables("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="JavaS cript" 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.ServerV ariables("HTTP_ USER_AGENT")
visitreferer = Request.ServerV ariables("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="JavaS cript" 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?wi dth='
+ 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.ServerV ariables("HTTP_ USER_AGENT")
visitreferer = Request.ServerV ariables("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="JavaS cript" 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="JavaS cript" type="text/javascript">
document.write( '<img alt="" src="log.asp?wi dth=' + screen.width +
'&height=' + screen.height + '" width="0" height="0">');
</script>

log.asp:

<%
dim conn, strsql, rsuser, strMDBPath
set conn=server.cre ateobject("ADOD B.Connection")
set rsuser=server.c reateobject("AD ODB.Recordset")
strMDBpath = Server.MapPath( "stats.mdb" )
conn.open "PROVIDER=MICRO SOFT.JET.OLEDB. 4.0;DATA SOURCE=" & strMDBPath

visitdate = date()
visittime = time()
visitbrowser = Request.ServerV ariables("HTTP_ USER_AGENT")
visitreferer = Request.ServerV ariables("HTTP_ REFERER")
if visitreferer = "" then
visitreferer = "None shown"
end if
visitscreenreso lution = request.QuerySt ring("width") & "x" &
request.QuerySt ring(+"height")

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

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
6295
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 sessions. It sounds quite straight-forward. But what I'm unsure about is- if the browser is set to accept cookies manually and the user blocks the...
3
1942
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 the logs every day on my computer in order to analyse the logs with an other program. Wich one would you suggest. My needs are:
5
7872
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 that 1) uses either a link or a small, discreet icon, rather than the butt-ugly counter that's there currently. I dont want an actual counter visible...
12
3024
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 itself. The called class has special functions for each class that can call it. With the visitor pattern, the calling class can have new...
9
4047
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" portions of Babe Ruth page (http://www.baseballprospectus.com/dt/ruthba01.shtml) and store that info in a CSV file. Also, I would like to do this for...
4
1496
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 your website? Remko
2
1722
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, hotshot.stats prof = hotshot.Profile("test.prof",lineevents=1) prof.start()
8
1434
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, length of time on each page, screen size, browser window size and IP address. I'm hoping that this session information is available via the .NET...
1
2086
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, (that most website counters display today), but a very cool additional piece of information I haven't found in any other webiste counter. It displays...
0
7747
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7670
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8180
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7740
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8036
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5263
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3706
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3703
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1269
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.