This plugin already has that functionality.I have a suggestion that you should add a parameter when tracking the target, set a threshold, and do not turn (or slowly turn to track) when you do not deviate from the target threshold, beyond which you can track the precise position of the target.
Try adjusting Dead Zone and Moving Factor.