AskSpot analytics on Shopify: storefront and checkout

Shopify is a special case for chat analytics: the storefront behaves like any other site, but the checkout runs Custom Pixels in an isolated sandbox. This guide covers both – how to load the AskSpot chat and its measurement on the storefront, and what actually works (and doesn’t) on the Shopify checkout.

Key takeaways

  • On the storefront, everything from the main GA4 guide works unchanged – load the widget and the dataLayer bridge through GTM.
  • On the checkout, Shopify runs Custom Pixels in a sandbox: the script loads, but the widget won’t render – by design, not a bug.
  • The analytics part can still work in the sandbox – it can listen for checkout_completed and send a conversion to the AskSpot API.
  • Access to conversation memory on the checkout needs testing; the cookie fallback is the reliable workaround.

This is a companion to the main guide, tracking the AskSpot chat in Google Analytics – read that first for the widget events, the dataLayer bridge, GTM and GA4 setup. Here we only cover what is specific to Shopify.

Storefront (home, categories, product pages)

The ordinary case. You load the widget through GTM or the theme (theme.liquid), and the bridge through GTM. Everything in the main GA4 guide works unchanged.

Checkout – three facts to know

  • Fact 1: Custom Pixel runs in a sandbox. Shopify runs Custom Pixels in an isolated iframe (Web Pixels API), with no access to the checkout page DOM. Consequence: the script loads, but the widget won’t render. That’s not a bug – it’s how Shopify works.
  • Fact 2: the analytics layer can work. Besides the chat window, our script loads analytics logic. In the sandbox the widget has nowhere to draw itself, but the analytics part has a chance to work – it can listen for Shopify events (including checkout_completed) and send a conversion to our API.
  • Fact 3: access to conversation memory needs testing. We keep conversation memory in a hidden chat frame (iframe). Because the checkout usually runs on a subdomain of the same parent domain as the shop, the browser treats it as the same site and a conversation started on the storefront should be visible there. But a strongly isolated Custom Pixel sandbox may cut that off.

This needs a test on your specific install. Don’t assume it works – check it (procedure in the main guide’s Debugging section). If the sandbox cuts off access to conversation memory, the workaround is saving conversationId in a cookie on the shop domain (attribution, method C) – the cookie works independently of these limits.

Code for the Custom Pixel

const ASKSPOT_SCRIPT_SRC =
  'https://chat.askspot.io/api/v1/integration/{YOUR_INTEGRATION_ID}/embed-script';

let askSpotLoaded = false;

function loadAskSpot() {
  if (askSpotLoaded) return;
  askSpotLoaded = true;
  const script = document.createElement('script');
  script.async = true;
  script.crossOrigin = 'anonymous';
  script.src = ASKSPOT_SCRIPT_SRC;
  document.head.appendChild(script);
}

const getCookiebotConsent = async () => {
  try {
    const cookieString = await browser.cookie.get('CookieConsent');
    if (!cookieString) return null;
    return {
      marketing:   cookieString.includes('marketing:true'),
      statistics:  cookieString.includes('statistics:true'),
      preferences: cookieString.includes('preferences:true')
    };
  } catch (e) {
    return null;
  }
};

async function loadAskSpotIfAnalyticsConsentGranted() {
  const consent = await getCookiebotConsent();
  if (consent?.statistics) loadAskSpot();
}

analytics.subscribe('checkout_started', () => {
  loadAskSpotIfAnalyticsConsentGranted();
});

GTM or Custom Pixel on the checkout?

GTMCustom Pixel
Works on Shopify checkoutonly with Checkout Extensibility (Shopify Plus / new checkout)✓ always
Consent✓ with Consent Mode, one placemanual, cookie parsing
Access to Shopify events (checkout_completed)indirectly via the dataLayer✓ natively via analytics.subscribe
Isolationnonesandbox – no DOM, possible trouble accessing conversation memory
Adblockers⚠ block gtm.jsless susceptible

Recommended order of action:

  1. Storefront through GTM (consent, one place, the whole path). Remove the frontend script so you don’t duplicate.
  2. Ask AskSpot to hide the bubble on the cart and checkout – don’t fiddle with conditional loading.
  3. Checkout: first check whether you need a Custom Pixel at all. If conversions are meant to go to the AskSpot API, not your GA4 – check with us whether a server-side variant (attribution, level 3) is enough.
  4. If a Custom Pixel is needed – deploy it on a test pixel / test shop first, verify the checklist items, and only then go to production.

For placement modes and the full integration picture, see the Shopify integration. To connect order data (order status in chat), see how to connect Shopify to AskSpot.

Why doesn’t the chat widget show on the Shopify checkout?

Shopify runs Custom Pixels in an isolated sandbox with no access to the checkout DOM, so the widget has nowhere to render. That’s expected. The analytics part of the script can still run and send conversions to the AskSpot API.

Do I need a Custom Pixel at all?

Often not. If you only need conversions attributed to conversations, a server-side variant sending them to the AskSpot API may be enough – ask your AskSpot contact. Use a Custom Pixel only when you specifically need checkout-side events in the sandbox.

Will a conversation from the storefront carry over to the checkout?

It should, because the checkout usually lives on a subdomain of the same parent domain – but a strongly isolated sandbox can cut it off. Test it, and if it’s blocked, save the conversationId in a cookie on the shop domain as a fallback.

LinkedIn

Written by

AskSpot Team

AskSpot builds AI Chat and Inbox Agents for e-commerce: on-site product advice and 24/7 support across email, chat and marketplaces, in 200+ languages.

Case studies

Real results for e-commerce stores

See how online retailers use AskSpot to automate conversations, reduce support workload and grow sales.

All case studies

Morele.net

How Morele.net cut customer service costs by 90%

Morele.net cut support costs 90%, from 50 agents to 5. AskSpot resolves 65% of its 37,600 monthly chats with no human and answers Allegro questions too.

Read the story →

Militaria.pl

How Militaria resolves 72% of chats in 8 languages

Militaria.pl runs AskSpot across three domains in eight languages: 61% recommendation click-through, 26% add-to-cart after a chat, 72% resolved with no human.

Read the story →

4FIZJO

How 4FIZJO resolves 61% of customer chats with AI

AskSpot's AI Chat resolves 61% of 4FIZJO's 21,360 monthly chats with no human across 6 markets; its Inbox Agent auto-resolves 25% of email tickets.

Read the story →

Meblobranie

How chat advice puts €1.9M of garden furniture in baskets a month

Meblobranie's AskSpot agent answers the questions garden furniture is bought on – size, colour, anchoring, spare nets. Chat advice puts €1.9M into the cart a month, 20% of chats fill a basket, 70% resolved.

Read the story →

Szopex

How one AI agent runs across Szopex’s three retail brands

One AskSpot agent runs across Szopex's three storefronts – Sklep Biegacza, Warsaw Sneaker Store and SKStore – on three e-commerce platforms. 67% of chats resolved, 58% product CTR, 11.7% end in a purchase.

Read the story →

moderno.dk

How moderno.dk resolves 64% of furniture chats with no human

moderno.dk's AskSpot agent resolves 64% of furniture questions with no human – delivery, sizing, stock and order changes – and turns 12.3% of chats into carts.

Read the story →

16case studies

See every story

Every merchant we have measured – what shoppers asked, what the agent did, and the numbers it moved.

Browse them all →

Ready to make every conversation sell?

Book a demo and see AskSpot on your own catalog. Onboarding takes a few days.