moved analytics code to head