Custom Pixel 'checkout_completed' Event Not Triggered After First Checkout in Safari

Topic summary

A developer encountered an issue where the custom pixel checkout_completed event only fires on the first checkout, but fails on subsequent checkouts in Safari (macOS and iOS). Chrome on macOS works correctly, but iOS Chrome exhibits the same problem.

Root Cause Identified:
The issue stems from a loggedConversion2 cookie that gets set after the first checkout completion. Investigation of the checkout page JavaScript revealed code that prevents checkout_completed from firing when this cookie exists with a value of “1”—apparently designed to prevent duplicate event triggers, but inadvertently blocking legitimate subsequent checkouts.

Workaround Implemented:
The developer resolved this by subscribing to the checkout_started event and deleting the loggedConversion2 cookie before checkout completion:

analytics.subscribe('checkout_started', event => {
    document.cookie = "loggedConversion2=; max-age=0";
});

This allows checkout_completed to trigger on every checkout. The solution is marked as working but may require additional testing.

Summarized with AI on October 28. AI used: claude-sonnet-4-5-20250929.

Hello everyone!

It’s my first post in this forum.
I’m glad if you provide some advice!

Problem:

Custom Pixel’s “checkout_completed” event is not triggered after the first checkout.

Environment and the result of testing:

macOS(Sequoia 15.4) + Safari(18.4) → Occur

macOS(Sequoia 15.4) + Chrome(135.0.7049.114) → Does not occur

iOS(18.3.2) + Safari → Occur

iOS(18.3.2) + Chrome → Occur (*)

Step of reproduction:

  1. Create custom pixel coded like below and activate it.
analytics.subscribe('checkout_completed', event => {
    console.log('checkout_completed event occured!');
})
  1. Launch Safari.

  2. Add some products to cart.

  3. Proceed checkout and complete it. ← “checkout_completed” event will be triggered in this step.

  4. Again, buy some products to cart.

  5. Proceed checkout and complete it. ← “checkout_completed” event won’t be triggered in this step.

Expected:

Custom Pixel’s “checkout_completed” event is triggered on every checkout completes.

Actual

Custom Pixel’s “checkout_completed” event only triggered on the first checkout complete.

Have anyone experienced this behavior?

If there any missing information, I’ll append it.

Sincerely.

Hi Protech3! Thank you very much for your post. It’s very helpful, because your information covers various aspects.

I want to confirm my recognition about case1 and case2.

I’m implimenting code according to ‘Custom web pixels’ in this article.

https://shopify.dev/docs/api/web-pixels-api/

That’s why I recognize that it is unecessary to implement any “register” and “cleanup” process.

Is this recognition correct?

I’m addressing this problem now.

I found that this behavior occur when user completes checkout with having “loggedConversion2” cookie entry.

This behavior does not occur when I delete “loggedConversion2” cookie entry just before completes checkout.

“loggedConversion2” is added to browser’s cookie when user completes the first checkout.

My next step is to find settings of control “loggedConversion2” cookie.

(I don’t recognize about “loggedConversion2” at all. This is not my customization.)

I found the Javascript code below on my checkout page.

It may indicates that “checkout_completed” will not be published if “loggedConversion2” exists and the value is 1.

...
                We = "loggedConversion2",
                ...
                publish(n, r, o) {
                    if ("string" != typeof n)
                        throw new Error("Expected event name to be a string, but got " + typeof n);
                    if (!Kn(n))
                        return !1;
                    if ("checkout_completed" === n && qn() && "1" === Yt(We)) // <- Here
                        return !1;

I presume that this code guards the unexpected “checkout_completed” on the case where the checkout is already completed before.

However, in my case, it seems that this code prevents “checkout_completed” even on another new checkout session.

Is the cause depends on my settings? Does anyone facing the same problem?

I made workaround for it. By far, it is working.

I connected this custom pixel to my shop.

When user checkout our product, “loggedConversion2” entry is removed from cookie.

By removing “loggedConversion2”, “checkout_completed” is triggered every checkout.

Maybe this workaround needs more test, but I check this thread as “Solved”.

analytics.subscribe('checkout_started', event => {
    document.cookie = "loggedConversion2=; max-age=0";
});