The Hidden HTML5 Feature That Tracks Clicks Without JavaScript

The Hidden HTML5 Feature That Tracks Clicks Without JavaScript

Amit Kumar

The Hidden HTML5 Feature That Tracks Clicks Without JavaScript

Last week I was going through the an interesting article on one of the oldest HTML elements. I am talking about our beloved <a> tag.

As HTML grew with time, it added a numbers of new features. Today I am going to show one of those cool features added to the <a> tag in HTML5.

I have tried this for adding to add some tracking capabilities for link clicks. We will see how it works, what are it’s practical applications, and how it can affect privacy when used.

Let’s get started with the fun part.

Tracing Link Clicks Without JavaScript

Now let’s try to understand the attribute that allows you to trace link clicks on your web application without using JavaScript.

The ping attribute is a part of the <a> tag. When someone clicks a link with ping, the browser sends a POST request to whatever URL you specify. The user still lands on their destination. The tracking happens in parallel, silently.

Visit Example

Click that link and two things happen at once: the browser navigates to example.com, and it fires a POST to tracker.com/log.

You can add more than one link to the ping attribute:

<a
id=“exampleLink”
href=“https://example.com”
ping=“https://example-tracking.com https://example-analytics.com”

Example Link</a

How It Works Behind the Scenes?

The moment someone clicks, the browser prepares two actions:

  • One opens the destination.
  • The other sends a POST request with basic metadata: the link’s href, the referrer, maybe some browser details.

Both happen together. Neither waits for the other. The POST request includes: the URL that was clicked, the page where the click happened, minimal browser context That’s it. No bloated payloads. No complex headers.

Why I Started Using Ping?

Let’s try to understand why I love it at the first sight:

  • It removes dependencies: I used to set up tracking libraries that added 30KB just to log clicks. Ping does the same job with one attribute. Zero kilobytes. Zero external calls.
  • Pages load faster: JavaScript tracking means event listeners, DOM queries, fetch calls, all eating cycles. Ping is native browser behavior. It doesn’t touch your performance budget.
  • Users flow naturally: No redirect chains. No popup delays. People click and arrive instantly. Tracking happens where it should: in the background.
  • Compliance gets easier: When you’re only sending a link and a referrer, privacy policies get simpler. You’re not shipping entire user profiles to third parties.

The Privacy Concern

Here’s where it gets tricky. Ping is silent. Users don’t see it firing. They click a link, unaware that a POST request just left their browser.

Some folks call that sneaky. I call it invisible but invisible can feel sneaky if you’re not transparent.

  • Tracking without awareness: Most people don’t know ping exists. They click, thinking they’re just navigating. Meanwhile, their action gets logged somewhere.
  • Data going places: That ping URL could route anywhere. To your analytics server. To a third-party network. To someone you didn’t intend to share with.
  • Limited control: Unlike JavaScript, which can be blocked by common tools, ping flies under the radar. Most users don’t know how to disable it.

Browser Support

Chrome, Firefox, Safari, Edge they all support ping. Some privacy-focused browsers disable it by default. Most extensions don’t catch it unless they’re specifically hunting for it.

Disabling Ping For Privacy

For anyone worried about being tracked, here’s how to turn it off.

  • Firefox:
  • Type about:config in the address bar.
  • Search for browser.send_pings.
  • Set it to false.
  • Chrome:
  • Install Privacy Badger or uBlock Origin.
  • Both block ping requests by default.
  • Extensions that help:
  • Privacy Badger
  • uBlock Origin

Final Takeaway

Ping isn’t a replacement for robust analytics platforms. It’s not going to give you heatmaps or user flows or funnel analysis.

But if you just need to know “did someone click this link,” it’s perfect.

The catch is transparency. If you’re using ping, tell your visitors. Don’t hide it. Don’t assume they won’t care.

Respect their privacy. Use the data responsibly. That’s how you turn a technical feature into something genuinely useful instead of something that feels gross.

I will love to see your thoughts and suggestions in comments below.

Thank you. Let’s meet again with another cool HTML nugget.


Amit Kumar

Written by Amit Kumar

https://amit08255.medium.com/?source=post_page---post_author_info--416ee6b571fd---------------------------------------

4.4K followers

3 following

Amit Kumar is a frontend developer who love designing web applications with clean, consistent User Interface.