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
# Add the JavaScript API
Usage
Rust Setup
Initialize the plugin in your Tauri app:
use ;
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.