move analytics code to head