Added a bunch of analytics code.