move tracking code into head