Bad sensor or bad gauge?

If the gauge drops when you unplug the sensor, it seems it would have to be a sensor issue.

It would stay at zero until I grounded the wire then it would jump to max.

Dumb question here but what is the correct way to wire the sender? It’s similar to this one but it has a black insulator instead of white.