fixed ajax and analytics
added session to analytics and error checking