tracking last page visted

I am trying to track visitors, who visits my website. I am using codeigniter for the development of the site. What i am interested in is to track the last visited page before they close the webpage. Is there anyways to do it?

What I have been thinking is to save their last visited page in session and then when they close save information in the database. What happens when user closes a browser or the website(tab in the browser) or when they click on the link (in the webpage) and is redirected to another website? does it send close connection request to the server?

What is the best way to keep track of it?

Also would like to mention the visitors are public and they cant login to the website. And also i am using google analytics but what to create a custom one for my website to get more accurate results.


Save/update a database entry on the current page they are loading. That way it doesn't even matter if their computer crashes it will still record the last page they were on. You could even restore them to the last place they were this way if they came back to the website later (if you needed this functionality).

Need Your Help

How to get real JPanel Size?

java swing size jpanel

How should I get real JPanel size in JFrame?

Can we map a array to another array in C, like mapping a file?

c memory-mapping

I have an array (1D), and other array of same size in different order (which will change according to the program situation) should also have the same value.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.