Skip to content
FunnelGuard

Fix guide by FunnelsGuard

SameSite cookies breaking iframe login or checkout: how to fix

CNV-378Medium impactPartlyBy FunnelGuardPublished Updated
On this page

What this issue is

A cookie is a small piece of data a site stores in the browser, often to remember who is logged in. The SameSite attribute tells the browser when it may send that cookie on requests that come from another site.

There are three values: Strict (only same-site requests), Lax (same-site plus top-level link navigation) and None (always, but only with the Secure flag, so over HTTPS). Modern browsers treat a cookie with no SameSite value as Lax.

An iframe from another domain, for example a payment page, booking widget or login box embedded in your page, is a cross-site context. Its cookies need SameSite=None; Secure. Without it, the browser drops the cookie and the embedded page behaves as if the visitor is new.

Why it costs you leads or sales

The failure is quiet. The iframe loads, but the login loops back to the sign-in form, the cart inside the embed is empty, or the payment step says the session expired. The visitor rarely sees an error message and simply leaves.

It often appears only in some browsers or after a browser update, so the team that built it may never see it. Safari and Firefox also restrict third-party cookies in their own ways, which can add to the problem.

Where an embedded checkout loses the session
  1. Visitor opens pagePage on your domain loads
  2. Iframe loadsCheckout or login from another domain
  3. Session cookie droppedSameSite=Lax blocks it in a cross-site frame
  4. Login or cart stepTreated as a new visitor
  5. Purchase or leadNever completed

The cookie is set but never sent back from inside the iframe.

Completed embedded checkoutsExample numbers
Completed embedded checkouts (example)Before (Lax): 35 %; After (None; Secure): 62 %024483562Before (Lax)After (None; Secure)%

Example: share of visitors who finish an embedded checkout before and after the cookie fix. Numbers are illustrative.

How to check if your site has it

Check the cookie in Chrome
  1. Open the page with the iframe

    Use a normal window on the live page where the embed appears, in Chrome or another Chromium browser.

  2. Open DevTools

    Press F12, go to the Application tab, then Cookies. Select the domain of the embedded service, not only your own.

  3. Read the SameSite column

    Session or login cookies showing Lax, Strict or empty are the suspects. They should show None with the Secure box ticked.

  4. Look for blocked cookie warnings

    In the Network tab, click the iframe request and open Cookies. A yellow warning icon means the cookie was blocked, and hovering it states the SameSite reason.

  5. Test the real journey

    Log in or add to cart inside the iframe. If you are sent back to the login form or the cart is empty, the session is being lost.

How to fix it

You can only change cookies that your own server or the embedded service sets. If a third-party tool sets them, its settings or support team must change them. Pick the route that matches how the embed is built.

Which SameSite value fits which cookie
Cookie purposeUsed in a cross-site iframe?Recommended value
Session or login for embedded appYesSameSite=None; Secure
Cart or checkout token in the frameYesSameSite=None; Secure
Admin login on your own siteNoLax (or Strict)
Cookie never needed in the frameNoLeave as Lax
Set SameSite=None; Secure by platform
  1. Find who sets the cookie

    Check the cookie name in DevTools. If a plugin (membership, LMS, checkout) sets it, look in its settings or documentation for a SameSite option and update the plugin.

  2. Set it in code if you control the cookie

    In a small plugin or functions.php, pass an options array to setcookie() as shown in the PHP example below. Requires PHP 7.3 or newer.

  3. Make sure the site uses HTTPS

    SameSite=None is ignored without Secure, and Secure needs HTTPS across the whole site.

Correct Set-Cookie header for an embedded sessiontext
Set-Cookie: session_id=abc123; Path=/; Secure; HttpOnly; SameSite=None
PHP 7.3+ setcookie with SameSite=Nonephp
setcookie('session_id', $value, [
  'expires'  => time() + 3600,
  'path'     => '/',
  'secure'   => true,
  'httponly' => true,
  'samesite' => 'None',
]);
Cookie written from JavaScript or a GTM tagjavascript
document.cookie = 'embed_session=abc123; path=/; max-age=3600; Secure; SameSite=None';
Cookie settings before and after

Broken

  • Session cookie has no SameSite value, so it defaults to Lax
  • Iframe request arrives without the cookie
  • Login loops or cart shows empty

Fixed

  • Cookie sent with SameSite=None; Secure
  • Iframe request carries the session
  • Login and checkout continue to the final step
Try the cookie settingInteractive
Cookie is SameSite=Lax

Lax (default)

Leads or data lost

The browser withholds the cookie inside the iframe. The visitor is logged out or sees an empty cart.

Toggle to see how the SameSite value changes what the embedded page receives.

How to confirm it's fixed

Confirmation checks
  • In DevTools, Application, Cookies, the session cookie shows SameSite None and Secure ticked
  • No blocked-cookie warning appears on the iframe request in the Network tab
  • You can log in inside the iframe and stay logged in after the next step
  • A test item stays in the cart through the embedded checkout
  • The journey also works in a private window and in Safari or Firefox
  • The site loads fully over HTTPS with no mixed content warnings

How to prevent it happening again

Prevention habits
  • List every iframe on login, booking and checkout pages and note who sets its cookies
  • Re-test embedded journeys after browser, plugin, theme or vendor updates
  • Prefer first-party pages or a matching custom domain over framing another site
  • Set SameSite explicitly instead of relying on the browser default
  • Add the cookie check to your release checklist whenever session code changes
  • Run the journey on a schedule so a break is caught within a day, not after a sales dip

How FunnelGuard handles this

FunnelGuard detects this issue only partly. Its robot visitor runs your real journey on a schedule, and the check for this issue runs in Chromium only. If the login or checkout inside an iframe breaks in that browser because of cookie settings, the journey step fails, you get one alert after a re-check from a second region, with a screenshot and a likely cause.

How the problem usually unfolds
  1. Day 0

    Embedded login is built and works in testing

  2. Week 8

    A browser update or vendor change enforces SameSite rules on the cookie

  3. Week 8-10

    Logins loop and carts empty, but no error is shown

  4. Week 10

    Team spots lower sales and checks the cookie

  5. Week 10

    SameSite=None; Secure is applied and the journey works again

Questions people ask

Why does my iframe login keep sending me back to the login page?

The session cookie is most likely set as SameSite=Lax or Strict, or with no value at all. Browsers do not send those cookies inside a cross-site iframe, so each request looks logged out. Setting SameSite=None; Secure on the session cookie fixes it.

What does SameSite=None; Secure mean?

SameSite=None lets the browser send the cookie on cross-site requests, such as from an iframe. The Secure flag restricts it to HTTPS connections. Browsers ignore SameSite=None if Secure is missing.

Why is my embedded checkout cart empty?

The cart is usually tied to a session cookie that the iframe cannot read because of its SameSite value. The embedded page then starts a new, empty session. Check the cookie in DevTools under Application, Cookies, and look for a blocked-cookie warning.

Which SameSite value is the default?

Current Chromium-based browsers treat a cookie with no SameSite attribute as Lax. That is why older embeds that never set a value can suddenly stop working in an iframe.

Will SameSite=None fix the problem in Safari and Firefox?

Not always. Safari and Firefox apply their own limits on third-party cookies, so a correctly set cookie can still be blocked in an iframe. The reliable fix is to host the login or checkout on your own domain or open it in a full page.

How do I check if a cookie is blocked in an iframe?

Open Chrome DevTools, go to the Network tab, click the iframe request and open its Cookies panel. A warning icon on a cookie means it was blocked, and the tooltip gives the reason, such as a SameSite problem.

Can I change SameSite on Shopify, Wix or Squarespace cookies?

No, these platforms set their own cookies and do not expose a SameSite option. Avoid framing their checkout or login on another site, and link to the page directly instead.

Does FunnelGuard detect SameSite cookie problems?

Only partly. It runs the journey in Chromium and flags a failed step if the embedded login or checkout breaks there. It does not test Safari or Firefox, so check those by hand.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: Chromium only.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.