What kind of gnats are they?
Fungus gnats are not as attracted to that as fruit flys.
I have tried cider, vinegar, etc. and found that red wine works best for friut flies.
Fungus gnats, that come from soil in potted plants are not very attrated to it, and they are harder to get rid of.
I had to get rid of all my house plants because I was infested with them.
I tried everything on the market to rid myself of the pests, and they do go away for a while, but they always came back!!
If they are fungus gnats, coming from your house plants, just put a 1/2'' layer of sand on top of each pot to cover the soil with it.
The gnats dont like it, and it will keep them away.