Cookie Life Extension

Extend Safari Cookies
from 7 days to 400 days

Safari's ITP wipes tracking cookies after 7 days. With PixelFly Cookie Life Extension, your customers are correctly identified for up to 400 days — no attribution loss.

Why Safari Breaks Your Tracking

Safari has strict rules about how long cookies can live. Most businesses lose 30–40% of their attribution because of this.

7 days
JavaScript Cookies

Meta Pixel, Google Tag, and any script using document.cookie — all capped at 7 days by Safari ITP.

1 day
After Ad Clicks

When users arrive from a URL with ?fbclid= or ?gclid=, Safari reduces the cap to just 24 hours.

~40%
Safari Users Affected

Safari is used by ~40% of mobile users worldwide. Every returning visitor after 7 days is seen as a brand-new unknown user.

WITHOUT Cookie Life Extension
Day 1 User clicks your Facebook ad → _fbp cookie set (expires Day 8)
Day 8 Safari deletes the cookie. User returns — looks like a brand-new visitor
Day 10 User purchases → NO attribution to original ad. ROAS appears lower than reality.
WITH Cookie Life Extension (400 days)
Day 1 User clicks ad → _fbp cookie set → PixelFly extends it to 400 days via HTTP header
Day 30 User returns → Cookie still alive → Correctly identified as the same person
Day 35 User purchases → Correctly attributed to the ad click on Day 1. Accurate ROAS.

Why Standard Setups Still Fail

Since Safari 16.4 (April 2023), even server-set cookies get the 7-day cap if the tracking server has a different IP than your website. Here's the key rule:

Safari's Two Rules for a Long-Life Cookie

1
Set via HTTP header
Cookie must come from a server Set-Cookie response header — not JavaScript document.cookie
2
Same IP range as your website
The tracking server's IP must match the first two numbers of your website's IP (e.g. both must be on 104.16.x.x)
Result: If your tracking subdomain is on Google Cloud but your website is on Cloudflare — different IPs — Safari still caps cookies at 7 days even with server-set cookies.
Way 1 — Most Reliable

Same-Origin Proxy

Route PixelFly tracking through a path on your own domain (e.g. store.com/pf/) instead of a subdomain. Same origin = no IP mismatch = full 400 days.

Guaranteed 400 days on Safari
No IP matching issues ever
Recommended by Google
Requires Cloudflare or Nginx reverse proxy config
Complexity: Medium  |  Extra cost: $0
Way 2 — Easiest

Own CDN (Cloudflare Proxy)

If your website is already behind Cloudflare, route your PixelFly custom subdomain through the same Cloudflare account. Both domains will share the same Cloudflare IP range — Safari sees matching IPs.

Up to 400 days on Safari
Only 3 DNS settings to change
No code changes needed
Requires website to be on Cloudflare
Complexity: Easy  |  Extra cost: $0
Way 3 — When you cannot do 1 or 2

Cookie Keeper (WooCommerce)

Safari may still delete _fbp after 7 days. Cookie Keeper remembers the visitor with a master cookie set by your shop PHP, stores the marketing cookies in PixelFly, and restores them on the next visit — also via shop PHP so Safari treats them as first-party.

Works without Cloudflare / reverse proxy
Off by default — no effect until you enable it
Requires PixelFly WooCommerce plugin v1.3+
Prefer Way 1 or 2 when possible
Complexity: Easy (plugin)  |  Extra cost: $0
  1. PixelFly Dashboard → Container → Edit → enable Cookie Keeper (Way 3) → Save (KV sync).
  2. WooCommerce → PixelFly → Advanced → enable Cookie Keeper → Save.
  3. Visit the shop in Safari: after a page view you should see _pf_mid. After Meta Pixel runs, _fbp is stored. On a later visit with _fbp cleared, it is restored from the shop.

Step-by-Step Setup Guides

Choose the method that matches your website's infrastructure.

2

Way 2 — Own CDN (Cloudflare Proxy)

Best for: websites already behind Cloudflare

How it works in plain English

Your website (e.g. store.com) is behind Cloudflare, so its public IP is a Cloudflare IP like 104.16.x.x. If your PixelFly tracking subdomain (t.store.com) is also proxied through the same Cloudflare account, it will also get a Cloudflare IP. Safari sees matching IPs → treats the cookie as genuinely first-party → allows up to 400 days.

1

Confirm your website is behind Cloudflare

Go to Cloudflare Dashboard → your domain → DNS. Your root domain (store.com or www) should have the orange cloud icon (Proxied).

If the cloud is grey (DNS only), click it to make it orange. This routes traffic through Cloudflare and gives your domain a Cloudflare IP.
2

Set up your PixelFly custom domain (if not already done)

In PixelFly Dashboard → Container → Settings → Custom Domain, add a subdomain like t.store.com. Copy the CNAME target shown.

3

Add DNS record with Proxy enabled (orange cloud)

In Cloudflare DNS for your domain, add:

Type Name Target (value) Proxy
CNAME t track.pixelfly.io 🟠 Proxied
Critical: The proxy toggle must be orange (Proxied), not grey. This is the key step — it makes both your website and tracking subdomain share the same Cloudflare IP range.
4

Enable Cookie Life Extension in PixelFly

Go to PixelFly Dashboard → Container → Settings → Cookie Life Extension and toggle it on. Click Save. That's it — cookies on your tracking responses will now be set with a 400-day max-age.

5

Verify it works

On your website, open Safari → Developer Tools → Storage → Cookies. After a page view, check the expiry of _fbp and _ga. They should show ~400 days from today, not 7.

Quick test: Check the IP of store.com and t.store.com using MXToolbox. The first two numbers of both IPs must match (e.g. both show 104.16).

1

Way 1 — Same-Origin Proxy

Best for: any website (especially if not on Cloudflare)

How it works in plain English

Instead of routing tracking to t.store.com (a subdomain), you create a path on your own website like store.com/pf/. Since both the website and the tracking path are under the same domain and IP, Safari sees them as identical — no IP check needed. Cookies live the full 400 days.

Option A Via Cloudflare Worker (recommended if on Cloudflare)

1
Create a Cloudflare Worker with this code

In Cloudflare Dashboard → Workers & Pages → Create Worker, paste this code:

// Cloudflare Worker — PixelFly Same-Origin Proxy
// Deploy this to your domain: store.com/pf/*

export default {
  async fetch(request) {
    const url = new URL(request.url);

    // Only proxy requests under /pf/
    if (!url.pathname.startsWith('/pf/')) {
      return new Response('Not found', { status: 404 });
    }

    // Forward to PixelFly, keeping the path after /pf/
    const targetPath = url.pathname.replace('/pf', '');
    const targetUrl = 'https://track.pixelfly.io' + targetPath + url.search;

    const proxyRequest = new Request(targetUrl, {
      method: request.method,
      headers: request.headers,
      body: request.body,
      redirect: 'follow',
    });

    const response = await fetch(proxyRequest);

    // Pass response back to browser — including Set-Cookie headers
    return new Response(response.body, {
      status: response.status,
      headers: response.headers,
    });
  }
};
2
Add a Route to your domain

In Cloudflare Dashboard → Workers & Pages → your worker → Settings → Triggers → Add Route:

Route: store.com/pf/*
Zone: store.com
3
Update your GTM tag endpoint

In your PixelFly GTM tag, change the tracking URL from:

https://t.store.com/e
https://store.com/pf/e
4
Enable Cookie Life Extension in PixelFly

Go to PixelFly Dashboard → Container → Settings → Cookie Life Extension and toggle it on.

Option B Via Nginx (if your website runs on a VPS/server)

1
Add a location block to your Nginx config

In your Nginx site config (usually at /etc/nginx/sites-available/store.com), inside the server block, add:

# PixelFly Same-Origin Proxy
location /pf/ {
    proxy_pass https://track.pixelfly.io/;
    proxy_ssl_server_name on;
    proxy_set_header Host track.pixelfly.io;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    # Pass Set-Cookie headers from PixelFly back to browser
    proxy_pass_header Set-Cookie;
    proxy_cookie_domain track.pixelfly.io $host;
}
2
Reload Nginx
sudo nginx -t && sudo nginx -s reload
3
Update GTM tag and enable Cookie Life Extension

Change the tracking URL in GTM to https://store.com/pf/e. Then enable Cookie Life Extension in the PixelFly dashboard.

Cookie Lifetime Comparison

How long user attribution survives — by setup type

Setup Chrome / Firefox Safari (with ITP) Notes
Meta Pixel only (JS) 90 days 7 days / 1 day 1 day if visitor came via ad click
Server-side (CNAME subdomain, no IP match) 400 days 7 days Safari 16.4+ detects IP mismatch
Stape Cookie Keeper (restore after deletion) 400 days ~90 days Meta / ~13 months GA Workaround, not a true fix
PixelFly + Way 2 (Own CDN / Cloudflare) Recommended 400 days 400 days IP matches via Cloudflare proxy
PixelFly + Way 1 (Same-Origin Proxy) Most Reliable 400 days 400 days Same origin — no IP check ever

400 days is the browser maximum for server-set cookies. Neither PixelFly nor any platform can exceed this.

Frequently Asked Questions

Yes. Way 2 (Cloudflare) works for any website type since it is just a DNS setting. Way 1 (Same-Origin Proxy) works for any website running behind Cloudflare or Nginx.
For Way 2 (Own CDN): no code changes at all — just 3 DNS settings. For Way 1 via Cloudflare Worker: a small GTM tag URL change. For Way 1 via Nginx: a config block added to Nginx.
Yes, as long as users have consented to tracking cookies (which your existing consent banner handles). You are not creating new tracking — you are extending the lifetime of cookies users already consented to. Update your privacy policy to mention server-side cookie management.
400 days ≈ 13.3 months ≈ just over 1 year. 400 days is the hard limit set by Safari and Chrome. You can configure a longer Max-Age, but browsers will cap it at 400 days.
Without Way 1 or Way 2, Cookie Life Extension will still set cookies but Safari 16.4+ will ignore the extended lifetime (IP mismatch) and cap cookies at 7 days anyway. The feature only works properly with one of these two setups.
No. Way 2 specifically requires your website to be proxied through Cloudflare. If you use a different CDN (AWS CloudFront, Fastly, etc.) the same principle applies — route both domains through the same CDN. If you are on a plain VPS, use Way 1 with Nginx.

Ready to extend your cookie lifetime?

Enable Cookie Life Extension in your PixelFly dashboard and follow this guide. Takes about 10 minutes for Way 2.

We use cookies to enhance your experience, analyze site traffic, and for marketing purposes. By continuing to use our site, you consent to our use of cookies. Learn more