These knock sensors are great for sensing anything with a sharp impact, for example sensing a firm slap.
The sensors house a magnet attached to the end of a spring. When hit, the magnet swings around and the receiver on the other end of the container picks up the fluctuating magnetic field. This signal is amplified and sent to the Arduino.
The module comes preassembled with three pins: 5V, Signal, and Ground. Plug these into the respective pins on your board, and away you go!