Moving analytics code into partial.