7 releases
| 0.2.4 | Sep 25, 2025 |
|---|---|
| 0.2.3 | Sep 24, 2025 |
| 0.1.1 | Sep 4, 2025 |
#502 in GUI
1,065 downloads per month
56KB
329 lines
Tauri Plugin PostHog
A Tauri v2 plugin for integrating PostHog analytics into your Tauri applications.
Features
- Event tracking with custom properties
- User identification and aliasing
- Anonymous event tracking
- Batch event capture
- Device ID management
- TypeScript support
Installation
Add the plugin to your Tauri project:
# Add the Rust plugin
cargo add tauri-plugin-posthog
# Add the JavaScript API
pnpm add tauri-plugin-posthog-api
Usage
Rust Setup
Initialize the plugin in your Tauri app:
use tauri_plugin_posthog::{PostHogConfig, init};
fn main() {
tauri::Builder::default()
.plugin(init(PostHogConfig {
api_key: "your-posthog-api-key".to_string(),
..Default::default()
}))
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
Frontend Usage
import { PostHog } from 'tauri-plugin-posthog-api';
// Capture an event
await PostHog.capture('button_clicked', {
button: 'signup',
page: 'landing'
});
// Identify a user
await PostHog.identify('user-123', {
email: 'user@example.com',
plan: 'pro'
});
// Capture anonymous events
await PostHog.captureAnonymous('page_view', {
page: 'pricing'
});
License
This project is licensed under the MIT License.
Dependencies
~19–66MB
~1M SLoC