HTTP referrer for exit traffic?

8 replies
I know that an HTTP referrer will "tell" the webpage that sent the traffic to the site. I have seen it utilized in a WordPress plugins like the WordPress Greetbox. Which takes the HTTP referrer and displays a message to the user based on where they came from.

QUESTION: So, is there any way for the site to "know" what webpage URL the user exited the page? I need to capture the "exit URL" like the HTTP referrer captures the "entry URL" and use the exit URL in a WordPress plugin im developing. OR is there an easy way to capture exit traffic on a page by page basis without employing a full fledged traffic analytic program.

Any help?
#exit #http #referrer #traffic
  • Profile picture of the author wayfarer
    JavaScript has an event called onunload. If a user causes an onunload then does not come back, they have left. CodeToad - Javascript onUnload Event Handler.

    However, this event does not indicate whether a user simply left to go to another page of the site. So you would need to override your statistics to account for internal links being clicked on.

    You're better off just using an analytics program, since that is what you'd be creating.
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[1642243].message }}
  • Profile picture of the author Mike Adams
    Yea... but I need an exit URL to be returned.
    Signature
    P.S. If you found my post useful, please click the "Thanks" button below...
    {{ DiscussionBoard.errors[1642321].message }}
    • Profile picture of the author wayfarer
      Originally Posted by Mike Adams View Post

      Yea... but I need an exit URL to be returned.
      HTML Code:
      <script type="text/javascript">
      window.onunload = function() {
          var exitUrl = window.location.href;
      }
      </script>
      So you see, this is not a problem. However, the overall problem is more complicated, so you'll need to spend some time working it all out, or else hire a specialist.

      The basic idea would be to record the exit URL onunload by default, then pass an event to every INTERNAL link on your site. If one of these links is clicked, it will change a variable that causes the default behavior of the onunload event not to happen.

      Unfortunately, a reload is also an onunload event, which would cause the URL to be recorded in the above situation. So what you'll need to do is record the user's IP address also, and if the same page is viewed within a certain amount of time by any given IP, the last record associated with that IP would be dropped.

      If it was possible for there to be an HTTP HEADER for page exit there probably would be, but headers are only sent before content is loaded, not afterward.
      Signature
      I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
      {{ DiscussionBoard.errors[1645548].message }}
  • Profile picture of the author khtm
    The only way I can think of (other than using an analytic app) is to use logic similar to the GoCodes WP plugin, where every "exit link" actually passes through a tracking module (GoCodes just does a redirect), which could be very simple, just a few lines of code.
    {{ DiscussionBoard.errors[1642342].message }}
  • Profile picture of the author m4rx
    If your using Wordpress, you could just use a modded version of "Link Cloaking Plugin".

    You could make a table that stores what link the person clicked, and how many times the link was clicked. Or if you want each person's click, you could do something like
    ip link_name time real_link
    as your table, or whatever works with you.

    If you need any help, here I am.

    --m4rx
    Signature
    We are what we repeatedly do. Excellence, then, is not an act, but a HABIT. ~Aristotle
    Bored. Learn everything you need to know about Organic Gardening.
    {{ DiscussionBoard.errors[1642384].message }}
    • Profile picture of the author Mike Adams
      Originally Posted by m4rx View Post

      If your using Wordpress, you could just use a modded version of "Link Cloaking Plugin".

      You could make a table that stores what link the person clicked, and how many times the link was clicked. Or if you want each person's click, you could do something like
      ip link_name time real_link
      as your table, or whatever works with you.

      If you need any help, here I am.

      --m4rx
      this is what im looking for. thanks
      Signature
      P.S. If you found my post useful, please click the "Thanks" button below...
      {{ DiscussionBoard.errors[1648130].message }}
  • Profile picture of the author saschakimmel
    The problem is that if the onUnload method is called you cannot cancel it. So just after your JavaScript code has finished the next page will be loaded anyways.
    Signature

    ** Get my ViralListMachine software now for free and build your own list virally by giving away free stuff @ http://www.virallistmachinegiveaway.com **

    {{ DiscussionBoard.errors[1647890].message }}
    • Profile picture of the author wayfarer
      Originally Posted by saschakimmel View Post

      The problem is that if the onUnload method is called you cannot cancel it. So just after your JavaScript code has finished the next page will be loaded anyways.
      Why would you want or need to cancel it?
      Signature
      I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
      {{ DiscussionBoard.errors[1649180].message }}

Trending Topics