Hi
I searched and tested a lot of these ready made scripts but was never satisfied with any of them.
For the moment, anyway, I really like this tool.
https://cookie.consent.is
You can connect you Google Analytics account for example, and more services, so the user can set those on or off as they like.
Best one yet