Troubleshooting

Button Click Tracking Not Working on Shopify

3 min read··By the TrackingCoder team
🔧

Common reasons button-click tracking doesn’t fire

  1. GTM container not published - You imported the container but didn’t click Submit → Publish.
  2. GTM snippet not installed on your site - The GTM code needs to be in your site’s <head> and <body>.
  3. Button uses JavaScript navigation instead of href - If the button navigates via window.location or a framework router, a standard Click URL trigger won’t match because there’s no real anchor link.
  4. CSS text-transform changes the visible text - Your trigger matches “Get Started” but the DOM text is “get started” because CSS text-transform: uppercase is applied visually only.
  5. Button is inside an iframe - GTM cannot see clicks inside iframes from a different origin. You need GTM installed inside the iframe’s document as well.
  6. Dynamic buttons loaded after page load - If the button is injected by JavaScript after the DOM is ready, a trigger that fires on DOM Ready may not attach correctly. Use a Click – All Elements trigger instead.
  7. Shopify dynamic buttons use JavaScript rendering - “Buy it now” and dynamic checkout buttons are rendered by Shopify’s JavaScript after page load. Standard Click triggers may not detect them reliably.

Step-by-step debugging checklist

  1. Verify GTM is installed - Visit your site, right-click → View Page Source, search for “GTM-”. If you don’t see it, GTM isn’t installed.
  2. Check GTM Preview mode - In GTM, click Preview. Navigate your site and trigger the event. Look for your tag in the Tags Fired section.
  3. Check the trigger - If the tag shows as “Not Fired”, click on it to see which trigger conditions aren’t met.
  4. Inspect the button element - Right-click the button → Inspect. Note the tag name (button, a, div), classes, and any data-* attributes. Make sure your trigger selector matches.
  5. Test with a Click – All Elements trigger - Create a trigger with no filters and check GTM Preview to see what Click variables populate when you click the button.

Shopify-specific issues

Shopify’s dynamic checkout buttons (“Buy it now”, Apple Pay, Google Pay) are rendered asynchronously by Shopify’s JavaScript. They often sit inside a .shopify-payment-button container. Because these load after the initial DOM, you should use a Click – All Elements trigger rather than a Click – Just Links trigger.

Section-based themes (Online Store 2.0) can also dynamically replace page sections, which means buttons you see on the page were injected after GTM initialised. Use CSS selectors that remain stable across section renders.

How to verify it’s working

  1. Open GTM Preview/Debug mode
  2. Navigate to your site
  3. Trigger the event (click the button)
  4. Check the GTM debug panel - your tag should appear under “Tags Fired”
  5. Check GA4 DebugView (GA4 → Admin → DebugView) to confirm the event arrived

Still didn’t work?

Our team can help. Describe what’s happening and we’ll get back to you within 24 hours.

Still didn't work? Report this issue

Fill in the details below and our team will review it within 3-5 business days. We aren't obliged to refund - but if we genuinely can't make it work, we may credit you back. Either way, your credits remain usable on a different event or site.

No need to type https:// - we'll add it for you.

Min 20 characters (0/20).

Context automatically included: button click tracking on shopify

Skip the manual setup

TrackingCoder detects your CMS and plugins automatically, then generates ready-to-use tracking code. No more adapting generic tutorials - get code tailored to your exact setup in under 2 minutes.

Try TrackingCoder Free →

2 free credits on signup. No card required.