{"id":8501,"date":"2026-08-12T06:02:00","date_gmt":"2026-08-12T04:02:00","guid":{"rendered":"https:\/\/www.lukaswojcik.com\/blog\/?p=8501"},"modified":"2026-10-24T03:17:09","modified_gmt":"2026-10-24T01:17:09","slug":"first-party-cookie-restoration-surviving-itp-with-cloudflare-workers","status":"publish","type":"post","link":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/","title":{"rendered":"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits"},"content":{"rendered":"<p>A Cloudflare Worker can set cookies through HTTP responses and forward measurement requests to a server container. This provides control over data paths and cookie attributes. It does not guarantee a bypass of Safari&#8217;s Intelligent Tracking Prevention (ITP), a fixed retention period or legal compliance.<\/p>\n<h2>What ITP actually limits<\/h2>\n<p>WebKit describes deletion of script-writable storage after seven days of Safari use without interaction with the website. This counts Safari usage days, not simply seven calendar days. Detected link decoration can impose a 24-hour limit on cookies created by JavaScript on the landing page. Not every URL parameter meets those detection conditions.<\/p>\n<p>HTTP cookies can also fall under a seven-day cap when WebKit detects third-party CNAME or IP cloaking. The specific relationship to the main page matters; CDN use alone is not the criterion. IP detection is heuristic and can change. A matching hostname or consent does not grant an exception from browser rules.<\/p>\n<p><code>Max-Age<\/code> specifies a requested lifetime. Browser limits, private sessions, cleanup and manual deletion can shorten actual storage. If a missing identifier causes the server to generate a new UUID, that creates a new identifier rather than restoring the previous identity.<\/p>\n<figure class=\"lw-diagram\"><img decoding=\"async\" src=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/diagrams\/dia-8501-itp-20261024.png\" alt=\"Permission, scoped cookies, explicit destination mapping and withdrawal; storage duration remains browser-controlled.\"\/><figcaption>Permission, scoped cookies, explicit destination mapping and withdrawal; storage duration remains browser-controlled.<\/figcaption><\/figure>\n<h2>Cookie attributes without false guarantees<\/h2>\n<table>\n<thead>\n<tr>\n<th>Attribute<\/th>\n<th>Effect and limit<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>HttpOnly<\/code><\/td>\n<td>Blocks direct JavaScript access to the cookie value. XSS can still perform actions in the page context; there is no ITP immunity.<\/td>\n<\/tr>\n<tr>\n<td><code>Secure<\/code><\/td>\n<td>Restricts cookie transmission to secure connections. The Worker-to-backend connection also needs suitable transport configuration.<\/td>\n<\/tr>\n<tr>\n<td><code>SameSite=Lax<\/code><\/td>\n<td>Controls sending on cross-site requests. It does not turn a vendor into the website&#8217;s own organization.<\/td>\n<\/tr>\n<tr>\n<td>No <code>Domain<\/code><\/td>\n<td>Creates a host-only cookie. A Domain attribute expands scope to matching subdomains and does not prevent CNAME detection.<\/td>\n<\/tr>\n<tr>\n<td><code>Path=\/<\/code><\/td>\n<td>Covers all paths on the matching host; a cookie path is not a reliable security boundary.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>An explicit cookie lifecycle<\/h2>\n<p>For an analytics identifier requiring consent, permission must be checked before creation and the associated processing. A freely supplied request parameter containing \u201cgranted\u201d is not reliable evidence of consent. The actual CMP integration needs to account for the current choice, purpose and withdrawal.<\/p>\n<ol>\n<li>A dedicated endpoint accepts only its intended request type and verified origin; state changes require suitable protection against externally induced calls.<\/li>\n<li>Without valid permission, no new analytics identifier is created. Withdrawal deletes the existing cookie with matching scope and stops further use.<\/li>\n<li>With permission, an existing valid value can be reused. A missing value leads to a fresh random identifier only when creation is allowed.<\/li>\n<li>The personalized response explicitly disables caching. Shared page caches must not reuse identifiers from visitor-specific responses.<\/li>\n<li>The server client and every destination tag need a documented mapping covering consent, missing identifiers and withdrawal.<\/li>\n<\/ol>\n<p>The following headers describe a new host-only cookie with an illustrative 30-day lifetime. The placeholder requires replacement with a securely generated random value. The example contains no CMP verification, endpoint or proxy implementation and is not a deployable Worker.<\/p>\n<pre class=\"wp-block-code\"><code>Cache-Control: private, no-store\nSet-Cookie: __Host-fp_id=RANDOM_IDENTIFIER; Max-Age=2592000; Path=\/; Secure; HttpOnly; SameSite=Lax<\/code><\/pre>\n<p>In supporting browsers, the <code>__Host-<\/code> prefix requires <code>Secure<\/code>, <code>Path=\/<\/code> and no <code>Domain<\/code>. Withdrawal on the same host uses:<\/p>\n<pre class=\"wp-block-code\"><code>Cache-Control: private, no-store\nSet-Cookie: __Host-fp_id=; Max-Age=0; Path=\/; Secure; HttpOnly; SameSite=Lax<\/code><\/pre>\n<p>Existing cookies with different names, domains or paths require their own matching deletions. The next request after withdrawal must not immediately create another identifier. Actual browser storage and outgoing requests provide stronger evidence than the deletion header alone.<\/p>\n<h2>The first request does not contain the new cookie<\/h2>\n<p>With forwarding through <code>fetch(request)<\/code>, the backend request is already underway before an added <code>Set-Cookie<\/code> response reaches the browser. A newly set response cookie therefore does not retroactively appear in the first backend request. The integration must explicitly handle that sequence rather than assume automatic mapping.<\/p>\n<p>A custom <code>fp_id<\/code> or <code>__Host-fp_id<\/code> is also not automatically a GA4 or Google Ads client ID. The responsible server client, destination schemas and effects on user and session counts need verification. A parallel identifier can change the existing identity model.<\/p>\n<h2>Google Tag Gateway is a separate component<\/h2>\n<p>Google Tag Gateway (GTG) serves Google scripts and measurement requests through configured paths on first-party web infrastructure. Cloudflare provides a dedicated integration; a custom cookie Worker is neither a prerequisite nor automatically part of that integration.<\/p>\n<p>GTG and an ssGTM container perform different jobs. A matching origin can allow connection reuse, but does not guarantee exactly the same IP across all requests or a particular latency. Forwarding and processing remain additional work. Google states that GTG processes Google first-party cookies and drops other forwarded first-party cookies. Enabling GTG alone therefore does not make a custom identifier available.<\/p>\n<h2>Handling an existing _ga cookie<\/h2>\n<p>Separate HTTP renewal of <code>_ga<\/code> requires verified coordination with the Google tag. The script must access this cookie, so <code>HttpOnly<\/code> is unsuitable for an ordinary script-read <code>_ga<\/code> configuration. Name, domain and path must match the existing cookie; otherwise multiple cookies can appear instead of a renewal.<\/p>\n<p><code>cookie_domain: 'auto'<\/code> and <code>cookie_update<\/code> affect Google tag behavior. <code>cookie_update: false<\/code> prevents ongoing tag-side renewal, but provides no ITP exception. Additional renewal must not override an earlier decision or deliberate deletion. Google&#8217;s documented default lifetime is also not a guaranteed browser lifetime.<\/p>\n<h2>Questions and answers<\/h2>\n<h3>Does a cookie automatically break Cloudflare caching?<\/h3>\n<p>No. The documented default cache key does not include all cookie values. Custom cache keys and bypass rules can consider cookies, while <code>Set-Cookie<\/code> responses separately affect cacheability. Ignoring a cookie is appropriate only when content and access rights are demonstrably independent of that cookie.<\/p>\n<h3>Does a cache MISS establish a cookie problem?<\/h3>\n<p>No. Empty or expired caches, cache rules and response headers also matter. Repeated requests and the effective configuration need assessment together.<\/p>\n<h3>Does a Cookie request header reveal the expiry date?<\/h3>\n<p>No. It contains names and values, not the original attributes such as Max-Age. A renewal window needs a separately defined timing mechanism; an existence check is insufficient.<\/p>\n<h3>What needs testing before deployment?<\/h3>\n<p>Acceptance, rejection, withdrawal, subsequent requests, the first request without an identifier, parallel requests, cookie scope and cache isolation belong in browser and integration tests. Tests need the actual Safari and Chrome versions and the concrete GTG\/ssGTM setup. No universal lifetime or compliance guarantee follows.<\/p>\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/webkit.org\/tracking-prevention\/\">Tracking Prevention in WebKit<\/a><\/li>\n<li><a href=\"https:\/\/webkit.org\/blog\/11338\/cname-cloaking-and-bounce-tracking-defense\/\">WebKit CNAME defense<\/a><\/li>\n<li><a href=\"https:\/\/webkit.org\/blog\/15697\/\">WebKit Private Browsing 2.0<\/a><\/li>\n<li><a href=\"https:\/\/webkit.org\/tracking-prevention-policy\/\">WebKit Tracking Prevention Policy<\/a><\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/cache\/concepts\/default-cache-behavior\/\">Cloudflare default cache behavior<\/a><\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/cache\/how-to\/cache-keys\/\">Cloudflare cache keys<\/a><\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/workers\/runtime-apis\/cache\/\">Cloudflare Workers Cache API<\/a><\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/google-tag-gateway\/\">Cloudflare Google Tag Gateway<\/a><\/li>\n<li><a href=\"https:\/\/support.google.com\/tagmanager\/answer\/16960855?hl=en-gb\">Google Tag Gateway cookie handling<\/a><\/li>\n<li><a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/server-side\/dependency-serving?option=sgtm\">Google first-party script serving<\/a><\/li>\n<li><a href=\"https:\/\/developers.google.com\/tag-platform\/security\/guides\/customize-cookies\">Google cookie configuration<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Reference\/Headers\/Set-Cookie\">MDN Set-Cookie<\/a><\/li>\n<li><a href=\"https:\/\/webkit.org\/blog\/10218\/full-third-party-cookie-blocking-and-more\/\">Full Third-Party Cookie Blocking (WebKit)<\/a><\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/workers\/\">Cloudflare Workers documentation<\/a><\/li>\n<li><a href=\"https:\/\/support.google.com\/analytics\/answer\/11397207\">Google Analytics: Cookie usage on websites<\/a><\/li>\n<li><a href=\"https:\/\/developer.chrome.com\/blog\/cookie-max-age-expires\">Chrome for Developers: Cookie Expires and Max-Age attributes now have upper limit<\/a><\/li>\n<li><a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc6265#section-5.3\">RFC 6265: HTTP State Management Mechanism, Section 5.3<\/a><\/li>\n<li><a href=\"https:\/\/eur-lex.europa.eu\/legal-content\/EN\/ALL\/?uri=CELEX:32002L0058\">Directive 2002\/58\/EC (ePrivacy Directive)<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>An architectural guide on overcoming Safari ITP 7-day cookie caps using true first-party edge routing, server-managed cookies, and Google Tag Gateway.<\/p>\n","protected":false},"author":1,"featured_media":23346,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[91147,91276,91285,91350,91061,91516],"class_list":["post-8501","post","type-post","status-publish","format-standard","hentry","category-digital-marketing","tag-cloudflare","tag-cookies","tag-first-party-data","tag-safari-itp","tag-server-side-gtm","tag-tracking"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits | Lukas Wojcik<\/title>\n<meta name=\"description\" content=\"First-party cookies with Cloudflare Workers and ssGTM: edge routing, server-managed IDs, consent withdrawal and CDN caching effects.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits | Lukas Wojcik\" \/>\n<meta property=\"og:description\" content=\"First-party cookies with Cloudflare Workers and ssGTM: edge routing, server-managed IDs, consent withdrawal and CDN caching effects.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/\" \/>\n<meta property=\"og:site_name\" content=\"Lukas Wojcik - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-12T04:02:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-10-24T01:17:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/09\/hero-8501-first-party-cookie-restoration-itp-c-g.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lukas Wojcik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lukas Wojcik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/\"},\"author\":{\"name\":\"Lukas Wojcik\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"headline\":\"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits\",\"datePublished\":\"2026-08-12T04:02:00+00:00\",\"dateModified\":\"2026-10-24T01:17:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/\"},\"wordCount\":1075,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/hero-8501-itp-20261024-dark.png\",\"keywords\":[\"Cloudflare\",\"Cookies\",\"First-Party Data\",\"Safari ITP\",\"Server-Side GTM\",\"Tracking\"],\"articleSection\":[\"Digital Marketing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/\",\"name\":\"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits | Lukas Wojcik\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/hero-8501-itp-20261024-dark.png\",\"datePublished\":\"2026-08-12T04:02:00+00:00\",\"dateModified\":\"2026-10-24T01:17:09+00:00\",\"description\":\"First-party cookies with Cloudflare Workers and ssGTM: edge routing, server-managed IDs, consent withdrawal and CDN caching effects.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/hero-8501-itp-20261024-dark.png\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/hero-8501-itp-20261024-dark.png\",\"width\":1200,\"height\":630,\"caption\":\"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-marketing\\\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\",\"name\":\"Lukas Wojcik - Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\",\"name\":\"Lukas Wojcik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"width\":424,\"height\":636,\"caption\":\"Lukas Wojcik\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\"},\"sameAs\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits | Lukas Wojcik","description":"First-party cookies with Cloudflare Workers and ssGTM: edge routing, server-managed IDs, consent withdrawal and CDN caching effects.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/","og_locale":"en_US","og_type":"article","og_title":"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits | Lukas Wojcik","og_description":"First-party cookies with Cloudflare Workers and ssGTM: edge routing, server-managed IDs, consent withdrawal and CDN caching effects.","og_url":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/","og_site_name":"Lukas Wojcik - Blog","article_published_time":"2026-08-12T04:02:00+00:00","article_modified_time":"2026-10-24T01:17:09+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/09\/hero-8501-first-party-cookie-restoration-itp-c-g.png","type":"image\/png"}],"author":"Lukas Wojcik","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Lukas Wojcik","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/#article","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/"},"author":{"name":"Lukas Wojcik","@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"headline":"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits","datePublished":"2026-08-12T04:02:00+00:00","dateModified":"2026-10-24T01:17:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/"},"wordCount":1075,"commentCount":0,"publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-8501-itp-20261024-dark.png","keywords":["Cloudflare","Cookies","First-Party Data","Safari ITP","Server-Side GTM","Tracking"],"articleSection":["Digital Marketing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/","url":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/","name":"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits | Lukas Wojcik","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/#primaryimage"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-8501-itp-20261024-dark.png","datePublished":"2026-08-12T04:02:00+00:00","dateModified":"2026-10-24T01:17:09+00:00","description":"First-party cookies with Cloudflare Workers and ssGTM: edge routing, server-managed IDs, consent withdrawal and CDN caching effects.","breadcrumb":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/#primaryimage","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-8501-itp-20261024-dark.png","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/10\/hero-8501-itp-20261024-dark.png","width":1200,"height":630,"caption":"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits"},{"@type":"BreadcrumbList","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-marketing\/first-party-cookie-restoration-surviving-itp-with-cloudflare-workers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lukaswojcik.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Server-Set Cookies with Cloudflare and ssGTM: Consent and ITP Limits"}]},{"@type":"WebSite","@id":"https:\/\/www.lukaswojcik.com\/blog\/#website","url":"https:\/\/www.lukaswojcik.com\/blog\/","name":"Lukas Wojcik - Blog","description":"","publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lukaswojcik.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9","name":"Lukas Wojcik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","width":424,"height":636,"caption":"Lukas Wojcik"},"logo":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg"},"sameAs":["https:\/\/www.lukaswojcik.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/8501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/comments?post=8501"}],"version-history":[{"count":7,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/8501\/revisions"}],"predecessor-version":[{"id":23348,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/8501\/revisions\/23348"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media\/23346"}],"wp:attachment":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media?parent=8501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/categories?post=8501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/tags?post=8501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}