Track Button Clicks in WordPress

How to Track Button Clicks in WordPress (The Easy Way)

Do you want to track button clicks in WordPress? Tracking clicks on your call-to-action buttons can help you to see which buttons are performing best (or worst).

Once you can see which buttons get clicks and which ones get ignored, you can tell what’s working on your pages and fix what isn’t pulling its weight.

In this guide, I’ll show you how to track button clicks in WordPress the easy way, using MonsterInsights and Google Analytics. You won’t need to write any JavaScript or touch Google Tag Manager to do it.

Can Google Analytics Track Button Clicks?

Yes, you can absolutely track button clicks in Google Analytics. But if you’ve already looked at button tracking tutorials, you’ll already know that it’s tricky to set everything up.

To set up tracking manually, you might need to write JavaScript and work with Google Tag Manager. There is a much easier way to track button clicks using the MonsterInsights plugin.

It lets you easily add tracking code to your buttons in WordPress so you can track them in Google Analytics without writing JavaScript. There’s more information in our MonsterInsights review.

For this tutorial, you’ll just need to add a few extra tags to the HTML code for your call-to-action button. Let’s go ahead and get started.

How to Track Button Clicks in WordPress

Below, I’ll walk you through installing MonsterInsights and then tracking the button clicks you care about, from call-to-action buttons to eCommerce and click-to-call buttons.

What You’ll Need

Before you start, make sure you have a Google Analytics 4 account for your website and the MonsterInsights plugin ready to install.

The custom button tracking below works once MonsterInsights is connected, and the eCommerce tracking needs a MonsterInsights Pro license or higher.

Install and Connect MonsterInsights

Go ahead and install the MonsterInsights plugin on your site. If you’ve never added a plugin before, this guide on how to install a plugin in WordPress walks you through it.

Once it’s active, enter your license key and click Connect MonsterInsights to link your site to Google Analytics.

Connect MonsterInsights for button tracking

The setup wizard then asks you to choose the Google account that owns your Analytics property and authorize the connection. This is the part that scares people off when they try to wire it up manually, but MonsterInsights turns it into a few clicks.

Connect MonsterInsights to track button clicks in WordPress

With your site connected, your reports live under Insights » Reports right inside WordPress, and the same data also flows into Google Analytics, so you can check button performance wherever you prefer to work.

Method 1: Track Call-to-Action (CTA) Button Clicks

Use this when you want to track clicks on specific call-to-action buttons, like Sign Up, Buy Now, or Book a Demo.

MonsterInsights already tracks your outbound and affiliate link clicks on its own. If you want to go deeper on link tracking in WordPress, that guide is worth a read.

Call-to-action buttons usually work best with custom event tracking, though, because it lets you label each button and tell them apart in your reports.

To track a CTA button, you add three attributes to its HTML:

  • data-vars-ga-category sets the category the event falls under in Google Analytics, like “CTA Buttons”
  • data-vars-ga-action describes the action, such as “click”
  • data-vars-ga-label names the specific button so you can recognize it later, like “Homepage Hero Button”

Put together, the HTML for a tracked button looks like this:

<a class="cta-button" href="https://example.com/pricing/" data-vars-ga-category="CTA Buttons" data-vars-ga-action="click" data-vars-ga-label="Homepage Hero Button">Start Your Free Trial</a>

When someone clicks that button, MonsterInsights sends it to Google Analytics as an event, and your category, action, and label come through as the event details. You’ll see the click in your GA4 Events report and in the MonsterInsights reports in your dashboard.

From there, you can mark important button clicks as key events in Google Analytics so they sit alongside your other conversions. For a closer look at reading this data, MonsterInsights has a guide on tracking custom events in Google Analytics.

Method 2: Track eCommerce Button Clicks

Use this when you run an online store and want to see how often people click buttons like Add to Cart or Checkout.

For eCommerce buttons, MonsterInsights has a dedicated eCommerce addon that does the tracking for you. It works with stores built on WooCommerce, Easy Digital Downloads, and a few other platforms, and it starts collecting button clicks as soon as you activate it. The eCommerce addon is available with a MonsterInsights Pro license or higher.

Activate MonsterInsights eCommerce addon for button tracking

Once it’s running, you can see how many times shoppers clicked Add to Cart over any time period you choose, without adding a single attribute by hand.

eCommerce button tracking in Google Analytics

The addon also reports the numbers that sit behind those clicks, like your conversion rate, total revenue, and average order value, so you can connect button activity to actual sales.

eCommerce button and conversion tracking in WordPress

If you’re still choosing the tools for your store, this roundup of the best WooCommerce plugins is a good place to start.

Method 3: Track Click-to-Call and Download Button Clicks

Use this when your site has click-to-call phone buttons or download buttons and you want to know how often visitors use them.

Phone links and download buttons are easy to overlook, but they often signal real intent. Someone tapping a click-to-call button on mobile is usually a strong lead, and a download click often means a visitor wants your guide, menu, or price list.

click to download report monsterinsights

You can track these the same way you track CTA buttons. Add the data-vars-ga-category, data-vars-ga-action, and data-vars-ga-label attributes to the phone link or download link, and give each one a clear label like “Header Phone Number” or “Pricing PDF Download.” MonsterInsights then reports the clicks right next to your other button events.

For downloads that point to files like PDFs, GA4 may also pick up the click through Enhanced Measurement. Adding your own label still makes the data much easier to read.

FAQs About Tracking Button Clicks in WordPress

You might still have a few questions about tracking button clicks in WordPress. Below are quick answers to the ones I get asked most often.

Can I track button clicks without a plugin?

Yes, but it’s a lot more work. You would need to add custom JavaScript and usually set up events in Google Tag Manager, then connect everything to Google Analytics by hand. A plugin like MonsterInsights skips all of that and adds the tracking code for you.

Does Google Analytics 4 track button clicks automatically?

GA4 tracks some clicks on its own through Enhanced Measurement, including outbound links and file downloads. It won’t tell your individual call-to-action buttons apart, so custom event tracking is still the way to get button-by-button data.

Do I need to know how to code?

No. Tracking a CTA button means copying three attributes into a button’s HTML, and eCommerce button tracking needs no code at all once the addon is active. If you can paste a snippet into the block editor, you can do this.

Can I track clicks on buttons in the WordPress block editor?

Yes. When you add a button with the block editor, select the block, switch it to Edit as HTML, and add the same data-vars-ga attributes to the link. The click then tracks just like any other CTA button.

Next, Track Your Form Submissions and Conversions

Buttons are only part of the picture, because your forms have a submit button too. Tracking those clicks tells you how many visitors complete a form versus how many only start one.

If you use WPForms, the User Journey addon shows you the exact path a visitor took before they hit submit, so you can see which pages and buttons led to the conversion.

From there, it’s worth setting up full conversion tracking. This guide to tracking WordPress form conversions walks through it step by step with MonsterInsights.

And you can dig into your WPForms form analytics to spot where your forms can improve. A few more guides cover the other conversions worth tracking once your buttons are sorted.

Start Tracking Your Form Conversions

Ready to build your form? Get started today with the easiest WordPress form builder plugin. WPForms Pro includes lots of free templates and offers a 14-day money-back guarantee.

If this article helped you out, please follow us on Facebook and Twitter for more free WordPress tutorials and guides.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPForms is funded, why it matters, and how you can support us.

Hamza Shahid

Hamza is a Writer for the WPForms team, who also specializes in topics related to digital marketing, cybersecurity, WordPress plugins, and ERP systems. Learn More

The Best WordPress Drag and Drop Form Builder Plugin

Easy, Fast, and Secure. Join over 6 million website owners who trust WPForms.

2 comments on “How to Track Button Clicks in WordPress (The Easy Way)

    1. Hi Renan! While it’s possible to track forms without the MonsterInsights plugin, it’ll require adding JavaScript and working with Google Tag Manager, which can be tricky to set up. MonsterInsights simplifies this process, and adds tracking code easily without writing JavaScript. Hope this helps!

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

This form is protected by Cloudflare Turnstile and the Cloudflare Privacy Policy and Terms of Service apply.