473,395 Members | 1,471 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,395 software developers and data experts.

How to Record hits to website

63
I set up an Access database with a text field to record the website name and a date field to record the date/time of the access. I have set up a page with various anchors set up to call up different websites. When the user clicks a particular anchor, I want to be able to record this information to the database. Is there an event which can be connected to the anchor and update the database?
Jun 10 '08 #1
2 1498
jeffstl
432 Expert 256MB
That depends.

Is the web page built in .asp or asp.net (.aspx)?

You would need to use an onclick event but the problem is that unless the site is built in asp.net the onclick event can only be captured in javascript on a regular HTML or .asp page.

The other option is if it is classic asp (.asp) you can instead have the link point to one of your own pages (say Process.asp) that is a redirect handler, and write out the counts before directing them.

So if you set up a series of links and assign them an code each of your links would start to look like this:

Process.asp?linkid=01
Process.asp?linkid=02

Then on the process page just do this

Expand|Select|Wrap|Line Numbers
  1.  
  2. 'Process.asp
  3. dim MyLinkCode
  4. MyLinkCode = request.querystring("linkid")
  5.  
  6. Select Case MyLinkCode 
  7.      Case "01"
  8.           'CNN.com
  9.           sql = "insert into MyTable (name,date) VALUES ('cnn.com',Date)"
  10.           dbconn.execute sql
  11.           'then you actually send them to the page
  12.          response.redirect("http://www.cnn.com")
  13.      Case "02"
  14.           'bytes.com
  15.           sql = "insert into MyTable (name,date) VALUES ('bytes.com',Date)"
  16.           dbconn.execute sql
  17.           'then you actually send them to the page
  18.          response.redirect("http://www.bytes.com") 
  19. End Select
  20.  
If you are in fact using asp.net for your pages you could do this a different way by using the asp.net link controls, and use the onclick event to capture the users click, rather then redirecting them.
Jun 11 '08 #2
rmurgia
63
I passed to an intermediate page, saved to the database, and then re-directed to the correct page. Thanks for the help.
Jun 24 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Lovely Angel For You | last post by:
Dear Friends Hope you all doing great. I made a website where I am able to record how many users are online right now at my website ysing Session_Variables. Now I want to record the date when...
1
by: Lukelrc | last post by:
Hi. I have a table (websitehits) which holds statistics about websites. This table has a date field (datecounted). What I need is to create a query which returns a list of dates between two date...
4
by: windandwaves | last post by:
Hi Folk I am making a website that is going to get lots of hits in one go (they will be doing lots of advertising). I am a bit scared the whole thing will fall over because it will get too many...
1
by: Ben | last post by:
I have a Tabular form bound to a table. The purpose of this form is to get times from a timer and record them in a field. The timer dumps the time automatically through a serial port. When the time...
1
by: Justin Koivisto | last post by:
I am trying to create a report that displays a name of an advertising source and count of the number of times it was hit between certain date ranges. The data is split between two different...
0
by: r_o | last post by:
hi i dunno if this is the right forum to post this , but i couldn't find any other alternative so here it goes i'm using MS index server on a winXP machine to deliver a small search engine for an...
6
by: fran7 | last post by:
Hi, Can anyone point me in the direction of some asp code to record the hits to all my internal links, not my site. I have 50 external links on one page and would like to know which of the these are...
2
by: gnawz | last post by:
Dear experts I need help on how to notify users in a website when some one else logs in or when a record has gone into the database. Something like a pop-up or sound beep can someone help?
1
by: cpdrews | last post by:
I currently have a User table in my database that has the columns: Username FirstName LastName Email LastActivityDate I created a page on the website in a DotNetNuke reports module where a...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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.