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

typedoc-plugin-umami-analytics

v1.0.1

Published

A TypeDoc plugin for integrating the Umami Analytics tracking script into generated documentation.

Readme

typedoc-plugin-umami-analytics

A TypeDoc plugin for integrating Umami Analytics into your documentation.

This plugin automatically inserts the Umami Analytics tracking script into the generated TypeDoc HTML pages, allowing you to track page views and events on your documentation website.

Why?

TypeDoc is a powerful tool for generating documentation from TypeScript code, but it does not include built-in analytics capabilities. If you want to track how users interact with your documentation, you typically need to integrate a third-party analytics solution.

Umami Analytics is a simple, open-source web analytics solution that provides insights into your website's traffic without compromising user privacy. It is 100% free when self-hosted and does not use cookies, making it a great choice for developers who want to track their documentation usage without the overhead of traditional analytics solutions.

Since I use both of these tools in my projects, I decided to create this plugin to make it easier for myself (and you!) to integrate Umami Analytics into TypeDoc-generated documentation.

Installation

npm install --save-dev typedoc-plugin-umami-analytics

Usage

This plugin can be used with TypeDoc either via command line argument, or programmatically via a TypeDoc config file.

Command Line

typedoc --plugin typedoc-plugin-umami-analytics

TypeDoc Config File

// typedoc.json
{
  "plugin": ["typedoc-plugin-umami-analytics"],
}

Configuration Options

You can configure the plugin by passing options in your TypeDoc config file or via command line arguments.

Required Options

In order to use this plugin, you must provide the following options:

{
  "plugin": ["typedoc-plugin-umami-analytics"],
  // Required: The URL of your Umami Analytics tracking script, e.g. "https://example.com/script.js"
  "umamiScriptURL": "https://example.com/script.js",
  // Required: The website ID for your Umami Analytics instance. You can find this in your Umami dashboard.
  "umamiWebsiteID": "your-website-id",
}

This input will result in the following HTML being added before the closing </body> tag of each generated HTML page:

<script
  defer
  src="https://example.com/script.js"
  data-website-id="your-website-id"></script>

Additional Options

You can also provide the following optional configuration options (in line with the Umami Tracker Configuration options):

{
  /**
   * The URL of the Umami Analytics host, e.g. "https://example-other.com"
   *
   * Only use this if your Umami instance is hosted on a different domain than the script URL.
   * If not specified, the script URL's domain will be used.
   */
  "umamiHostURL": "https://example-other.com",
  /**
   * Whether to automatically track page views and events.
   * Defaults to true.
   */
  "umamiAutoTrack": false,
  /**
   * A list of domains to track.
   * If specified, only these domains will be tracked.
   * If not specified, all domains where the script is loaded will be tracked.
   */
  "umamiDomains": ["example.com", "example.org"],
  /**
   * A tag to associate with the analytics data.
   * This can be used to filter or categorize the data in your Umami Analytics dashboard.
   */
  "umamiTag": "documentation",
  /**
   * Whether to exclude search parameters from the URL when tracking page views.
   * Defaults to false.
   */
  "umamiExcludeSearch": true,
  /**
   * Whether to exclude hash fragments from the URL when tracking page views.
   * Defaults to false.
   */
  "umamiExcludeHash": true,
  /**
   * Whether to respect the Do Not Track setting in the user's browser.
   * If true, no analytics data will be sent if the user has enabled Do Not Track.
   * Defaults to false.
   */
  "umamiDoNotTrack": true,
}

Type-Checking Configuration

This plugin also exposes TypeScript types for the configuration options, so you can use them in your TypeDoc config file to enable type-checking and IDE intellisense. Simply switch from a typedoc.json file to a typedoc.config.mjs file and import the types like so:

/** @type {Partial<import('typedoc').TypeDocOptions> & Partial<import('typedoc-plugin-umami-analytics').Config>} */
const config = {
  // ...other TypeDoc options
  plugin: [
    // ...other plugins,
    'typedoc-plugin-umami-analytics',
  ],
  umamiScriptURL: 'https://example.com/script.js',
  umamiWebsiteID: 'your-website-id',
};

export default config;

Contributing

If you find a bug or have a feature request, please open an issue in GitHub Issues.

If you want to contribute code, feel free to submit a pull request!

License

This plugin is licensed under the Apache License 2.0. See the LICENSE file for more details.