A Tauri v2 plugin for integrating PostHog analytics into your Tauri applications.
- Event tracking with custom properties
- User identification and aliasing
- Anonymous event tracking
- Batch event capture
- Device ID management
- TypeScript support
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-apiInitialize 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");
}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: '[email protected]',
plan: 'pro'
});
// Capture anonymous events
await PostHog.captureAnonymous('page_view', {
page: 'pricing'
});This project is licensed under the MIT License.