relocated analytics code