Counting Clicks

Discussion in 'ASP General' started by Keith, Feb 2, 2005.

  1. Keith

    Keith Guest

    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.
     
    Keith, Feb 2, 2005
    #1
    1. Advertising

  2. Keith

    Keith Guest

    "Steven Burn" <> wrote in message
    news:...
    > 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.
     
    Keith, Feb 2, 2005
    #2
    1. Advertising

  3. Keith

    Steven Burn Guest

    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!

    "Keith" <@.> wrote in message news:...
    | "Steven Burn" <> wrote in message
    | news:...
    | > 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.
    |
    |
     
    Steven Burn, Feb 2, 2005
    #3
  4. Keith

    Keith Guest

    "Steven Burn" <> wrote in message
    news:...
    > 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.
     
    Keith, Feb 2, 2005
    #4
  5. Keith

    Keith Guest

    "Steven Burn" <> wrote in message
    news:...
    > 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?
     
    Keith, Feb 2, 2005
    #5
  6. Keith

    Steven Burn Guest

    No problem

    --

    Regards

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

    Keeping it FREE!

    "Keith" <@.> wrote in message news:...
    | "Steven Burn" <> wrote in message
    | news:...
    | > 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.
    |
    |
     
    Steven Burn, Feb 2, 2005
    #6
  7. Keith

    Keith Guest

    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


    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:%239IP$%...
    > stream it to the client. This allows you to put in code to do whatever
    > http://www.darkfalz.com/1098
    >
    > --
    > Curt Christianson
    > Site & Scripts: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "Keith" <@.> wrote in message
    > news:...
    >> 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.
    >>

    >
    >
     
    Keith, Feb 2, 2005
    #7
  8. Keith

    Keith Guest

    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.

    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > you'll have to set the ContentType appropriately if you want the file to
    > "open"
    >
    > --
    > Curt Christianson
    > Site & Scripts: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "Keith" <@.> wrote in message
    > news:...
    >> 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
    >>
    >>
    >> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    >> news:%239IP$%...
    >>> stream it to the client. This allows you to put in code to do whatever
    >>> http://www.darkfalz.com/1098
    >>>
    >>> --
    >>> Curt Christianson
    >>> Site & Scripts: http://www.Darkfalz.com
    >>> Blog: http://blog.Darkfalz.com
    >>>
    >>>
    >>> "Keith" <@.> wrote in message
    >>> news:...
    >>>> 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.
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Keith, Feb 2, 2005
    #8
  9. Keith

    Keith Guest

    Thank you

    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > 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
    >
    > --
    > Curt Christianson
    > Site & Scripts: http://www.Darkfalz.com
    > Blog: http://blog.Darkfalz.com
    >
    >
    > "Keith" <@.> wrote in message
    > news:...
    >> 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.
    >>
    >> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    >> news:...
    >>> you'll have to set the ContentType appropriately if you want the file to
    >>> "open"
    >>>
    >>> --
    >>> Curt Christianson
    >>> Site & Scripts: http://www.Darkfalz.com
    >>> Blog: http://blog.Darkfalz.com
    >>>
    >>>
    >>> "Keith" <@.> wrote in message
    >>> news:...
    >>>> 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
    >>>>
    >>>>
    >>>> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    >>>> news:%239IP$%...
    >>>>> stream it to the client. This allows you to put in code to do whatever
    >>>>> http://www.darkfalz.com/1098
    >>>>>
    >>>>> --
    >>>>> Curt Christianson
    >>>>> Site & Scripts: http://www.Darkfalz.com
    >>>>> Blog: http://blog.Darkfalz.com
    >>>>>
    >>>>>
    >>>>> "Keith" <@.> wrote in message
    >>>>> news:...
    >>>>>> 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.
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    Keith, Feb 2, 2005
    #9
  10. Keith

    Adrienne Guest

    Gazing into my crystal ball I observed "Keith" <@.> writing in
    news::

    > "Steven Burn" <> wrote in message
    > news:...
    >> 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?
    >
    >


    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"

    --
    Adrienne Boswell
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
     
    Adrienne, Feb 2, 2005
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    1
    Views:
    423
    Michael Pearson
    Oct 30, 2003
  2. Mannie
    Replies:
    7
    Views:
    741
    Harlan Messinger
    Mar 12, 2008
  3. PontiMax

    Clicks and double-clicks

    PontiMax, Jul 14, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    198
    Eliyahu Goldin
    Jul 14, 2004
  4. Bart

    Counting Clicks

    Bart, Jan 11, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    6
    Views:
    141
  5. edwardfredriks

    counting up instead of counting down

    edwardfredriks, Sep 6, 2005, in forum: Javascript
    Replies:
    6
    Views:
    225
    Dr John Stockton
    Sep 7, 2005
Loading...

Share This Page