Fisrt you need to know what you consider drifting..
Then you need to set up conditions for when this is happening..
So I guess it would be something like:
Car is moving
Car speed is > 10
sytem compare two values car.angle is not the same as car.car.movingangle
add 1 to drift
But I'm not sure if these conditions are the ones you are aiming for..