What it actually requires
The Spanish rule that governs here is Article 22.2 of the LSSI, and the standard for what counts as consent comes from the GDPR. Between them they ask three things: that the person knows what is going to be installed and why, that they accept it by a clear act, and that they can decline just as easily.
That is where the daily errors come from. A banner with "Accept" on a large button and "Reject" hidden behind "Settings" does not comply, because it is not equally easy. Loading analytics before the person presses anything does not comply, because you already installed it. And a pre-ticked box has not complied for years.
Technical cookies — the session, the basket, the chosen language, load balancing — need no consent. They are the ones required for what the user asked for to work.
The way out almost nobody mentions
The obligation does not arise from measuring: it arises from storing or reading information on the person’s device. If you use an analytics tool that installs no cookies and creates no persistent identifier, there is nothing to consent to and no banner is needed.
For a small business that is usually the better deal in every respect. You avoid the banner, which irritates people and hurts both speed and CLS. You avoid the compliance folder. And you measure better, because you do not lose everybody who declines — and plenty decline.
What you lose is remarketing and demographic reports. If your business does not live on paid advertising, you probably were not using them anyway.
If you genuinely need cookies
There are cases where you do: paid campaigns with conversion tracking, a third-party chat widget, embedded video from a platform. Then the banner is mandatory and it is worth getting right first time.
The minimum is: two equally visible buttons in the first layer, a second layer by category where some can be accepted and others declined, nothing loading before the decision, a record of what each person consented to and when, and a permanent link to change their mind.
And it is worth consulting the cookie guidance published by the Spanish data protection authority before accepting a plugin as sufficient: several of the most popular ones ship default settings that do not meet the Spanish criteria, even where they meet other countries’.