473,699 Members | 2,428 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 3082
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
6300
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 cookie, what happens? I think in that case, the counter is not incremented because the value is...
3
1955
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
8080
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 on the page if possible 2) uses valid code - the counter code is the only thing on the page that...
12
3034
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 operations added without being changed itself.
9
4058
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 numerous players whose IDs I have stored in a text file (e.g.: cobbty01, ruthba01, speaktr01, etc.)....
4
1499
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
1736
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
1437
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 framework. Can someone point me in the right direction please.
1
2093
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 the city where the visitor comes from. You can see the widget here. Well.. feedgit just changed...
0
8706
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8945
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8902
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7787
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5889
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3075
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2366
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.