My understanding for Google Analytics is that as long as you're not using the User ID feature (I can't imagine Hacker News would be), and you enable anonymisation of IP addresses, you don't need to get user consent as users' privacy is sufficiently protected.