move analytics code