moved analytics code