move analytics to head section and create event on command type