Ping Tracker is a tiny library that adds ping
attribute to all <a>
tags on the site with customizable list of URLs.
- 🏓 Add
ping
attribute to all<a>
tags automatically - 👀 Watch for changes using
MutationObserver
to modify newly added links - 📝 Customize the content of the
ping
tag (list of URLs) - ⚡️ Tiny library (2.5kB minified, 1.1kB gzipped)
- 📭 No dependencies
- 🌳 Tree-shakeable
- 🔥 Written in TypeScript
npm i ping-tracker
import { PingTracker } from "ping-tracker";
const pt = new PingTracker("https://analytics.example.com");
// Or with options
const pt = new PingTracker("https://analytics.example.com", {
hrefToQuery: false,
onlyExternal: false,
watchDOM: true,
elementsToWatch: document.body,
});