How to track button clicks in WordPress (without Google Tag Manager)

Three ways to count clicks on a WordPress button, what each one involves, and which to pick.

You’ve added a “Book now” button to your homepage. Is anyone clicking it? Page views won’t tell you. You need to count clicks on the button itself.

There are three realistic ways to do that in WordPress. They all work. Which one you choose depends on how much setup you’re happy with and where you want to see the numbers.

Option 1: Google Analytics with Google Tag Manager

This is the route most tutorials describe.

  1. Install Google Tag Manager on your site (with a plugin or by pasting its snippet into your theme).
  2. In Tag Manager, switch on the built-in click variables.
  3. Create a trigger that fires on clicks where Click Classes contains your button’s class.
  4. Create a GA4 event tag that uses the trigger, and give the event a name such as book_now_click.
  5. Preview, test, publish.
  6. In GA4, wait for the data to arrive (it can take up to a day), then build an exploration report to see it.

Good for: sites already run through Tag Manager, and teams that want clicks next to their ad and traffic data.

Downsides: quite a few steps per button. GA4 only counts visitors who accept analytics cookies and don’t block Google, so on many UK and EU sites you’ll miss a big share of clicks. The numbers also live in Google, not in your WordPress dashboard.

Option 2: Write your own code

If you’re comfortable with PHP and JavaScript, you can listen for clicks and store them yourself:

document.addEventListener('click', function (e) {
  if (e.target.closest('.book-now')) {
    navigator.sendBeacon('/wp-admin/admin-ajax.php',
      new URLSearchParams({ action: 'count_click', type: 'book-now' }));
  }
});

Then you need a matching wp_ajax_nopriv_count_click handler that saves to the database, plus a screen to read the results.

Good for: developers who want full control.

Downsides: the counting is the easy part. Charts, date ranges, bot filtering, double-click handling, pages that are cached, and exports are what take the time.

Option 3: A click tracking plugin

A plugin does the listening, storing and reporting for you. With WP Click Tracker it’s:

  1. Install and activate the plugin.
  2. Go to Click Tracker → Trackers → New tracker.
  3. Give it a name and enter the button’s class or ID, for example .book-now.

That’s the whole setup. Clicks appear on the dashboard as they happen, with the page they happened on, the device type, and a comparison with the previous period.

Good for: site owners who want an answer to “is anyone clicking this?” without a Tag Manager project.

Downsides: it counts clicks on your site. It isn’t a replacement for full traffic analytics.

Which one should you use?

  • Already living in Google Tag Manager and GA4? Add a click trigger there.
  • A developer who enjoys building this kind of thing? Write your own.
  • Want click counts in WordPress in five minutes? Use a plugin.

Whichever you pick, the first step is the same: you need the button’s CSS class or ID. If you’re not sure how to find it, see how to find the CSS class or ID of any button.