Improve analytics code.