#tauri-plugin #post-hog #devices #integrating #analytics

sys tauri-plugin-posthog

A Tauri v2 plugin for integrating PostHog analytics into your Tauri applications

7 releases

0.2.4 Sep 25, 2025
0.2.3 Sep 24, 2025
0.1.1 Sep 4, 2025

#502 in GUI

Download history 161/week @ 2025-10-13 145/week @ 2025-10-20 120/week @ 2025-10-27 181/week @ 2025-11-03 295/week @ 2025-11-10 316/week @ 2025-11-17 240/week @ 2025-11-24 160/week @ 2025-12-01 133/week @ 2025-12-08 166/week @ 2025-12-15 131/week @ 2025-12-22 104/week @ 2025-12-29 99/week @ 2026-01-05 318/week @ 2026-01-12 261/week @ 2026-01-19 369/week @ 2026-01-26

1,065 downloads per month

MIT license

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