npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

agentrail-browser

v0.2.0

Published

The Agentrail browser script: on a site's pages, it records the steps a person or an agent in a browser takes.

Downloads

1,677

Readme

agentrail-browser

The Agentrail script, on a site's pages: the steps a person or an agent driving a browser takes, sent to the Agentrail collector with the browser source's public key. The proofs come first and need no consent: the session the edge set, a trace on every call to the site's own origins, the markers a page was reached by, and the page's WebMCP tool calls. Raw behaviour (timing only) and the tab's fingerprint are loaded apart, and each is off unless the site turns it on.

Nothing is read of what is typed, pasted or chosen, nor of the page itself.

Before 1.0, a minor version (0.1 to 0.2) may change what the package offers.

The tag

Agentrail's setup page gives the tag, with the source's public key:

<script async src="https://<collector>/agentrail.js" data-key="ajp_…"></script>
  • data-first-party: other origins whose calls carry the page's trace, comma-separated, as https://api.example.com.
  • data-behaviour="on": record raw behaviour, timing only.
  • data-fingerprint="on": read the tab's fingerprint, once a tab. Only for a visitor who has consented (see Consent).
  • data-session-idle: seconds without a request after which a visitor's session ends; 1800 (30 minutes) by default.
  • data-session-domain: the domain a session is shared across, as example.com; by default, the page's host.
  • data-collector: the collector, when it is not where the script came from.

The script is dist/agentrail.js in this package, one file.

From code

For a site that bundles the script itself:

npm install agentrail-browser
import { start } from 'agentrail-browser';

start({
  key: 'ajp_…',
  collector: 'https://<collector>/ingest/browser',
  firstParty: ['https://api.example.com'],
});

Once a page, as early as it can load. onError is told of every call the collector refused or never got; the page's console is warned otherwise. behaviour: true and fingerprint: true turn those parts on, and sessionIdleTimeout and sessionCookieDomain are the two session attributes above.

Consent

The proofs need no consent. The fingerprint identifies a visitor's browser, so turn it on only for a visitor who has consented: render data-fingerprint="on", or pass fingerprint: true, once the site's consent banner or cookie says yes. A visitor who consents part-way through a page is fingerprinted from their next page load.

The script runs on plain HTTP too, and in browsers from before 2023.

The session

The session is the cookie the edge sets (agentrail_session); on a site with no edge, the script sets it the same way. It ends after 30 minutes without a request, and a day after it began: every page view, a single-page app's routes too, writes it again for another 30 minutes. On a site with the edge, give both the same idle timeout and domain.

Licence

Apache-2.0.