updated function for analytics