I have voted on a number of posts, both on main sites and on their per-site meta's. This has resulted in the Sufganiyot hat for the main sites, but not for the per-site metas.
From a discussion in the Tavern on the Meta, it seemed that one did not get the secret "Hairboat's revenge" hat for activities on a per-site meta, either.
A similar question was asked in 2013, but not answered.
So - does this mean that only activity on the main site will earn you hats?