Moved analytics code to an include file