Link to home
Start Free TrialLog in
Avatar of ericmey
ericmey

asked on

How to log a user leaving your website.

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
Avatar of Scott Bennett
Scott Bennett
Flag of United States of America image

I would make sure to use application.CFC, use session management, and put the logic into the onsessionEnd function.

Avatar of ericmey
ericmey

ASKER

That makes sense as far as a starting point. How would I then figure out where they are leaving to?
ASKER CERTIFIED SOLUTION
Avatar of Scott Bennett
Scott Bennett
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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!!!