move tracking code to the recommended place