Solved

How to log a user leaving your website.

Posted on 2007-11-26
6
754 Views
Last Modified: 2013-12-24
Is it possible to log a user leaving your website and which website they are navigating to?  I'm open to any suggestions.

Ideally this will be dynamic as the users will be able to create their own content and put href links in the copy.  I am either thinking of a parser that will reinterpret all the href tags into a server call that logs it or some type of IIS component that will do that automatically for me. The server code I am working with is ColdFusion but I will take examples in any language.

Thanks in advance.

-Eric
0
Comment
Question by:ericmey
  • 2
6 Comments
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 20353372
I would make sure to use application.CFC, use session management, and put the logic into the onsessionEnd function.

0
 

Author Comment

by:ericmey
ID: 20425215
That makes sense as far as a starting point. How would I then figure out where they are leaving to?
0
 
LVL 14

Accepted Solution

by:
Scott Bennett earned 500 total points
ID: 20425606
Sorry, I didn't really read your question thoroughly. You could log if a user clicks on a link from your site to an external site by generating the links so that the point to a "pass through" template that logs the url they navigated to and then uses cflocation to send them the the external site so your links would look like:

<a href="redirector.cfm?redirect=www.othersite.com">www.othersite.com</a>

and then in your redirector.cfm file you would have code that logs the value of the url.redirect variable then uses cflocation to send them to the url in url.redirect


OR if you want to do something more difficult you could do it by generating those links in such a way that there is an onclick event that sends the information back to your server via AJAX before redirecting them to the external site
0
 

Expert Comment

by:maherlia
ID: 21513911
I'm trying to do something similar, I'm trying to track how long users are on my site. I am successfully tracking their entry on to the site with some code in the Session_Start() event in the global.asax file. This is fine. Equivalent code in the Session_End() event to log their exit never runs. From what I've read the Session_End() event only fires if the session times out, it doesnt seem to fire if the user leaves the site and thus ends the session.

The site does not have a log off button where this code could go but even if it did, the user could just hit the top right close button to close IE and I'd need to be able to log that they had left in that way.

Any ideas? I'm stumped!!!



0

Featured Post

Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Configure IIS to process JSON 10 75
SSL sertificate 5 58
Http hosting redirect issue 2 39
listing all functions in JavaScript 19 180
First of all, clustering IIS is something you should rarely consider doing. In almost all cases, Microsoft Network Load Balancing (NLB) (http://technet.microsoft.com/en-us/library/cc758834(WS.10).aspx) is a much better solution when you need to p…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now