Engagement

Click tracking: how links, buttons and downloads get counted

By Hasan Misbah · Updated · 7 min read

Share

Quick answer

Click tracking is recording when visitors click particular links, buttons or files on your site, such as a link to another website, a “Book now” button or a PDF download. Each click is sent to your analytics as an event, so you can see which options people actually use rather than guessing.

What click tracking covers

Pageviews tell you which pages people saw. They don’t tell you what people did on those pages, and a lot of the actions that matter don’t load a new page on your site at all.

The usual candidates:

  • Outbound links. A link to an affiliate partner, a stockist, your Etsy shop or an external booking system. The visitor leaves your site, so without a click event you’d only see an exit.
  • Downloads. A PDF menu, a price list, a free worksheet for your course. The file opens, but most analytics scripts don’t run inside a PDF.
  • Buttons. “Add to basket” on a shop page that updates without reloading, “Book a call”, “Show prices”, a video play button.
  • Phone and email links. For a plumber or a yoga studio, a tap on the phone number is often the enquiry itself.

In each case the click is the only signal you’ll get, so it’s worth recording on purpose.

How it works behind the scenes

You don’t need to write the code yourself, but knowing the moving parts helps you judge a plugin or a developer’s set-up.

Event listeners

A small script asks the browser to report clicks. Rather than attach a listener to every link one by one, most scripts put a single listener on the whole page and check what was clicked each time. This approach, called event delegation, also catches buttons that appear later, such as a mini basket that opens after someone adds a product.

For each click, the script decides whether it’s interesting. Outbound links are spotted by comparing the link’s domain with your own. Downloads are usually spotted by file extension, such as .pdf, .zip or .docx. Phone and email links start with tel: and mailto:, which makes them easy to pick out.

Data attributes

For buttons, a cleaner method is to label the elements you care about directly in the HTML, for example data-track=”book-call”. The script then records only clicks on labelled elements and uses the label as the event name.

The benefit is stability. If you change the button text from “Book a call” to “Get in touch” or move it during a redesign, the label stays the same and your reports don’t break. The block editor doesn’t offer a field for custom attributes, so on WordPress sites a CSS class added in a block’s Advanced settings is a common stand-in.

Sending the click before the page changes

There’s a catch with links. When someone clicks through to another site, the browser starts closing the current page straight away, and a normal request can be cancelled before it finishes. Browsers provide a method designed for this, the Beacon API, which hands a small message to the browser to send in the background even as the page unloads. Older set-ups delayed the link briefly to give the request time, which makes the site feel sluggish. Avoid that approach.

Click-tracking links in emails

There’s a second, quite different thing people mean by the term. Email platforms and link shorteners rewrite each link so it passes through their own server first. The server logs the click and then redirects the reader on to the real address. That’s how your newsletter tool knows who clicked what. It tells you about the email, not about behaviour on your site; for that, add UTM parameters to the destination so your own analytics can see where the visitor came from.

Ready-made options

You may not need anything custom. GA4’s enhanced measurement can record outbound clicks and file downloads automatically once it’s switched on. Button clicks usually need a tag manager trigger or a custom event. Several WordPress analytics and tag plugins add click events for common cases too.

Whatever you use, test it. Click each tracked link yourself, then check that exactly one event arrived with a sensible name. Double-counting is a common fault, especially when two plugins both try to track the same thing.

What to track and what not to bother with

Track clicks you’ll make decisions about. Skip everything else, because a report full of clicks nobody acts on hides the few that matter.

Worth trackingUsually not worth it
“Book”, “Enrol” and “Add to basket” buttonsEvery menu and footer link, since the next pageview already shows where people went
Phone and email links on a service business siteLogo clicks
Outbound links where the sale happens elsewhere (affiliates, stockists, external booking)Accordions, tabs and sliders, unless you’re redesigning them
Downloads of brochures, menus and lead magnetsClicks that lead to a page you already track as a conversion

That last row deserves a word. A click is intent, not outcome. Someone clicking “Pay now” hasn’t paid; the card might be declined. Where you can, measure the result itself, such as the order, the enrolment or the form submission, and treat clicks as a stand-in only where the result happens out of your sight. That’s the idea behind goal tracking: decide what a conversion is, then measure that. Analyzine, for instance, ties WooCommerce orders and LearnDash enrolments to the source and campaign that brought the visitor, which answers the “did it work” question more directly than any button click.

A simple test before adding an event: can you name what you’d change if the number went up or down? If not, leave it out.

Privacy considerations

Clicks feel harmless, and on their own they mostly are. A count of how many people tapped “Book a class” says nothing about who they were. Things change once a click is stored alongside an IP address, a cookie ID or a logged-in account, because it can then become personal data under laws such as the GDPR. This is general information, not legal advice, but a few habits keep you on safer ground:

  • Never record what people type. Some tools can capture form field values. Switch that off.
  • Watch the URLs. Links in account areas, order pages and password resets can carry names, email addresses or tokens in the query string. Strip query strings from recorded links, or don’t track those areas at all.
  • Use fixed labels, not button text. A button that reads “Download invoice for Sarah Jones” leaks a name; an event called invoice-download doesn’t.
  • Be careful with session recordings and heatmaps. They capture far more than clicks, including mouse movement and scrolling, and need a much more careful look before you install them.
  • Honour opt-outs. If a visitor has declined tracking through your consent banner or a browser signal, that should cover click events as well.

In the UK and EU, rules on storing or reading information on a visitor’s device apply whatever you’re measuring, so a click-tracking set-up that relies on cookies will usually need consent. The details differ between countries; our privacy laws overview is a starting point.

How clicks connect to your other numbers

Click events change how other metrics behave. Outbound clicks explain many exits, so a high exit rate on a “where to buy” page is good news if the outbound clicks are there too. In some tools, recording an event also stops a single-page visit counting as a bounce, so adding click events can make your bounce rate drop overnight without anyone behaving differently. Note the date you switch it on.

Start with three or four clicks that clearly matter to your business, check they record correctly, and add more only when a real question calls for them.

Frequently asked questions

How does click tracking work?

A script on your page listens for clicks and checks whether the clicked element is one you care about, such as an outbound link, a download or a labelled button. If it is, it sends a small event to your analytics, often using a browser method built to survive the page closing.

Can Google Analytics track clicks?

Yes. GA4’s enhanced measurement can record outbound link clicks and file downloads automatically when it’s turned on. Other button clicks usually need a custom event, set up through a tag manager or a plugin.

What is a click tracking URL?

It’s a link that passes through a tracking server before sending you to the real page, used by email platforms and link shorteners to count clicks. The server logs the click, then redirects. It measures the email or the link, not what the visitor does on your site.

How do I track button clicks in WordPress?

Give the button a stable label, such as a CSS class in the block’s Advanced settings, then set up a click trigger for that label in your tag manager or analytics plugin. Test it by clicking the button yourself and checking a single event arrives.

Do I need consent for click tracking?

It depends on how it’s done and where your visitors are. In the UK and EU, a set-up that stores or reads cookies or similar data on the visitor’s device usually needs consent, while the rules for other approaches vary. This is general information; check the guidance that applies to your site.

Be first to see where your revenue really comes from

Add your email and we'll let you know the moment early access opens.

Waitlist

We'll email you when early access opens. No spam, unsubscribe anytime. See our Privacy Policy.

Waitlist members get

  • Early access
  • Launch discount
  • Integration requests first
  • Setup help

Join the Analyzine waitlist

Leave your details and we'll let you know when early access opens.

Waitlist

We'll email you when early access opens. No spam, unsubscribe anytime. See our Privacy Policy.

Waitlist members get

  • Early access
  • Launch discount
  • Integration requests first
  • Setup help