ping-tracker
TypeScript icon, indicating that this package has built-in type declarations

0.3.4 • Public • Published

Ping Tracker

Ping Tracker logo

npm version npm TypeScript version Tree shaking Dependencies Gzipped Commits Issues License Follow GitHub Sponsors

Ping Tracker is a tiny library that adds ping attribute to all <a> tags on the site with customizable list of URLs.

Features

  • 🏓 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.7kB minified, 1.2kB gzipped)
  • 📭 No dependencies
  • 🌳 Tree-shakeable
  • 🔥 Written in TypeScript

Installation

npm i ping-tracker

Usage

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,
});

Package Sidebar

Install

npm i ping-tracker

Weekly Downloads

1

Version

0.3.4

License

MIT

Unpacked Size

25.8 kB

Total Files

11

Last publish

Collaborators

  • matronator