I think that is an Omron 2-wire proximity switch. I doubt wiring it to an analog input will do anything but put 12v to the input. You might get it to work if you wire it to gnd through a resistor or two. This link talks about wiring that type of sensor to an arduino:
http://forum.arduino.cc/index.php?topic=149367.0 Something similiar should work. Using a DIO pin instead of an analog pin is probably more appropriate.
The are lots of posts here about wiring 3-wire NPN proximity switches to DIO pins.