Fix analytics code