It has to be the first post you did on a site. So if you've already left a question or answer on a site, you can't earn that hat for that site
It has to receive an upvote, so score >= 1. Not sure if you'd still get the hat if you got say 1 downvote and then 1 upvote. Probably not. Probably need score of >= 1 when the hat awarding script runs.