Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-20-2003, 09:57 AM   PM User | #1
bostjank
Regular Coder

 
Join Date: Jul 2002
Location: The sunny side of the Alps
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
bostjank is an unknown quantity at this point
Retrieving data about most frequently visited page

Hi!

I have a database (MS Access) filled with data about web pages that were visited. How can I get the data about what page was most frequently visited - if possible without checking the number of visits on each page and than comparing those numbers.


Thanks,
Bostjan
bostjank is offline   Reply With Quote
Old 11-20-2003, 10:52 AM   PM User | #2
Spudhead
Senior Coder

 
Spudhead's Avatar
 
Join Date: Jun 2002
Location: London, UK
Posts: 1,856
Thanks: 8
Thanked 110 Times in 109 Posts
Spudhead is on a distinguished road
I'm a trifle lost. Your access database contains a record of hits logged on various .html pages, or your access database is functioning as a content repository with rows containing the html for individual 'pages' which is pulled in by some ASP?

And you want to know which number out of a group of numbers is highest, without comparing those numbers?? Umm, that's going to be awfully tricky.

I think I've missed something here.
Spudhead is offline   Reply With Quote
Old 11-20-2003, 11:03 AM   PM User | #3
bostjank
Regular Coder

 
Join Date: Jul 2002
Location: The sunny side of the Alps
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
bostjank is an unknown quantity at this point
My table looks like this
PHP Code:
PageName        Date       Time
================================
page1.asp       ...        ...
home.htm        ...        ...
back.htm        ...        ...
page1.asp       ...        ... 
In this example page named "page1.asp" was visited most frequenty. I was just wandering if there is a function I coud use to get the most frequent vaue in specific column.
bostjank is offline   Reply With Quote
Old 11-20-2003, 11:57 AM   PM User | #4
Roelf
Senior Coder

 
Join Date: Jun 2002
Location: Zwolle, The Netherlands
Posts: 1,110
Thanks: 2
Thanked 28 Times in 28 Posts
Roelf is on a distinguished road
select PageName, count(PageName) as hits group by PageName order by hits desc
Roelf is offline   Reply With Quote
Old 11-20-2003, 12:21 PM   PM User | #5
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
Just a thought:
do you realy need a record for each hit? can't you get that from a logfile and analyse it with some log-analyse-tool?

I always use one page-table where i store the pages title, description, keywords, css, creationtime, last udatetime and the number of hits. If a page is requested, i select the title etc to build the html-header and increment the countervariable. Then it's easy to instantly get the hits/page.

the select group by might take up some resources if you have some trafic over time (10 pages x 100 visitors a day x 100 days = 100k records ...)
raf is offline   Reply With Quote
Old 11-20-2003, 12:39 PM   PM User | #6
bostjank
Regular Coder

 
Join Date: Jul 2002
Location: The sunny side of the Alps
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
bostjank is an unknown quantity at this point
It could of course be analysed with log-analyser, but my boss doesn't want to do it that way - especialy because traffic analysis must include per-registered-user analysis.

Besides, the MDB file will be always downloaded to a local machine for analysis.
bostjank is offline   Reply With Quote
Old 11-20-2003, 01:07 PM   PM User | #7
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
if i were your boss, i would open access, go to querys, open new, hit querywizard and then choos crossab-wizard. You can there define what you need in the column-headers (pages?) and what you need in the rows (users) and what agregation you want in the fields (hits) and presto !

it's a jet-sql specific query that is used (something like transform + group by select + pivot). you could run through the wizard and afterwards look at the generated sql and use that inside your ASP-page (or simply use the access query as such.
raf is offline   Reply With Quote
Old 11-20-2003, 02:40 PM   PM User | #8
bostjank
Regular Coder

 
Join Date: Jul 2002
Location: The sunny side of the Alps
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
bostjank is an unknown quantity at this point
If I were my boss...
bostjank is offline   Reply With Quote
Old 11-22-2003, 02:43 AM   PM User | #9
M@rco
Regular Coder

 
Join Date: Oct 2003
Location: London, UK
Posts: 411
Thanks: 0
Thanked 1 Time in 1 Post
M@rco is an unknown quantity at this point
So what's the problem with Roelf's post? It's the textbook answer to your question!
__________________
Marcus Tucker / www / blog
Web Analyst Programmer / Voted SPF "ASP Guru"
M@rco is offline   Reply With Quote
Old 11-22-2003, 05:58 AM   PM User | #10
bostjank
Regular Coder

 
Join Date: Jul 2002
Location: The sunny side of the Alps
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
bostjank is an unknown quantity at this point
Roelf's post is perfect - it does exactly what I wanted.
bostjank is offline   Reply With Quote
Old 11-22-2003, 11:20 AM   PM User | #11
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
Quote:
Originally posted by M@rco
So what's the problem with Roelf's post? It's the textbook answer to your question!
It may be the perfect sollution for un unnecesary problem.

If you would frequently run this sort of query online, with a 'group by page' or ' group by page, user' on a intensely used site, then it would cause an unnescecary performance drop. Not the query as such, but the tablelocking which would prevent new inserts from being processed (aka requested pages to be fully processed and responded to).

If you run it offline, then there are better alternatives like generating the crosstab, which decimates you code to proces the returned recordset.

It's also reinventing the wheel and making your server doing double work since the logfiles can give you the same info (you only need to keep a session-table with 1 record with the IP number - UserID per session) Using the logs will be safer + will save you an insert in the page-table for each pagerequest.
raf is offline   Reply With Quote
Old 11-22-2003, 11:38 AM   PM User | #12
M@rco
Regular Coder

 
Join Date: Oct 2003
Location: London, UK
Posts: 411
Thanks: 0
Thanked 1 Time in 1 Post
M@rco is an unknown quantity at this point
I totally agree.

I was merely prompting bostjank to reply and acknowledge Roelf's post, since it seemed that it had gone unnoticed.

__________________
Marcus Tucker / www / blog
Web Analyst Programmer / Voted SPF "ASP Guru"
M@rco is offline   Reply With Quote
Old 11-22-2003, 12:04 PM   PM User | #13
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
I see

I suppose that the more experienced you are, the more sollutions you know to each problem, but the less problems you have to solve because you've learned to effectively use all build in features.
raf is offline   Reply With Quote
Old 11-22-2003, 12:31 PM   PM User | #14
M@rco
Regular Coder

 
Join Date: Oct 2003
Location: London, UK
Posts: 411
Thanks: 0
Thanked 1 Time in 1 Post
M@rco is an unknown quantity at this point
Absolutely.
__________________
Marcus Tucker / www / blog
Web Analyst Programmer / Voted SPF "ASP Guru"
M@rco is offline   Reply With Quote
Old 11-25-2003, 02:49 PM   PM User | #15
bostjank
Regular Coder

 
Join Date: Jul 2002
Location: The sunny side of the Alps
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
bostjank is an unknown quantity at this point
I do not agree with the "reinventing the whell..." - why would I (or our customers for whom the solution is intended) use (buy) specialized software for analyzing web logs is all we need for our purpose is to retrieve the name of most frequenty used page.

Especially becuase specialized software cannot operate with the retrieved value and use it in the functions our information already has implemented...

But once again - I'm very grateful for your help.

Bostjan
bostjank is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:53 PM.


Advertisement
Log in to turn off these ads.