Need help with connecting Google Tag Manager to Shopify store

Topic summary

A user is struggling to connect Google Tag Manager (GTM) with their Shopify store to track Google Ads conversions using the new Customer Events system. They’ve implemented a custom pixel with dataLayer code for checkout completion tracking but are unsure about the GTM configuration.

Key technical guidance provided:

  • DataLayer approach concerns: One responder warns that the current dataLayer implementation cannot be previewed in GTM and requires console-based verification. They recommend creating dataLayer variables for value, currency, transaction ID, email, and phone, then setting up a custom trigger for “checkout_completed” and a Google Ads conversion tag.

  • Code improvements: Another contributor suggests modifying the JavaScript to ensure dataLayer exists before pushing events and recommends using GTM Preview mode to verify event firing and variable population.

  • Basic setup verification: A third response provides links to installation guides, emphasizing correct placement of GTM code snippets after the <head> and <body> tags.

Testing recommendations: Use GTM Preview mode, complete test checkouts, and verify that custom events and conversion tags fire correctly with all variables populated.

Multiple screenshots were shared showing working GTM configurations, including purchase event triggers, tags, and dataLayer structures.

Summarized with AI on October 31. AI used: claude-sonnet-4-5-20250929.

I have Google tag manager that connects with my Google Ads account to track conversions. The setup is so confusing with the new Customer Events. Can someone please help?

Here is the code I used for my custom pixel

I’m not sure if I have to do anything else on the Google Tag Manager to accept these events? If anyone is an expert at this, please message me directly.

Hi Fwskincare,

Thanks for your query.

I can see you have added the GTM code with the datalayer. Connect the custom pixel with shopify and preview the website if the thank you page connect with GTM then you can track the events.

The datalayer you are using is not possible to preview it in GTM. you have to check the events and event data from the console.

If you get the event in the console as data layer event create the datalayer variables based on your data layer structure.

For Google ads you would need value, currency, transaction id, email, phone variables.

Create the trigger as checkout_completed.

Now create a Google ads conversion tag using the template and assign these variables as event parameters and trigger to fire the events.

Many of my clients had issues with this Data layer that is why i do not recommend this from my experience. Yet if you want to do it by yourself, you can try.

I have added some of my work samples that work the best for Shopify.

Feel free to ask if you have any questions.

Kind regards,

Hey @fwskincare ,

From your code snippet, I can see you’re implementing the dataLayer push for a checkout completion event. Let me help you set this up correctly:

  1. First, let’s verify your current code structure. You have:
  • The GTM base code snippet correctly implemented
  • A custom event push to dataLayer for “checkout_completed”

To make this work properly with Google Ads conversion tracking, you’ll need to:

  1. In Google Tag Manager:
    • Create a new Trigger
      • Type: Custom Event
      • Event name: “checkout_completed” (exactly as in your code)
    • Create a new Tag
      • Type: Google Ads Conversion Tracking
      • Configure with your Google Ads conversion ID and label
      • Set the trigger to the custom event you just created

Your JavaScript code looks mostly correct, but I’d recommend a slight modification for better reliability:

analytics.subscribe("checkout_completed", (event) => {
  window.dataLayer = window.dataLayer || []; // Ensure dataLayer exists
  window.dataLayer.push({
    'event': 'checkout_completed',
    'ecommerce': {
      'transaction_id': event.data?.checkout?.orderId,
      'currency': event.data?.checkout?.currencyCode,
      'value': event.data?.checkout?.totalTax,
      'shipping': event.data?.checkout?.shippingLine?.price?.amount    }
  });
});

Key things to check in GTM:

  1. Verify your GTM container is published after making changes
  2. Use Preview mode to test if events are firing correctly
  3. Ensure your Google Ads account is properly linked to GTM
  4. Confirm the conversion action is set up in Google Ads

To test:

  1. Enable GTM Preview mode
  2. Complete a test checkout
  3. Verify in the Preview mode that:
    • Your custom event fires
    • The Google Ads conversion tag fires
    • All expected variables are populated

Hope this helps. In case you want us to do this for you, feel free to email :slightly_smiling_face:

Cheers!
Shubham | Untechnickle

Hi @fwskincare

Follow the link here, and you’ll find two code snippets:

First code snippet → Add it right after the tag (see the exact position in this screenshot).

Second code snippet → Add it immediately after the tag. Be careful here—many people make mistakes. The tag can be long and contain other attributes. Just insert the code right after the > symbol (see this screenshot).

I hope this helps

Best,

Daisy