edited analytics code