Skip to content

v0.6.0

Latest

Choose a tag to compare

@jaideepghosh jaideepghosh released this 16 Jun 19:17
8887ccc

Bridge v0.6.0

This release introduces a shared analytics platform for Bridge, providing a consistent, privacy-first analytics experience across both web and desktop applications. Analytics infrastructure has been centralized into a dedicated package, reducing application complexity while establishing a scalable foundation for future analytics enhancements.

📊 Shared Analytics Package

Bridge now includes a new @bridge/analytics package that serves as the single source of truth for analytics across the entire platform.

Highlights

  • Added a new shared @bridge/analytics package.
  • Unified analytics integration across web and desktop applications.
  • Introduced a provider-agnostic analytics architecture.
  • Added centralized error tracking support.
  • Reduced direct analytics dependencies within applications.
  • Added comprehensive analytics documentation and developer tooling.

Provider-Agnostic Architecture

Analytics is now abstracted behind a shared AnalyticsClient interface.

Benefits include:

  • Decoupled application code from analytics vendors.
  • Easier adoption of alternative analytics providers in the future.
  • Consistent APIs for event tracking and user identification.
  • Shared analytics behavior across all Bridge applications.

The current implementation uses PostHog internally, with all provider-specific logic isolated to a dedicated provider module.

Singleton Analytics Client

The analytics package uses a singleton architecture:

  • Eliminates the need for React context-based analytics management.
  • Supports usage from both React and non-React code.
  • Provides a single analytics client instance across applications.
  • Simplifies analytics initialization and consumption.

🔒 Privacy-First Error Tracking

Bridge now includes centralized client-side error tracking with safeguards designed to minimize sensitive data collection.

Global Error Monitoring

Added support for:

  • Uncaught JavaScript errors (window.onerror)
  • Unhandled promise rejections (unhandledrejection)

Restricted Error Metadata

To maintain a privacy-first approach, captured request metadata intentionally excludes:

  • Request URLs
  • HTTP headers
  • Authentication tokens
  • Request bodies
  • Other potentially sensitive request data

This ensures analytics focuses on application reliability rather than user content.


🌐 Web Application Migration

The web application has been migrated to the shared analytics platform.

Analytics Provider

  • Added a new AnalyticsProvider.
  • Replaced the existing PostHogProvider.
  • Moved analytics initialization into the shared package.
  • Simplified analytics usage throughout the application.

Configuration Improvements

Analytics configuration now uses environment variables instead of hardcoded values:

  • Added POSTHOG_HOST
  • Added POSTHOG_API_KEY

This improves deployment flexibility and environment-specific configuration management.

Dependency Cleanup

  • Added @bridge/analytics.
  • Removed direct posthog-js dependency.
  • Removed @posthog/react.
  • Consolidated analytics logic into the shared package.

🖥️ Desktop Analytics Support

The desktop application now includes analytics support powered by the shared package.

Desktop Integration

  • Added a desktop-specific AnalyticsProvider.
  • Wrapped the application with analytics initialization.
  • Added application launch tracking.
  • Added application close tracking.
  • Tagged desktop analytics events with app: "desktop" metadata.

Desktop-Aware Tracking

Analytics behavior is adapted for the Tauri environment:

  • Disables pageview capture.
  • Disables pageleave capture.
  • Preserves analytics features relevant to desktop applications.

Environment-Based Configuration

Desktop analytics can be enabled using:

  • VITE_POSTHOG_PROJECT_TOKEN
  • VITE_POSTHOG_HOST

When configuration is unavailable:

  • Analytics is automatically disabled.
  • Applications continue functioning normally.
  • A warning is logged to assist developers.

⚙️ Analytics Infrastructure

Several foundational analytics capabilities were added to support future product insights.

Typed Events

  • Added strongly typed analytics event constants.
  • Improved TypeScript safety for event tracking.
  • Centralized event definitions within the analytics package.

React Integration

  • Added a reusable useAnalytics hook.
  • Simplified analytics access throughout React applications.
  • Standardized analytics usage patterns across platforms.

PostHog Autocapture

Bridge now relies on PostHog autocapture for:

  • Browser detection
  • Operating system detection
  • Session tracking
  • Page views (web only)
  • Click interactions

This reduces custom tracking code while improving consistency.


✅ Quality & Reliability

  • Added comprehensive TypeScript support throughout the analytics package.
  • Verified successful type checking for packages/analytics.
  • Verified successful type checking for apps/web.
  • Verified successful type checking for apps/desktop.
  • Reduced analytics-related duplication across applications.
  • Established a shared analytics foundation for future platform growth.

What's Changed

  • feat(analytics): introduce shared @bridge/analytics package
  • feat(analytics): add provider-agnostic analytics client and singleton architecture
  • feat(analytics): add privacy-first error tracking and typed events
  • feat(analytics): add reusable React analytics hooks
  • feat(web): migrate from PostHogProvider to shared AnalyticsProvider
  • feat(desktop): add desktop analytics integration and lifecycle tracking
  • refactor(web): move analytics configuration to environment variables
  • refactor(web): remove direct PostHog dependencies
  • refactor(analytics): isolate PostHog implementation behind provider abstraction
  • docs(analytics): add comprehensive package documentation

Full Changelog: v0.5.0...v0.6.0