# How Artsy Preserved Cookie Preferences Beyond Safari's 7-Day Limit

DevFeed: [How Artsy Preserved Cookie Preferences Beyond Safari's 7-Day Limit](<https://devfeed.tech/articles/hacking-around-safari-s-7-day-cookie-limit-19161.md>)

Original publisher: [Read original article](<https://artsy.github.io/blog/2022/08/23/getting-around-7-day-cookie/>)

Published: 2022-08-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Artsy](<https://devfeed.tech/sources/artsy.md>)

Topics: [browser](<https://devfeed.tech/topics/browser.md>), [WebKit](<https://devfeed.tech/topics/webkit.md>), [User experience (UX)](<https://devfeed.tech/topics/ux.md>), [client](<https://devfeed.tech/topics/client.md>)

Tags: [apple](<https://devfeed.tech/tags/apple.md>), [browser](<https://devfeed.tech/tags/browser.md>), [ccpa](<https://devfeed.tech/tags/ccpa.md>), [cookies](<https://devfeed.tech/tags/cookies.md>), [gdpr](<https://devfeed.tech/tags/gdpr.md>), [privacy](<https://devfeed.tech/tags/privacy.md>), [safari](<https://devfeed.tech/tags/safari.md>), [server](<https://devfeed.tech/tags/server.md>), [ux](<https://devfeed.tech/tags/ux.md>), [wwdc](<https://devfeed.tech/tags/wwdc.md>)

## AI overview

This article explains how Artsy addressed Safari's seven-day limit on client-side cookies, which caused cookie-consent preferences to be repeatedly requested. It describes replacing the client-side cookie with a same-domain, secure, server-side cookie so the preferences persist beyond seven days.

## Source excerpt

Amongst the many, many things that organizations have to contend with around cookie consent laws is Apple's very own browser, Safari. Did you know that Safari will only retain a client-side cookie for 7 days? This is in support of Apple's Intelligent Tracking Prevention (ITP) feature, designed to protect a user's privacy. These privacy efforts are great but, in hand with laws like GDPR and CCPA, their rollout often creates a UX nightmare for users without some extra care. Here at Artsy, we've landed on a way to make things slightly less bad and want to share our approach. Scenario: Imagine that as a EU resident you visit artsy.net for the first time. A banner appears asking you to Accept or Deny tracking cookies from our site. You don't like tracking cookies, so you click the "Deny" button and the banner disappears. All good, right? Nope! You visit Artsy a week later and again, a banner appears asking you to choose your preferences. This happens again and again until you switch browsers and realize that what you were experiencing was Apple's ITP feature in action. After choosing your preferences, the cookie we use to store them is erased after 7 days, necessitating another interaction. We thrashed around in this vicious cycle for months until we found a simple, elegant solution thanks to a WebKit engineer's prompt (during Apple's open lab calls at WWDC - which you too can schedule!) She mentioned that the 7-day cookie limitation only applies to client-side cookies and that same-domain, secure, server-side cookies are not limited to these constraints. This got us thinking. Our third-party cookie consent management service sets a client-side cookie, not a server-side cookie. Could we perhaps overwrite the client-side cookie with a server-side cookie of the same name and trick Safari into persisting the user preferences beyond the 7-day limit? We gave it a try and... Yes. We. Can! And this means that you can too (and it's also real easy to implement). First, define an AP