# Cookie expiration dates and lifespan

Did you know that cookies have a lifespan, and that there are laws determining how long a cookie's life span is allowed to be?

Well, in that case here is a short rundown of the wheres and whats of cookie lifespans.

Cookies are, as you might know, small files stored on your computer when browsing the internet, designed to track your behaviour, choices, system info etc.

They do so for a predefined amount of time, before they expire. meaning that they stop tracking you. Many are simple session cookies that expire when the browsing session ends, but some can have lifespans that are much longer, which can mean, that the use of the cookie on your website could be non compliant.

### Why is it important to keep track of my cookies' expiration dates?

The short answer is, that to be compliant requires cookies to be active for a maximum of 365 days. Then you would need to collect new consent to make sure you are still allowed to collect the data.\
\
The big challenge with cookie lifespan is that many common cookie providers ignore this and in some cases we find cookies set to a life span of two, five or in some cases even ten years (effectively setting them "forever" as most users will change most of their devices at least once every decade).\
\
Unfortunately, as a website owner, it is your responsibility that you do not have any cookies with lifespans exceeding one year.

### So how do I change the lifespan of a cookie?

This depends on the cookie and the script that sets the cookie. \
&#x20;\
Unfortunately this varies immensely from cookie to cookie so we can't tell you how to do it on all cookies. \
\
We can however help you our with one of the most common ones. \
\
We currently have a guide for :\
[Google Analytics](https://docs.legalmonster.com/guides/cookie-expiration-dates-and-lifespan/changing-expiration-on-google-analytics-cookies)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openli.com/docs/cookie-consent-management/cookie-expiration-dates-and-lifespan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
