Customer Event(Google ads) - No sent Data

Topic summary

Migration of a Google Ads purchase tracking setup (including Enhanced Conversions) from “Additional scripts” to Shopify Customer Events results in no data being sent, despite the tag loading successfully.

What worked before:

  • In the checkout “Additional scripts,” a global enhanced_conversion_data object was defined and gtag.js was loaded.
  • gtag was configured with allow_enhanced_conversions: true and a conversion event fired with value, currency, and transaction_id. Conversions tracked correctly.

Current implementation (Customer Events):

  • Uses analytics.subscribe(‘checkout_completed’) to run after checkout.
  • Dynamically loads gtag.js, logs “success script,” initializes gtag config with allow_enhanced_conversions: true, and fires the conversion event with checkout-derived value, currency, and transaction_id.
  • Constructs enhanced_conversion_data (name, address, email, phone) from event.data.checkout.

Issue:

  • Although the script loads (confirmed by console log), the conversion data is not being sent/received.

Context notes:

  • Enhanced Conversions = sending hashed first‑party customer data for better matching; gtag.js = Google Ads global site tag.

Status: No replies or resolution yet; code snippets are central to understanding the issue.

Summarized with AI on December 26. AI used: gpt-5.

Good afternoon, I have a problem with this script that I added to my customer events to track purchases. In my Additional scripts it worked like this:

<script>
var enhanced_conversion_data = {
"first_name": "{{ checkout.billing_address.first_name }}",
"last_name": "{{ checkout.billing_address.last_name }}",
"home_address": {
"street": "{{ checkout.billing_address.street }}",
"city": "{{ checkout.billing_address.city }}",
"region": "{{ checkout.billing_address.province }}",
"postal_code": "{{ checkout.billing_address.zip }}",
"country": "{{ checkout.billing_address.country_code }}"
}
}
if("{{ checkout.email }}"){
enhanced_conversion_data.email = "{{ checkout.email }}";
}
if("{{ checkout.billing_address.phone }}"){
enhanced_conversion_data.phone_number = "{{ checkout.billing_address.phone }}";
}
</script>
<!-- Global site tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-NUMBER"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-NUMBER', {'allow_enhanced_conversions': true});
</script>
<!-- added 5/16/2022 per Google; replaces GTM Ads Conversion -->
<script>
gtag('event', 'conversion', {
'send_to': 'AW-NUMBER/NUMBER',
'value': {{ checkout.total_price | divided_by: 100.0 }},
'currency': '{{ currency }}',
'transaction_id': '{{ order_number }}',
});
</script>

This worked correctly. Now, when moving it to my customer events, it looks like this:

function loadExternalScript(src) {
  return new Promise((resolve, reject) => {
    const script = document.createElement('script');
    script.src=src;
    script.async = true;
    script.onload = () => resolve(script);
    script.onerror = () => reject(new Error('Script loading failed: ' + src));
    document.head.appendChild(script);
  });
}

analytics.subscribe('checkout_completed', (event) => {
  // Enhanced Conversion - Google Ads
  const checkout = event.data.checkout;
  const address1 = checkout.billingAddress.address1 || '';
  const address2 = checkout.billingAddress.address2 || '';
  const street = address1 + (address1 && address2 ? ' ' : '') + address2;

  const enhanced_conversion_data = {
    first_name: checkout.billingAddress.firstName,
    last_name: checkout.billingAddress.lastName,
    home_address: {
      street: street,
      city: checkout.billingAddress.city,
      region: checkout.billingAddress.province,
      postal_code: checkout.billingAddress.zip,
      country: checkout.billingAddress.countryCode
    }
  };

  if (checkout.email) {
    enhanced_conversion_data.email = checkout.email;
  }
  if (checkout.billingAddress.phone) {
    enhanced_conversion_data.phone_number = checkout.billingAddress.phone;
  }
  // End Enhanced Conversion - Google Ads

  loadExternalScript('https://www.googletagmanager.com/gtag/js?id=AW-NUMBER')
    .then(() => {
      console.log('success script');
      window.dataLayer = window.dataLayer || [];
      function gtag(){ dataLayer.push(arguments); }
      gtag('js', new Date());
      gtag('config', 'AW-NUMBER', {'allow_enhanced_conversions': true});
      gtag('event', 'conversion', {
        'send_to': 'AW-NUMBER/NUMBER',
        'value': checkout.totalPrice.amount,
        'currency': checkout.totalPrice.currencyCode,
        'transaction_id': checkout.order.id
      });
    })
    .catch(error => {
      console.error('Error loading script:', error);
    });
});

I reach console.log(‘success script’) when making a purchase, it means it connects to the script, but it is not sending the information.