How to Track Click Events in Shopify (2026)

Last updated
Expert reviewed
5 min read
Jacques Blom
Jacques Blom
CTO at Fudge.

Key takeaways

  • Google Tag Manager’s Click trigger is the easiest way to track specific button clicks without code changes.
  • GA4 Enhanced Measurement automatically tracks outbound link clicks without any setup.
  • For custom button tracking, add data attributes to your buttons and listen for them in JavaScript.
  • Click tracking tells you which CTAs, links, and buttons actually get used - essential for conversion optimization.

Click tracking bridges the gap between page views and purchases. You can see that 1,000 people visited your product page — but without click tracking, you don’t know if 900 of them clicked “Add to Cart” or 90 of them did. That difference completely changes your optimization strategy.

How to track button clicks on a website

Three approaches, from simplest to most flexible:

  1. GA4 Enhanced Measurement — automatic outbound link tracking, no setup needed
  2. Google Tag Manager click triggers — track any specific element without code changes
  3. Custom JavaScript with data attributes — most flexible, works without GTM

Related: Add Google Tag Manager to Shopify.


GA4 automatically tracks clicks on outbound links (links that take visitors to a different domain) when Enhanced Measurement is enabled.

To verify it’s on:

  1. Open GA4 → Admin → Data Streams → select your stream
  2. Under Enhanced Measurement, check that “Outbound clicks” is toggled on

This fires an click event with the link_url parameter for every outbound click. Useful for tracking clicks to partner sites, marketplaces, or affiliate links.

Related: Add Custom Events in Shopify.

Limitation: this only tracks outbound clicks. For clicks within your own store (like “Add to Cart” or “View Details”), you need GTM or custom JavaScript.


Method 2 — Google Tag Manager click trigger

GTM can fire events for any element a visitor clicks — buttons, links, images, or any other clickable element.

Step 1 — Enable GTM’s Click variables. In GTM, go to Variables → Configure. Under Clicks, enable: Click Element, Click Classes, Click ID, Click Target, Click Text, Click URL.

Step 2 — Identify your button. On your live storefront, right-click the button you want to track → Inspect. Note the element’s:

Step 3 — Create a Click trigger in GTM.

Step 4 — Create a GA4 Event tag.

Step 5 — Test with GTM Preview mode. Click Preview → open your store in the new window → click the button. Confirm your tag fires in the GTM debugger.

Step 6 — Submit and publish.


Method 3 — Custom JavaScript with data attributes

For stores without GTM or when you want tracking built directly into a section, data attributes give you clean, maintainable click tracking.

Step 1 — Add data attributes to buttons. In your theme’s Liquid code, add a data-track attribute to the button:

<button
  type="submit"
  class="product-form__submit"
  data-track="add-to-cart"
  data-product="{{ product.title | escape }}"
>
  Add to cart
</button>

Step 2 — Add a click listener. In theme.liquid or a section’s {% javascript %} block:

document.addEventListener('click', function(event) {
  var tracked = event.target.closest('[data-track]');
  if (!tracked) return;

  var action = tracked.dataset.track;
  var product = tracked.dataset.product || '';

  // Send to GA4
  if (typeof gtag !== 'undefined') {
    gtag('event', action, {
      'product_name': product
    });
  }
});

This uses event delegation — one listener on the document catches all tracked clicks, so it works even for elements added dynamically (like quick-add buttons on collection pages).

Add click-tracked conversion elements to your Shopify store.
Try Fudge for Free

To measure results, see create a landing page in shopify.

To measure results, see add a button in shopify.

To measure results, see add a custom conversion element in shopify.


What to track in a Shopify store

Not every click needs tracking. Focus on clicks that tell you something meaningful:

High-value clicks to track:

Less valuable to track:

Ask: “If I knew the click rate on this, would I change something?” If yes, track it.


Viewing click data in GA4

Once click events are flowing:

This data shows which CTAs perform and which don’t — essential for informed conversion rate optimization.


FAQ

What's the difference between GA4 click events and Shopify Customer Events?

GA4 click events fire for any clickable element you configure (any CTA on storefront pages). Shopify Customer Events are pre-defined commerce events (product_viewed, cart_viewed, checkout_started) fired by Shopify automatically — they include checkout-page events that GTM can't reach. Use both: Customer Events for commerce actions, GA4 click events for custom CTAs.

How many click events should I track on a Shopify store?

Start with 5–10 high-value events (Add to Cart, Buy Now, View Details, Email Signup, key navigation links). Adding tracking to every clickable element creates noise that obscures the signals worth acting on. Track what you'd actually use to make decisions.

Why don't my GA4 click events show up in reports?

GA4 has a 24–48 hour processing delay for standard reports. Use DebugView (Configure → DebugView) for real-time confirmation. Also check: the event is firing (browser console), the event hits GA4 (Network tab → filter by collect), and the GA4 property is connected to your reporting view.

Will click tracking slow down my Shopify site?

Negligibly when implemented properly. A single document-level event listener with delegation (Method 3) adds 1–2KB and ~1ms per click. GTM-based tracking adds GTM's own ~70KB overhead, which is bigger but still acceptable. The win from data exceeds the cost.

Should I track clicks on every CTA on my Shopify store?

No. Track CTAs where click rate is decision-relevant: primary buy actions, alternative paths to purchase, lead capture forms. Skip tracking on logo clicks, basic navigation (page views cover this), and decorative buttons. The "if I knew this number, would I act on it?" filter applies.

Jacques's signature
Add conversion-focused buttons and CTAs by describing them.

You might also be interested in

How to Add Tracking Scripts to Shopify (2026)
Learn how to add tracking scripts to Shopify — via Customer Events (pixel manager), App Embeds, or theme.liquid. Covers placement and limitations.
How to Track Conversions in Shopify (2026)
Set up conversion tracking in Shopify across GA4, Google Ads, and Meta Pixel. Covers built-in analytics and the Customer Events API.
How to Track Scroll Events in Shopify (2026)
Add scroll depth tracking to your Shopify store. Fire GA4 events at 25%, 50%, 75%, and 100% scroll using GTM or custom JavaScript.