moved event tracking to head