Counting Clicks

K

Keith

Just looking for some ideas here.

What is the best way to count how many times an image has been clicked?

I have an image gallery on a site and want to count how many times each
image has been clicked (clicking pulls up the full size image in a window)
so that I know which are popular and which are not.

I though about wimply adding an extra field to the database which serves up
the image details, and incrementing a number by 1 each time a user clicks it
just before the image is served up. What are the chances of this falling
over if two people were to click the same image at the same time?

Any other ideas much appreciated.
 
K

Keith

Steven Burn said:
You could always parse the server log's for the image's GET request?

I wanted something that I would be able to use in an admin section of the
site. So the admin people can log in and be able to see which pictures get
the most and which get the least hits.

Only automatic way I can think of is by updating the DBs.
 
S

Steven Burn

The DB is going to be the best way of doing it IMHO (just mentioned the site log's as an alternative)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

|
| > You could always parse the server log's for the image's GET request?
|
| I wanted something that I would be able to use in an admin section of the
| site. So the admin people can log in and be able to see which pictures get
| the most and which get the least hits.
|
| Only automatic way I can think of is by updating the DBs.
|
|
 
K

Keith

Steven Burn said:
The DB is going to be the best way of doing it IMHO (just mentioned the
site log's as an alternative)

Drifting very slightly. I would like to use this same idea on an intranet
at work I developed.

We have a number of PDF documents launched from HTTP links. They don't open
in a popup, simply open in Adobe.

How could I catch the click and count it to the DB before it launches the
URL?
 
S

Steven Burn

No problem

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

|
| > The DB is going to be the best way of doing it IMHO (just mentioned the
| > site log's as an alternative)
|
| Thanks. What I suspected.
|
|
 
K

Keith

Thanks

I might be being dumb here, but:

When I place that code in an ASP document, all it does is list the raw file
contents in the browser. How can I modify it so it actually processes the
file based on it's type (ie. for a JPG/GIF drawm the image, for a PDF launch
the plugin etc.).

Thanks
 
K

Keith

Figured it out. Thanks. I thought I was being dumb :)

How can I get this to work so that it doesn't need to be run as a new page?

Someone posted about using client-side script, but I'm faily new to ASP and
creating functions etc. is a little confusing to me right now.
 
K

Keith

Thank you

Curt_C said:
you cant with this method, it requires the headers to be modified, which
means new page. You could still do this in the same window though..... if
that's what you mean, but yes it will require another trip to the server
 
A

Adrienne

Drifting very slightly. I would like to use this same idea on an
intranet at work I developed.

We have a number of PDF documents launched from HTTP links. They don't
open in a popup, simply open in Adobe.

How could I catch the click and count it to the DB before it launches
the URL?

This is what I do:

<a href="rspdf.asp?id=123">Open 123 PDF</a>

In rspdf.asp I have something like

<%
dim id
id = request.querystring("id")

update = "update table set counter = counter + 1 where id = " & id
connectionstring.Execute update
response.redirect id & ".pdf"
%>

By the way, it's also a great way to count how many times someone has
clicked on an outside link, so you can go to the owner and say "Hey, I gave
you X amount of referrals"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top