fixing up analytics code