Confessions of a Cookie Banner

Chocolate chip cookie with a bite taken out, next to a cookie consent box

Hi. I’m the cookie banner. You’ve seen me. Everyone has seen me. I’d like to apologise for a few things.

I arrive late

I load from a third-party script, which loads another script, which checks your country, which loads my styles. By the time I appear, you’ve already started reading. Then I show up and everything jumps. That jump has a name, by the way: layout shift. PageSpeed hates it. I’m a big contributor.

I’m heavier than I look

You’d think a box with two buttons would be small. Reader, I am not small. Some days, with all my scripts and translations, I weigh more than the article you came to read.

I sometimes break things

When my script fails to load, I don’t always fail gracefully. Sometimes I leave behind a JavaScript error in the console. Sometimes I block the page from scrolling, because I set overflow: hidden on the body and then never got the chance to remove it. Visitors think your whole site is broken. It’s just me. Lying invisibly on top of everything.

I’m trying to do better

  • Reserve space for me so I don’t push content around
  • Load me early, not last
  • Keep an eye on the console for errors I cause
  • Test me on a real phone, not just a big desktop monitor

Anyway. Accept all?

Comments

One response to “Confessions of a Cookie Banner”

  1. Luka Avatar
    Luka

    The invisible overflow hidden bug got us on a client site last month. Two days to find it.

Leave a Reply

Your email address will not be published. Required fields are marked *