updated analytics code