Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2003
    Posts
    454

    Unanswered: how to collect the number

    I need to collect the number of the users who click on the banner on which there is a link, i.e.,

    <a href="http://www.clientwebsite.com" target="_BLANK">
    <img src="http://www.clientwebsite.com/images/banner.gif">
    </a>

    Please help.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    So basically you are talking about an onclick event that triggers a http post to yur system (to record the click) and then allows the link to function as normal yes??

    Why don't you make the link reference a page on your side that records the click and then redirects to the actual link location/target?

  3. #3
    Join Date
    Dec 2003
    Posts
    454
    The client's banner is placed on our web pages. We need to know the number of clicks on the banner per month. I did the following way:

    <SCRIPT language="JavaScript">
    <!--
    function saveClickNumber() {
    <% Application("ClickNumber") = Application("ClickNumber") + 1 %>
    }
    //-->
    </SCRIPT>

    <a href="http://www.clientwebsite.com" target="_BLANK" onclick="javascript:saveClickNumber()">
    <img src="http://www.clientwebsite.com/images/banner.gif">
    </a>

    But the question is when you refresh the page, the Application("ClickNumber") will be incremented by 2. I do not know how to do it correctly.

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    err,.. with what you have done you are not recording the number of clicks you are recording the number of displays.....

    Your trying to mix your client side scripts with your sever side scripts and that just doesn't really work...

  5. #5
    Join Date
    Dec 2003
    Posts
    454
    Any good idea? Thanks.

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    The way it is normally done is something like this....

    Page1 - displays whatever it is meant to as well as the banner. Clicking the banner links to page 2

    Page2 - records the web click and redirects to the proper location for the banner

    So your link becomes something like...

    <a href="http://www.mywebsite.com/redirect.asp?loc=www.clientwebsite.com" target="_BLANK" >
    <img src="http://www.clientwebsite.com/images/banner.gif">
    </a>

    In redirect.asp you have something like...

    Application("BannerCount") = Application("BannerCount") + 1
    Redirect("http://" & Request.QueryString("loc"))

    Would that fit in with your solution requirements??

  7. #7
    Join Date
    Dec 2003
    Posts
    454
    Yes, it works. Thanks.

  8. #8
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    No problems. You might have an issue with spaces in urls and escaping characters if you are trying to go to a specific page within a site instead of the default page, but can can get around all that with a few refinements to the general idea.

  9. #9
    Join Date
    Dec 2003
    Posts
    454
    I used Server.URLEnCode(url) instead of url. And also in redirect.asp page, I put IF statement to check the querystring in case someone hits the redirect.asp page.

    Thank you again.

  10. #10
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    that should cover most of it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •