Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    The sunny side of the Alps
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up How to detect if the user has navigated to a page via BACK button?

    Hi!

    Does any of you have any idea on how to detect if the user has navigated to a particular page via BACK button (one or more clicks)?

    I am particulary interested in real-time detection strategies. As far as post-processing is concerned I can detect some of the back button clicks by comparing LOG info about the referring page and the page that was viewed before that page, but this is obviously not a full-proof solution. Moreover, I have no means to get this information in real-time, i.e. when the user navigates to the page.

    I've been thinking about storing URLs of already visited pages in a cookie, but I'm not interested in knowing whether the page was viewed more than once in a session (cookie information would help in this case), but only if the user has used BACK button to navigate to it.

    Any ideas? Suggestions? Comments?

    Bostjan

  • #2
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The only way I can think of doing this is with a database log of where the user has been. If the back button is clicked then you will know that way. But this brings up the problem of if the user moved away from your site then hit the back button to return to your site how to handle that.

    What do you want a solution like this for? There might be other ways to handle the problem
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    The sunny side of the Alps
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I need this kind of solution because I try to analyze the user behaviour on my site and it is very useful to know whether the user intentionally clicked on a link to navigate to the page or if he clicked on a back button.

    What's your idea with DB log? Isn't that the same as storing information in a cookie (is, cookies are enabled of course ) - this solution ony gives information is the user has visited the page more than once, but doesn't give any insight into how he navigated to the page.

    I have so far come up with two solutions that could give reasonably accurate results when combined. The first one is based on a DOM "feature" causing the refferrer info to be incorrect when BACK button is used - consider the following example:

    Code:
    PAGE  |  NAVIGATION METHOD  |  REFERRER INFO  |  ACTUAL REFERRER
    ---------------------------------------------------------------------
    A        Entering URL                   
    B        Click on a link          A                   A
    C        Click on a link          B                   B
    D        Click on a link          C                   C
    C        Back button              B                   D
    B        Back button              A                   C
    A        Back Button                                  B
    This "feature" can actually be used for determining back button click, but is not full proof - for example, one cannot detect the back button in the following scenario: A click B click A back B.

    In this case the second solution comes into play - investigation the amount of time the user spent on a page - but it's still not full-proof.

  • #4
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think what you would have to do if you want to track all of this is go ahead and change every link on the site to hit a pass through page. Then you can assume the pass through page has been hit in every circumstance unless the back button has been pressed. I will think about it a bit more though. This is an ugly solution to the problem.
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Location
    The sunny side of the Alps
    Posts
    230
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the interesting idea. But as you said, it's an "ugly" solution


  •  

    Posting Permissions

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