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:
[]
= "0.1.0"
[]
= { = "https://github.com/lispking/tauri-plugin-telemetry" }
Install the JavaScript guest bindings with your preferred package manager:
Usage
Register the plugin with Tauri, pointing it at your analytics backend via
InitOptions.host:
src-tauri/src/main.rs
use ;
async
Then add telemetry:allow-track-event to your Access Control List.
Send events from Rust via the EventTracker trait:
use EventTracker;
async
The trackEvent function is also available through the JavaScript guest bindings:
import from "@telemetry/tauri";
// An event with no properties
// An event with a custom property
A few important notes:
- The plugin automatically enriches each event with useful information: OS, app version, locale, and other system properties.
- You're in control of what gets sent. No events are tracked automatically —
call
trackEventmanually (it's recommended to at least track one event at startup). - You don't need to await
trackEvent; it runs in the background. - 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 ;
use dotenv;
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. The
relevant InitOptions fields:
use ;
let opts = InitOptions ;
default
.plugin
.run
.expect;
Inspired by the Aptabase analytics platform, which is a great option if you don't want to self-host.