scipt to take stats of contact_state