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 Ads conversion gtag('event', 'conversion')

Google Ads · Web Pixels API replacement · confidence: medium

Dies 2026-08-26

Paste-ready snippet
analytics.subscribe('checkout_completed', (event) => {
  const { checkout } = event.data;
  if (!checkout || !checkout.totalPrice) return;

  // Google Ads conversion tracking has no client-side sandbox equivalent to
  // gtag('event','conversion', {send_to: 'AW-XXX/YYY'}) — the sandbox-correct
  // path is the Google Ads Enhanced Conversions for Leads / Click Conversion
  // Upload API (server-side), OR routing through GA4 (previous snippet) with
  // a linked Google Ads account importing the GA4 "purchase" conversion.
  // If a direct Ads-only conversion action must stay separate from GA4,
  // forward it here via the same Measurement Protocol call used for GA4 —
  // Google Ads reads GA4-linked conversions automatically once the accounts
  // are linked in Google Ads > Conversions > Import.
  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,
        },
      }],
    }),
  });
});

Legacy pattern detected via: gtag\(\s*['"]event['"]\s*,\s*['"]conversion['"]

What this does NOT cover

What this does NOT cover: legacy `send_to: 'AW-XXXXXXX/YYYYYYYYY'` conversion-action-specific gtag calls with NO GA4 involvement at all require the separate Google Ads API Click Conversion Upload (server-side, OAuth) — flagged here as ambiguous, needs case-by-case setup per store.

Test-event verification checklist

  • Confirms the target Google Ads account is linked to the GA4 property (Google Ads > Tools > Linked accounts > Google Analytics) — without this link, the Ads conversion action never populates.
  • Google Ads > Conversions shows the imported GA4 "purchase" conversion importing new conversions within 24h of a real order (Google Ads import lag, not a pixel bug).
  • transaction_id/value/currency match the same fields verified in the GA4 snippet — this is intentionally the same event forwarded once, not a duplicate second network call, to avoid double-counted spend attribution.
  • Verify live against the platform's own test-event tool: https://support.google.com/google-ads/answer/6386302

Related paste-ready snippets

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