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

tauri-plugin-telemetry

v0.1.3

Published

Backend-agnostic analytics/telemetry plugin for Tauri v2 apps. Redirect events to any backend.

Readme

Tauri Plugin for Telemetry

A backend-agnostic analytics/telemetry plugin for Tauri v2 apps. Send events to any backend that implements the ingest protocol — point the plugin at your own backend with InitOptions.host.

Install

Add the Rust crate to src-tauri/Cargo.toml:

[dependencies]
tauri-plugin-telemetry = "0.1.3"
[dependencies]
tauri-plugin-telemetry = { git = "https://github.com/lispking/tauri-plugin-telemetry" }

Install the JavaScript guest bindings with your preferred package manager:

npm add tauri-plugin-telemetry
npm add https://github.com/lispking/tauri-plugin-telemetry

Usage

Register the plugin with Tauri:

src-tauri/src/main.rs

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_telemetry::init("APP_KEY"))
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

If you need to point the plugin at your own backend, use Builder::with_host:

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_telemetry::Builder::new("APP_KEY")
            .with_host("https://analytics.myapp.com")
            .build())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

For full control over all options, use with_options:

use tauri_plugin_telemetry::{Builder, InitOptions};
use std::time::Duration;

fn main() {
    let opts = InitOptions {
        host: Some("https://analytics.myapp.com".into()),
        flush_interval: Some(Duration::from_secs(30)),
        api_path: Some("/ingest".into()),
        ..Default::default()
    };

    tauri::Builder::default()
        .plugin(Builder::new("APP_KEY").with_options(opts).build())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Then add telemetry:allow-track-event to your Access Control List.

Send events from Rust via the EventTracker trait:

use tauri_plugin_telemetry::{init, EventTracker};

fn main() {
    tauri::Builder::default()
        .plugin(init("APP_KEY"))
        .setup(|app| {
            app.track_event("app_started", None);
            Ok(())
        })
        .build(tauri::generate_context!())
        .expect("error while running tauri application")
        .run(|handler, event| match event {
            tauri::RunEvent::Exit { .. } => {
                handler.track_event("app_exited", None);
                handler.flush_events_blocking();
            }
            _ => {}
        })
}

The trackEvent function is also available through the JavaScript guest bindings:

import { trackEvent } from "tauri-plugin-telemetry";

trackEvent("save_settings") // An event with no properties
trackEvent("screen_view", { name: "Settings" }) // An event with a custom property

A few important notes:

  1. The plugin automatically enriches each event with useful information: OS, app version, locale, and other system properties.
  2. You're in control of what gets sent. No events are tracked automatically — call trackEvent manually (it's recommended to at least track one event at startup).
  3. You don't need to await trackEvent; it runs in the background.
  4. Only string and number values are allowed in custom properties.

Providing the APP_KEY via .env

You can load the App Key from a .env file at compile time using the dotenvy_macro crate. The .env file must be in the src-tauri directory.

use tauri_plugin_telemetry::{Builder, EventTracker, InitOptions};
use dotenvy_macro::dotenv;

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    let opts = InitOptions {
        host: Some("https://analytics.myapp.com".into()),
        ..Default::default()
    };

    tauri::Builder::default()
        .build(tauri::generate_context!())
        .plugin(Builder::new(dotenv!("APP_KEY")).with_options(opts).build())
        .expect("Error when building tauri app")
        .run(|handler, event| match event {
            tauri::RunEvent::Exit { .. } => {
                handler.track_event("app_exited", None);
                handler.flush_events_blocking();
            }
            tauri::RunEvent::Ready { .. } => {
                handler.track_event("app_started", None);
            }
            _ => {}
        });
}

For AI/LLM integration instructions, see llms.txt

Using a custom backend (self-hosting)

The plugin can point at any backend that implements its ingest protocol.

For most cases, with_host is enough:

tauri_plugin_telemetry::Builder::new("APP_KEY")
    .with_host("https://analytics.myapp.com")
    .build()

All available options (with their defaults):

use tauri_plugin_telemetry::{Builder, InitOptions};

let opts = InitOptions {
    host: Some("https://analytics.myapp.com".into()),   // required
    api_path: Some("/v1/events".into()),                 // default: /v1/events
    app_key_header: Some("App-Key".into()),              // default: App-Key
    sdk_name: Some("[email protected]".into()),                // default: <crate>@<version>
    flush_interval: Some(Duration::from_secs(60)),       // default: 60s release / 2s debug
    ..Default::default()
};

Builder::new("APP_KEY").with_options(opts).build()

Inspired by the Aptabase analytics platform, which is a great option if you don't want to self-host.