And are you going to display this consent-dialog on each page-fetch? Or maybe you are going to remember user choice using… cookies?
In my opinion forcing users to see and close those annoying boxes is far too much in case of most simple sites using Google Analytics. A footnote with info and link to GA opt-out is enough, according to GDPR (reasonable bussiness effort). But it’s just my opinion and a subject for another topic.
On websites that use Google Analytics only (and no ads, no Adwords, etc.) I have put this:
This website uses cookies via Google Analytics service to obtain statistical information about website visitors, traffic and usage. No data allowing to identify individual users is stored. More on this and how to opt-out: here.
I’ve read this and decided that generating a Privacy Policy or Cookies Policy for a simple website using GA only is too much. Any comments?