Google Ads Conversion Tracking For Shopify


//Conversion tracking tutorial by https://websensepro.com
//gtag code starts here
const script = document.createElement('script');
script.setAttribute('src', 'https://www.googletagmanager.com/gtag/js?id=AW-123456789');
script.setAttribute('async', '');
document.head.appendChild(script);

window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-123456789');
//gtag ends here


//ec + purchase code starts here
analytics.subscribe("checkout_completed", (event) => {
  gtag('set', 'user_data', {
    "email": event.data.checkout.email,
    "phone_number": event.data.checkout.phone
  });
  gtag('event', 'conversion', {
    'send_to': 'AW-123456789/your-conversion-label',
    'value': event.data.checkout.totalPrice.amount,
    'transaction_id': event.data.checkout.order.id,
    'currency': event.data.checkout.currencyCode
  });
});

Check below screenshot for code replacement:

Also make sure to update Conversion Label below: (Missing instructions in Video)

google ads conversion tracking
5/5 - (6 votes)

About

Leave a Comment

Your email address will not be published. Required fields are marked *