When I've knit scarf sets to give as gifts I usually sew one of those labels inside the ribbed bottom of the hat. Whether or not this is the best way to do it I don't know, but all I do is tack the four corners down with everyday sewing thread. Just keep in mind, (if you're putting your label on the inside of a hat ribbing), that the ribbing will be stretched when worn, so allow some slack in the label.
My labels are white so sometimes I use white thread even though the yarn is dark. I don't sew all the way through to the outside. Just catch enough yarn on the inside to hold the label in place.
Someone else might have a better way of doing it. This seems to be working for me. Jeanie