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

@hitkeep/tracker

v2.13.11

Published

Typed, cookieless web analytics tracker for React, Vue, Angular, and Astro. Official browser SDK for HitKeep, a privacy-friendly, self-hostable Google Analytics alternative.

Downloads

1,969

Readme

@hitkeep/tracker

npm version license zero dependencies types included

Typed, cookieless web analytics tracking for React, Vue, Angular, Astro, and any other bundler-based frontend — a privacy-friendly Google Analytics alternative that stores no cookies and needs no consent banner for basic measurement.

This is the official browser SDK for HitKeep, a self-hostable, GDPR-friendly analytics platform that runs as a single Go binary. The package bundles the same tracker that ships as HitKeep's hk.js snippet — compiled from the same source — as a fully typed ES module.

  • Cookieless by default — no cookies, no cross-site identifiers, no consent banner for basic analytics
  • Framework-native — no <script> tag, no window.hk casts, full TypeScript types
  • Automatic tracking — pageviews, SPA route changes, outbound links, file downloads, form submits
  • Typed e-commerce eventsview_item, add_to_cart, begin_checkout, purchase
  • Tiny and self-contained — ~3.7 kB gzipped, zero runtime dependencies, ESM + CJS

Install

npm install @hitkeep/tracker

Quick start

import { init, track } from '@hitkeep/tracker';

init({ host: 'https://your-hitkeep.example.com' });

track('signup_clicked', { plan: 'pro' });

host is the origin (or path prefix) your HitKeep instance serves the tracker from — the same URL the hk.js snippet would load from, including custom tracking domains. Pageviews are captured automatically, including history-based SPA navigations, so no router wiring is required.

Framework examples

React and Next.js

'use client';

import { useEffect } from 'react';
import { cleanup, init } from '@hitkeep/tracker';

export function Analytics() {
    useEffect(() => {
        init({ host: 'https://your-hitkeep.example.com' });
        return cleanup;
    }, []);

    return null;
}

Vue and Nuxt

import { createApp } from 'vue';
import { init } from '@hitkeep/tracker';
import App from './App.vue';

init({ host: 'https://your-hitkeep.example.com' });

createApp(App).mount('#app');

Angular

import { ApplicationConfig, provideAppInitializer } from '@angular/core';
import { init } from '@hitkeep/tracker';

export const appConfig: ApplicationConfig = {
    providers: [provideAppInitializer(() => init({ host: 'https://your-hitkeep.example.com' }))]
};

Astro

<script>
    import { init } from '@hitkeep/tracker';

    init({ host: 'https://your-hitkeep.example.com' });
</script>

Full walkthroughs for each framework, including Next.js App Router and Astro view transitions, are in the npm package guide.

API

| Export | Purpose | | :--- | :--- | | init(config) | Start the tracker and return a handle. Idempotent. | | track(name, properties?) | Record a custom event. Calls before init are queued. | | trackPageview() | Send a manual pageview. | | cleanup() | Remove listeners and allow re-initialization. | | blockTrackingForMe() / enableTrackingForMe() / isTrackingEnabled() | Visitor opt-out controls. | | trackViewItem / trackAddToCart / trackBeginCheckout / trackPurchase | Typed e-commerce events. |

Configuration

init({
    host: 'https://your-hitkeep.example.com', // required
    autoCapturePageviews: true, // send a pageview on init
    autoTrackSpaNavigation: true, // pageviews on pushState/replaceState/popstate
    outboundLinks: true, // outbound_click events
    fileDownloads: true, // file_download events
    formSubmissions: true, // form_submit events
    webVitals: false, // load the Web Vitals bundle from `${host}/hk-vitals.js`
    useBeacon: true, // prefer navigator.sendBeacon
    respectDoNotTrack: true, // drop tracking when DNT is enabled
    captureOnLocalhost: false, // localhost is blocked by default
    bindToWindow: true // expose window.hk.event for snippet-compatible callers
});

Each option maps to a hk.js data attribute where one exists — see the tracker architecture guide for the delivery, retry, and storage behavior shared by both.

E-commerce

import { trackPurchase } from '@hitkeep/tracker';

trackPurchase({
    transaction_id: 'tx-1042',
    value: 49.9,
    currency: 'EUR',
    items: [{ item_id: 'sku-1', item_name: 'Starter Plan', quantity: 1, price: 49.9 }]
});

Visitor opt-out

This package bundles the tracker into your application, so content blockers do not filter it. Offer visitors an explicit opt-out:

import { blockTrackingForMe, enableTrackingForMe, isTrackingEnabled } from '@hitkeep/tracker';

The opt-out persists in localStorage under hk_ignore and is honored by both this package and the hk.js snippet.

What you need to run it

The package sends data to a HitKeep instance. You can self-host HitKeep as a single binary, Docker image, or Helm chart, or use HitKeep Cloud. HitKeep is open source under the MIT license — the source for this package lives in PascaleBeier/hitkeep.

Documentation

Versioning

This package is versioned in lockstep with HitKeep itself and published with every HitKeep release. Keep the major version aligned with your HitKeep instance.

License

MIT © Pascale Beier — see LICENSE.