We’re upgrading our email infrastructure — for immediate response, email andrewjgaber@gmail.com meanwhile.
Skip to main content
Part of Digital Empire
Google Analytics / Ads

Google Enhanced Ecommerce (Universal Analytics, never migrated)

Google Analytics (legacy UA) · Web Pixels API replacement · confidence: high

Dies 2026-08-26

Paste-ready snippet
// Universal Analytics stopped processing new hits in 2024 — this pattern is
// already fully dead, independent of the Aug 26 checkout change. There is no
// UA-shaped replacement; the correct fix is a full switch to GA4 Measurement
// Protocol, same as the ga4-gtag-purchase-checkout-liquid template. Shown
// here as its own entry because the detection signature (ga('ec:...')) is
// distinct and merchants searching for "enhanced ecommerce" still find this
// dead pattern in old themes.
analytics.subscribe('checkout_completed', (event) => {
  const { checkout } = event.data;
  if (!checkout || !checkout.totalPrice) return;

  fetch(`https://www.google-analytics.com/mp/collect?measurement_id=MEASUREMENT_ID&api_secret=API_SECRET`, {
    method: 'POST',
    keepalive: true,
    body: JSON.stringify({
      client_id: event.clientId,
      events: [{
        name: 'purchase',
        params: {
          transaction_id: checkout.order ? checkout.order.id : checkout.token,
          value: checkout.totalPrice.amount,
          currency: checkout.totalPrice.currencyCode,
          items: checkout.lineItems.map((item) => ({
            item_id: item.variant && item.variant.id,
            item_name: item.title,
            quantity: item.quantity,
            price: item.variant ? item.variant.price.amount : undefined,
          })),
        },
      }],
    }),
  });
});

Legacy pattern detected via: ga\(\s*['"]ec:(addProduct|setAction)['"]|ga\(\s*['"]send['"]\s*,\s*['"]pageview['"]

What this does NOT cover

What this does NOT cover: historical UA data cannot be backfilled into GA4 — this snippet only fixes going-forward tracking.

Test-event verification checklist

  • Confirms a GA4 property exists and is receiving traffic at all — a store still running only UA calls has likely had ZERO working Google Analytics data since UA sunset; this is a bigger gap than the Aug 26 deadline and should be flagged to the merchant as pre-existing, not new.
  • transaction_id/value/currency/items match the shape used in the ga4-gtag-purchase-checkout-liquid template — same GA4 destination, this is the migration path not a separate system.
  • Fires once per completed order on the Thank You page only.
  • Verify live against the platform's own test-event tool: https://developers.google.com/analytics/devguides/collection/protocol/ga4/validating-events

Related paste-ready snippets

Google Analytics / Ads / GTM family · GA4, Google Ads conversion, GTM dataLayer, and the legacy Universal Analytics enhanced-ecommerce path.