How to Fix the Lighthouse Third-Party Cookies Warning
The Lighthouse audit "Uses third-party cookies" goes away in one of two ways: stop setting the third-party cookie if you don't need it, or add the Partitioned attribute to Set-Cookie if you do. This warning appears when a page embeds another site's page in an iframe, such as a chat widget or a booking form, and that page sets a cookie. On my test pages, both fixes made this audit pass, and the Best Practices score went from 77 to 100.
The test environment was Ubuntu 24.04 and Node.js 22. I ran Lighthouse 13.6.0 from the command line with the default settings (mobile), and only the Best Practices category. Chrome was Chrome for Testing 153, which comes with Playwright 1.63.0. To check whether cookies were delivered, I used Playwright's default browser (chrome-headless-shell 157). The server was a small one I wrote with Node.js's http module, serving from localhost and 127.0.0.1 on the same machine. I did not test a production site over HTTPS, cookies set by ad or analytics tags, the Storage Access API, browsers other than Chrome, the Lighthouse panel in DevTools, or PageSpeed Insights.
The test page and the result when the warning appears
The test page (http://localhost:8400/) embeds a page from another site (http://127.0.0.1:8400/widget) in an iframe. The hostnames differ, so from the browser's point of view these are different sites. The embedded side acts as a chat window and sets this cookie:
Set-Cookie: chat_session=abc123; Path=/; SameSite=None; Secure
SameSite=None and Secure are what allow a cross-site iframe to use the cookie (MDN's explanation of third-party cookies). I ran Lighthouse on this page and used a small script (summarize.mjs) to pull the relevant parts out of the JSON result.
$ npx lighthouse http://localhost:8400/ --only-categories=best-practices --output=json --output=html --output-path=./out/p8400 --chrome-flags="--headless=new --no-sandbox" --quiet
exit: 0
$ node summarize.mjs out/p8400.report.json
lighthouseVersion: 13.6.0 formFactor: mobile locale: en-US
userAgent: HeadlessChrome/153.0.0.0
best-practices score: 77
third-party-cookies: score=0 title="Uses third-party cookies" displayValue=1 cookie found
name=chat_session url=http://127.0.0.1:8400/widget
failed: third-party-cookies weight=5 group=best-practices-general score=0
failed: inspector-issues weight=1 group=best-practices-general score=0
The Best Practices score was 77. Two audits failed: third-party-cookies (weight 5), and inspector-issues (weight 1), which covers the problems shown in DevTools' Issues panel. After I added Partitioned later, inspector-issues also dropped out of the failed list.
In the HTML report generated with the Japanese locale (--locale=ja), expanding the audit shows a table with the cookie name and the URL that set it.

Lighthouse counts Chrome's warnings
Looking at the Lighthouse 13.6.0 code, this audit collects the cookie issues Chrome reports while the page loads (the same ones shown in DevTools' Issues panel). It keeps those whose warning reasons include WarnThirdPartyPhaseout, or whose exclusion reasons include ExcludeThirdPartyPhaseout, and it groups them into one row per cookie in the table. If there is at least one, the audit fails.
I had Lighthouse save the collected data (with the -GA option) and looked at it. On the test page, what was recorded was the warning:
{"operation":"SetCookie","cookie":{"name":"chat_session","path":"/","domain":"127.0.0.1"},"cookieWarningReasons":["WarnThirdPartyPhaseout"],"cookieExclusionReasons":[],"cookieUrl":"http://127.0.0.1:8400/widget","siteForCookies":"http://localhost/"}
{"operation":"ReadCookie","cookie":{"name":"chat_session","path":"/","domain":"127.0.0.1"},"cookieWarningReasons":["WarnThirdPartyPhaseout"],"cookieExclusionReasons":[],"cookieUrl":"http://127.0.0.1:8400/widget"}
There are two entries: one when the cookie was set (SetCookie), and one when the iframe read it through document.cookie (ReadCookie). In both, cookieExclusionReasons is empty, so the cookie was accepted. The report table groups entries by cookie, which is why there is only one row.
It works in today's Chrome, but fails when restrictions apply
According to MDN's explanation, Chrome does not block third-party cookies by default. It restricts them in incognito mode or when the user has chosen to block them in settings. Firefox and Safari enable protections by default, such as partitioning cookies per site. The Lighthouse audit's description also says that third-party cookies may be blocked depending on the situation.
So I opened the page twice in Playwright and checked what document.cookie showed inside the iframe (frames.mjs). For the block run, I turned on third-party cookie restrictions with the Chrome DevTools Protocol (CDP) method Network.setCookieControls.
$ node frames.mjs http://localhost:8400/
browser: 157.0.8103.78 third-party cookie restriction: false
[1回目] iframe の表示: チャット(document.cookie:chat_session=abc123)
[2回目] iframe の表示: チャット(document.cookie:chat_session=abc123)
保存された Cookie: [{"name":"chat_session","domain":"127.0.0.1","sameSite":"None"}]
$ node frames.mjs http://localhost:8400/ block
browser: 157.0.8103.78 third-party cookie restriction: true
[1回目] iframe の表示: チャット(document.cookie:(空))
[2回目] iframe の表示: チャット(document.cookie:(空))
保存された Cookie: []
Without restrictions, the cookie was stored, and on the second request the server also received chat_session=abc123. With restrictions on, the cookie was not stored, and the iframe could not see anything. The server received requests without a cookie both times.
Fix 1: If you don't need the cookie, stop setting it
First, check whether the cookie is actually needed. If the iframe doesn't use it, stop returning Set-Cookie from the embedded side's server. On the test page at port 8402, I removed Set-Cookie. Then third-party-cookies passed, and the score became 100.
$ node summarize.mjs out/p8402.report.json
lighthouseVersion: 13.6.0 formFactor: mobile locale: en-US
userAgent: HeadlessChrome/153.0.0.0
best-practices score: 100
third-party-cookies: score=1 title="Avoids third-party cookies" displayValue=-
The server that returns Set-Cookie is the one whose URL appeared in the report table. The fix belongs to the side that provides the embedded content.
Fix 2: If you need the cookie, add the Partitioned attribute
If the cookie is needed, for example to keep a chat conversation going, add the Partitioned attribute. This mechanism is called CHIPS (Cookies Having Independent Partitioned State). According to MDN's CHIPS explanation, a cookie with Partitioned is stored keyed by two sites together: the site that set it, and the site of the top-level page shown in the browser's address bar. Secure must also be set.
On the test page at port 8401, I changed Set-Cookie like this:
-Set-Cookie: chat_session=abc123; Path=/; SameSite=None; Secure
+Set-Cookie: chat_session=abc123; Path=/; SameSite=None; Secure; Partitioned
With this change, third-party-cookies passed in Lighthouse, and the score became 100. In the Japanese locale, the audit title means "No third-party cookies are used".
$ node summarize.mjs out/ja8401.report.json
lighthouseVersion: 13.6.0 formFactor: mobile locale: ja
userAgent: HeadlessChrome/153.0.0.0
best-practices score: 100
third-party-cookies: score=1 title="サードパーティ Cookie は使用されていません" displayValue=-
With third-party cookie restrictions turned on, the cookie was still stored and could be read from the iframe.
$ node frames.mjs http://localhost:8401/ block
browser: 157.0.8103.78 third-party cookie restriction: true
[1回目] iframe の表示: チャット(document.cookie:chat_session=abc123)
[2回目] iframe の表示: チャット(document.cookie:chat_session=abc123)
保存された Cookie: [{"name":"chat_session","domain":"127.0.0.1","sameSite":"None","partitionKey":"http://localhost"}]
The server log also showed that the second iframe request carried chat_session=abc123. The stored cookie has the embedding page's site (http://localhost) as its partitionKey.
A cookie with Partitioned is stored separately for each embedding site. As MDN explains, it is not shared when the page is embedded on other sites. Using this approach won't work for keeping a login shared across many sites.
For cases where the same cookie must be used across several sites, MDN's explanation mentions the Storage Access API, which asks the user for permission between a small number of related sites. If the use case is fine with the cookie being separate per site, adding Partitioned is enough.





