It’s definitely a popular idea that’s out there already but difficult to search.
This one is pretty similar
Cookie Settings