Your sensor doesn't look like what I have.....so I think you need to give us more info as to exactly which sensor you bought.
As far as wiring, the following picture is how I wired mine:
The sensor need to be a 3 wire lead normally closed (NC) inductive proximity sensor with a minimum detection range of 8mm
Yours looks like a two wire sensor.....have no idea what it is.