Skip to main content
Contributor I
January 12, 2025
Solved

Shopify Headless with Native Checkout

  • January 12, 2025
  • 4 replies
  • 376 views

Hey community 👋

Our company is working with a client who is building a headless version of their Shopify store. However they will use the native Shopify checkout.

What I’m unsure about, given Shopify’s sandboxing of scripts, is if:

  1. A user lands on the site anonymously
  2. We send Klaviyo events for that anonymous user
  3. That use enters checkout (Shopify)
  4. That user becomes identified

Will Klaviyo sync their anonymous events with their now-identified profile?

Shopify checkout will be on exactly the same domain (e.g. www.site.com/products/a-product and www.site.com/checkout) so all cookies will be readable by Shopify checkout.

    Best answer by Byrne C

    Hi ​@jevawin,

    Thanks for your question in the community! Just wanted to add on to some of the responses above, and confirm the expected behavior regarding tracking anonymous visitor activity on a headless Shopify setup.

    As long as you’ve:

    1. Manually added our Javascript to your store’s code (this includes onsite JS, Viewed Product and Added to Cart snippets). Instructions here
    2. Enabled Anonymous Visitor Tracking on your Data settings,

    You’ll be able to track the anonymous activity of visitors who were identified later on. Let me know if this helps, or if you have any additional questions.

    Have a great rest of your week!

    -Byrne

    4 replies

    Christiannoerbjerg
    Expert Problem Solver II
    2025 Champion
    January 12, 2025

    Hi ​@jevawin 

    Thank you for posting in the Community!

    From my understanding with working with different headlines Shopify stores in Scandinavia, this i my point of view. 

    Just to elaborate on the tracking in Klaviyo, so we have that out of the way. Klaviyo tracks anonymous users using a browser cookie called (_kla_id). This cookie is domain-specific, so as long as the checkout is on the same domain (Your Shopify store) the cookie will persist and be readable throughout the user journey, including during checkout.

    So, when a person visits the checkout, or a footer or anything else on the site, where they can be recognized by their e-mail address and the set a cookie. Shopify will pass this information to Klaviyo, identifying the user. At this point, Klaviyo attempts to merge the anonymous events that have been collected before with the now-identified profile (With the provided e-mail and set klaviyo ID-cookie). 

    From that, Klaviyo can connect the dots between the anonymous user and the now-identified user. This sync ensures that all events (browse, add to cart and such, if the Shopify integration and script is set. 

    Hope that gives the explanation, that you where look for or else, let me know! :-)

    I would love to help you solve this issue. 

    Christian Nørbjerg Enger
    Partner & CPO
    Web: Segmento.dk
    LinkedIn: @christianfromsegmento
    Voldbjergvej 22b, 8240 Risskov

    MANSIR2094
    Expert Problem Solver IV
    Expert Problem Solver IV
    January 12, 2025

    Yes ​@jevawin , Klaviyo can sync anonymous events to an identified profile as long as the Shopify checkout is on the same domain and the Klaviyo cookie persists. When the user becomes identified during checkout, Klaviyo will attribute the anonymous browsing data to the identified profile. Ensure the Klaviyo script is implemented correctly for seamless tracking. Reach out if you need help setting this up.

    Mansir Digital Portfolio
    Amos Peace
    Problem Solver III
    Problem Solver III
    January 13, 2025

    Hello ​@jevawin,

     

    Yes, Klaviyo can sync anonymous events with a user's profile when they become identified at checkout, even if the checkout is on a subdomain within the same domain (like your example).

     

    This is because cookies set by Shopify on the main domain will still be readable by the checkout pages. Klaviyo uses these cookies to identify the user and associate their anonymous activity with their profile.

     

    For further questions you can send message.

     

    Best Regards,

    Peace.

    +2348110490971

    Peace - Turning Emails Into Opportunities 💼 Email Marketing Specialist | 🚀 Klaviyo Expert 📧 amosfolashade2@email.com WhatsApp -+2349023453575 “Delivering the right message, to the right person, at the right time.”
    Byrne C
    Community Manager
    Byrne CAnswer
    Community Manager
    January 14, 2025

    Hi ​@jevawin,

    Thanks for your question in the community! Just wanted to add on to some of the responses above, and confirm the expected behavior regarding tracking anonymous visitor activity on a headless Shopify setup.

    As long as you’ve:

    1. Manually added our Javascript to your store’s code (this includes onsite JS, Viewed Product and Added to Cart snippets). Instructions here
    2. Enabled Anonymous Visitor Tracking on your Data settings,

    You’ll be able to track the anonymous activity of visitors who were identified later on. Let me know if this helps, or if you have any additional questions.

    Have a great rest of your week!

    -Byrne