Step 1: Latching Hall Switch?
A latching hall effect switch turns ON when it sees one pole of a magnet.
Pull the magnet away and it stays ON.
When it sees the other pole of the magnet, it turns OFF.
And stays OFF untill it sees the first pole again.
More info at:
Step 2: So What?
But a latch would give a nice square wave as the alternating magnet poles go by.
Less false switching and like that.
Step 3: But...
An RC filter at the counter helped some and it worked good enough for what I was doing. But shielded cable and a non-half-dead drill motor would be the way to go.
R1 is a pull up resistor.
R2 and C1 are a filter.
Sorry, I don't remember the values. Maybe start with 10k ohms and .01uF.