# How Analytics Tracking is Integrated into the Meetily Application

> Discover how Meetily integrates analytics tracking using a TypeScript wrapper and Rust Tauri commands to capture user interactions and session data.

- Repository: [Zackriya Solutions/meetily](https://github.com/Zackriya-Solutions/meetily)
- Tags: architecture
- Published: 2026-07-11

---

**Meetily implements analytics tracking through a dual-layer architecture where a static TypeScript wrapper class communicates with Rust Tauri commands to capture user interactions, device metadata, and session lifecycle events.**

Meetily, an open-source meeting assistant built with the Tauri framework, employs a comprehensive analytics system to monitor application usage and performance. The integration spans both the frontend TypeScript layer and the Rust backend, ensuring that every significant user action—from recording initiation to settings changes—is tracked with rich contextual data. This implementation stores user identity in a local Tauri store while forwarding event payloads through secure command invocations.

## Architecture Overview

The analytics system in Meetily operates on a clear separation of concerns. The frontend handles data preparation and persistence, while the Rust backend manages the native analytics layer and session state. When the application initializes, the `Analytics` class in [`frontend/src/lib/analytics.ts`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src/lib/analytics.ts) gathers device information and establishes a persistent user ID. Each tracking call routes through Tauri's `invoke` mechanism to reach the command handlers defined in [`frontend/src-tauri/src/analytics/commands.rs`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src-tauri/src/analytics/commands.rs), which then process and store the telemetry data.

## Frontend Analytics Wrapper

The core of Meetily's analytics tracking resides in the `Analytics` class exported from [`frontend/src/lib/analytics.ts`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src/lib/analytics.ts). This static class exposes domain-specific methods that wrap generic tracking functionality with type-safe payloads.

Key methods include:
- `init()` – Initializes the analytics system and establishes the user identity
- `track()` – Generic event tracking with custom properties
- `identify()` – Associates traits with the current user
- `trackMeetingCompleted()` – Records meeting duration, transcript word counts, and words-per-minute metrics
- `trackRecordingStarted()` and `trackRecordingStopped()` – Lifecycle hooks for recording sessions
- `trackFeatureUsedEnhanced()` – Captures feature adoption metrics
- `trackSummaryGenerationStarted()` and `trackSummaryGenerationCompleted()` – AI processing telemetry

The wrapper automatically enriches every event with device context including `platform`, `os_version`, and `architecture` before invoking the Rust commands.

## Rust Backend Commands

The Rust implementation in [`frontend/src-tauri/src/analytics/commands.rs`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src-tauri/src/analytics/commands.rs) exposes Tauri commands that serve as the bridge to the native analytics layer. The primary command is `track_event`, which receives the enriched payload from the frontend and handles session management.

Critical commands include:
- `init_analytics` – Called during application startup to initialize the native analytics backend
- `track_event` – Receives event names and property dictionaries from the TypeScript wrapper
- Session management functions that handle `startSession` and `endSession` calls

These commands ensure that analytics data is processed securely at the native level, with access to system-level APIs for storing the [`analytics.json`](https://github.com/Zackriya-Solutions/meetily/blob/main/analytics.json) persistence file.

## Session and User Identification

Before sending any event, the `Analytics` class establishes identity and session context. The `getPersistentUserId()` method generates a unique identifier stored in the Tauri store ([`analytics.json`](https://github.com/Zackriya-Solutions/meetily/blob/main/analytics.json)), enabling consistent cross-session tracking.

Session lifecycle management follows this pattern:
1. `Analytics.init()` invokes `init_analytics` on the Rust side
2. `startSession(userId)` opens a session and attaches metadata
3. `endSession()` closes the session and records `session_ended` events with metrics like `days_since_last_meeting`

Device fingerprinting occurs automatically during initialization, capturing OS version and hardware architecture to segment analytics by environment.

## Feature-Level Integration Points

Analytics tracking is embedded throughout Meetily's React components via direct imports of the `Analytics` class. Key integration points demonstrate how domain-specific events are captured:

**Recording Lifecycle**
In [`frontend/src/hooks/useRecordingStart.tsx`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src/hooks/useRecordingStart.tsx), the application calls `trackRecordingStarted(meetingId)` when transcription begins. The corresponding [`frontend/src/hooks/useRecordingStop.tsx`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src/hooks/useRecordingStop.tsx) invokes `trackRecordingStopped()` with duration metrics.

**Meeting Completion**
The [`TranscriptButtonGroup.tsx`](https://github.com/Zackriya-Solutions/meetily/blob/main/TranscriptButtonGroup.tsx) component in `frontend/src/components/MeetingDetails/` triggers `trackMeetingCompleted()` when a meeting ends, passing parameters including `duration_seconds`, `transcript_segments`, and `transcript_word_count`.

**Feature Usage**
Sidebar interactions in [`frontend/src/components/Sidebar/SidebarProvider.tsx`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src/components/Sidebar/SidebarProvider.tsx) utilize `trackFeatureUsedEnhanced()` to monitor which application features users access most frequently.

**Settings Changes**
Preference modifications in [`frontend/src/components/PreferenceSettings.tsx`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src/components/PreferenceSettings.tsx) fire `trackSettingsChanged()` events with the specific configuration keys that were modified.

## Lifecycle and Usage Tracking

Meetily tracks critical lifecycle events to understand user engagement patterns. The system distinguishes between first-time users and returning active users through persistent storage in [`analytics.json`](https://github.com/Zackriya-Solutions/meetily/blob/main/analytics.json).

**First Launch Detection**
The `checkAndTrackFirstLaunch()` method checks for the `is_first_launch` flag. If present, it fires `trackUserFirstLaunch()` and updates the store to prevent duplicate first-launch events.

**Daily Active Users**
The `checkAndTrackDailyUsage()` function records `trackDailyActiveUser()` events, ensuring that user engagement is tracked on a daily cadence without duplicate entries.

**Session Metrics**
Session start events include derived metrics such as `days_since_last_meeting`, calculated by comparing timestamps between the current session and previous activity stored in the analytics state.

## Error and Backend Monitoring

The analytics system captures failure states to improve reliability. The `trackError()` method accepts error codes and messages, while `trackBackendConnection()` monitors connectivity to external transcription services. These events are particularly valuable for debugging network issues or transcription failures in production environments.

## Summary

- Meetily uses a **TypeScript wrapper class** ([`frontend/src/lib/analytics.ts`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src/lib/analytics.ts)) to provide type-safe analytics methods throughout the React frontend.
- **Rust Tauri commands** in [`frontend/src-tauri/src/analytics/commands.rs`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src-tauri/src/analytics/commands.rs) handle the native analytics processing and session management.
- User identity persists in a **Tauri store file** ([`analytics.json`](https://github.com/Zackriya-Solutions/meetily/blob/main/analytics.json)), enabling consistent tracking across application restarts.
- **Device metadata** (platform, OS version, architecture) attaches automatically to every event.
- **Lifecycle tracking** includes first-launch detection, daily active user monitoring, and session duration metrics.
- **Feature instrumentation** covers recording hooks, meeting completion, settings changes, and sidebar interactions.

## Frequently Asked Questions

### How does Meetily persist user identity for analytics tracking?

Meetily generates a persistent UUID via `getPersistentUserId()` in the analytics wrapper and stores it in a Tauri store file named [`analytics.json`](https://github.com/Zackriya-Solutions/meetily/blob/main/analytics.json). This identifier survives application restarts and attaches to every event, enabling longitudinal user analysis without requiring authentication.

### What Rust commands handle the analytics events in Meetily?

The Rust backend exposes `track_event` and `init_analytics` commands in [`frontend/src-tauri/src/analytics/commands.rs`](https://github.com/Zackriya-Solutions/meetily/blob/main/frontend/src-tauri/src/analytics/commands.rs). The TypeScript wrapper invokes these commands using Tauri's `invoke` function, passing JSON payloads containing event names, user IDs, device context, and custom properties.

### Can developers track custom metrics in Meetily?

Yes. Developers can call `Analytics.track('custom_event_name', { property: 'value' })` to record arbitrary events. The wrapper also provides specialized methods like `trackButtonClick(componentName, location)` and `trackFeatureUsedEnhanced(featureName)` for common interaction patterns, all of which route through the same Rust command infrastructure.

### How does Meetily handle session lifecycle in analytics tracking?

The `Analytics` class manages sessions through `startSession(userId)` and `endSession()` methods. These wrap Tauri commands that record `session_started` and `session_ended` events, including metadata like `days_since_last_meeting` calculated from the timestamp of the previous session stored in the analytics state file.