The consent bar is observed by the cookie-consent.js script and shown until the user clicks an opt-in button. The example above shows EU-compliant best practice with multiple buttons for different consent levels: "Necessary cookies only" (level 0) or "Accept all cookies" (level 80).
The example tracker.js script will output different messages to the console depending on the stored consent level. Open the browser console to see which tracking scripts would be activated based on your choice.
Check the HTML source to see alternative examples in the comments, including legacy "consent by continued usage" patterns and minimal configurations using fallback values.
The cookie consent repository is available at GitLab & GitHub (Mirror).
Demo page made with html5example.com.