YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(analytics): alias email identity to analytics UUID for PostHog funnel
Louis Beaumonta17602c5e6bc
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs b/apps/screenpipe-app-tauri/src-tauri/src/analytics.rsindex 15c78c4c4..4c8eaa2cb 100755--- a/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs@@ -122,6 +122,24 @@ impl AnalyticsManager {}}+ /// Send a $create_alias event so PostHog merges the email-based identity+ /// (used by the website download endpoint) with this app's analytics UUID.+ pub async fn send_alias(&self, alias: &str) {+ if !*self.enabled.lock().await || alias.is_empty() {+ return;+ }+ let url = format!("{}/capture/", self.api_host);+ let payload = json!({+ "api_key": self.posthog_api_key,+ "event": "$create_alias",+ "properties": {+ "distinct_id": self.distinct_id,+ "alias": alias,+ },+ });+ let _ = self.client.post(&url).json(&payload).send().await;+ }+pub async fn send_event(&self,event: &str,@@ -458,6 +476,12 @@ pub fn start_analytics(// This must happen before app_started so the first event carries attributionanalytics_manager.fetch_attribution().await;+ // Link email identity (used by website) to analytics UUID (used by app)+ // so PostHog can merge the person and build a real download→open funnel+ if !analytics_manager.email.is_empty() {+ analytics_manager.send_alias(&analytics_manager.email.clone()).await;+ }+// Include feature config in app_started eventlet feature_config = analytics_manager.read_feature_config();if let Err(e) = analytics_manager