Google Ads conversion with GTM and custom web pixel

Hey everyone, I’m hoping someone can offer some clarity before I pull all my hair out. I feel like I’m running around in circles trying to get Google Ads integrated on a site using a custom web pixel.

This is a new site and the owner did not have GTM, so I set up a custom pixel specifically for Ads based on a tutorial I found (from Feed Army), but we can’t verify if it’s set up properly because no ads are running yet. It does say “connected” on the back end, but the Tag Assistant doesn’t work and there’s no browser extensions to test it with. A huge oversight by Shopify IMO, but anyway.

Because I can’t verify if everything is set up properly before they actually turn on their campaigns, I decided to try a different approach. Now I had the site owner set up a GTM account so I can try to connect Ads through GTM, again using a custom pixel.

Now Ads shows that it’s connected to GTM, and GTM shows it’s receiving data when I test the domain, but I don’t know if Ads is actually going to record conversions or not? I installed the GTM code in the custom pixel, but it’s just the “HEAD” code minus the HTML, like so..

//Initialize GTM tag

(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-xxxxxx');

I think I need to set up conversion tracking Tags in GTM, so that’s what I did. But I’m not sure. If so, do I need to add more code to the custom pixel, or is the above code enough to send all the Ads conversion data through?

I must have checked 20 YouTube tutorials and they all are still using the theme.liquid and Additional Scripts method, even videos from a few weeks ago. Or they just show GA4 and GTM integrations, which is not what I need.

If anyone has gone through this process or has any advice, I would be very grateful. Thanks!!

1 Like

I’m here hoping someone replies, I’ve experienced a very similar issue on a few client sites. We’ve set up the custom web pixel and installed the GTM container. I able to see the shopify standards events when pushing them through the GTM to GA4, but Google Ads is still throwing an error. I’ve read that Google Ads conversions won’t work through this implementation method, but all of the documentation is conflicting.

What we ended up doing is removing the GTM integration for Google Ads and using the Ads “google tag” in a custom pixel. This is basically the approach from the Feed Army tutorial I mentioned in my original post. The following code was actually implemented by someone from Google and has been working.

const script = document.createElement('script');
script.setAttribute('src', 'https://www.googletagmanager.com/gtag/js?id=AW-xxxx');
script.setAttribute('async', '');
document.head.appendChild(script);

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

analytics.subscribe("checkout_completed", (event) => {
gtag('event', 'conversion', {
'send_to': 'AW-xxx/xxxx',
'value': event.data.checkout.totalPrice.amount,
'transaction_id': event.data.checkout.order.id,
'currency': event.data.checkout.currencyCode
});
});

Personally I would use the Google & YouTube sales channel to integrate GA4, and only use GTM for any custom events like tracking internal clicks or whatever. Then use something like the above code for a direct Google Ads integration.

2 Likes

Hi Andy,

I added the Feed Army code, but do you think it would be better to just add the code you posted above? Do I post it in Customer Events?

Also, I have to replace my Thank you and Order status pages because I currently have 2 additional scripts added to my Checkout: Enhanced Conversion Data and Google Ads Conversion.

I do not have any apps.

  1. Can I just delete the additional scripts? I am using Shopify’s Google & Youtube Channel, and it automatically adds conversion tracking events to my Google Ads account during setup.

  2. Do I need to add these additional scripts to a new pixel and add it to Customer Events or add the text you posted above?

  3. What is the easiest solution for a non-technical person?

Thank you for your help.