Or they could use localStorage instead, which is a superior storage mechanism.
(source: I read the directive way back when it came out, and also skimmed large sectoins of GDPR)
Other sources: https://softwareengineering.stackexchange.com/questions/2905... and https://law.stackexchange.com/questions/30739/do-the-gdpr-an...