fix the structure of tracking code

@deanzaka 
Please check this out, will be merged soon.