What's the best way to detect the magnet? Use anther magnet. But it's not sensitive enough, and you have to feel it by yourself. This magnetic sensor knows whether there is a magnetic object nearby or not, and it correctly tells you through a digital output.
Features
Wide voltage range from 3.3V to 5V
Standard assembling structure (Times-of-5mm Center distance between two 3mm mounting holes)
Easily recognitive interfaces of sensors ("A" for analog and "D" for digital)