Cookie expiration time per GDPR guidelines
<p>I am working on a task that requires to set cookie expiry date to Jan 2038. This cookie is used for showing personalized content to end user e.g. If user is on Home page and he clicks on Business Insurance page and then browse back to Home Page, he should see marquee specific to Business Insurance. </p>

<p>I came across an <a href="https://gdpr.eu/cookies/" rel="nofollow noreferrer">article</a> which states that persistent cookies should not last more than 12 months! </p>

<p>In my case - apart from tracking ‘specific’ pages visited by user I am not storing any personal data here. So does this rule applies to me? Am I free to extend expiry date till 2038 or restrict it for 12 months?</p>

<p>The GDPR has no hard limits on cookie duration. In fact, the GDPR does not mention cookies or similar technologies at all, aside from listing cookie identifiers as an example for “online identifiers” which is one kind of identifying data.</p>

<p>Per the GDPR, you (the Controller) must limit the collection of personal data to the minimum that is necessary to achieve the purpose for which the data is processed. Keeping data for over two decades is unnecessarily long, aside from the problem that cookies are stored on the user's device and devices just aren't used that long.</p>

<p>More interesting are the requirements that the ePrivacy Directive (ePD) places on you. Again, ePD does not explicitly restrict for how long cookies may be valid. The ePD considers cookies “information stored in the terminal equipment of a subscriber or user”. You can access information on the user's device only if:</p>

<ul>
<li>there are technical reasons that make storage access strictly necessary for showing the website, or</li>
<li>the user is provided with clear and comprehensive information about your use of cookies (compare GDPR Art 13), and the user can refuse the cookies. This generally means that you must obtain consent prior to setting or accessing cookies.</li>
</ul>

<p>An example for a strictly necessary cookie is a cookie that remembers the contents of a shopping cart, or a cookie that stores whether a site should be shown in dark mode. In the other case, the requirement to provide information and to obtain consent is the cause of all of these cookie banners.</p>

<p>The ePD has additional requirements that relate to marketing. For example, you may only process “traffic data” for marketing purposes</p>

<ul>
<li>for the duration that is necessary for the marketing, and</li>
<li>if the user has given consent</li>
</ul>

<p>Traffic data very likely includes data on which pages the user has visited.</p>

<hr>

<p>For you, the combined requirements of GDPR and ePD seem to be:</p>

<ul>
<li>you may only read or write this cookie if the user has given their consent</li>
<li>you must provide clear information about your use of cookies and what data you store</li>
<li>you may only store the cookie for as long as actually necessary

<ul>
<li>there is no hard limit of 12 months anywhere in the laws, but that sounds like a reasonable duration</li>
<li>multiple decades are unrealistically long</li>
</ul></li>
</ul>

gdpr