Skip to content

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

feat(home-cards): track posthog home_card_clicked

Louis Beaumonte3732e090756
diff --git a/apps/screenpipe-app-tauri/components/chat/summary-cards.tsx b/apps/screenpipe-app-tauri/components/chat/summary-cards.tsx
index 0df8087ab..439625ea8 100644
--- a/apps/screenpipe-app-tauri/components/chat/summary-cards.tsx
+++ b/apps/screenpipe-app-tauri/components/chat/summary-cards.tsx
@@ -6,6 +6,7 @@
import { useState, useEffect, useRef } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { ChevronDown, ChevronUp, Plug, Plus, RefreshCw, Sparkles } from "lucide-react";
+import posthog from "posthog-js";
import { PipeAIIconLarge } from "@/components/pipe-ai-icon";
import { type TemplatePipe } from "@/lib/hooks/use-pipes";
import { FALLBACK_TEMPLATES, type CustomTemplate } from "@/lib/summary-templates";
@@ -144,10 +145,20 @@ export function SummaryCards({
const discover = templates.filter((t) => !t.featured);
const handleCardClick = (pipe: TemplatePipe) => {
+ posthog.capture("home_card_clicked", {
+ kind: pipe.featured ? "template_featured" : "template_discover",
+ template_name: pipe.name,
+ template_title: pipe.title,
+ });
onSendMessage(pipe.prompt, `${pipe.icon} ${pipe.title}`);
};
const handleCustomTemplateClick = (template: CustomTemplate) => {
+ posthog.capture("home_card_clicked", {
+ kind: "custom_template",
+ template_id: template.id,
+ template_title: template.title,
+ });
onSendMessage(template.prompt, `\u{1F4CC} ${template.title}`);
};
@@ -191,7 +202,10 @@ export function SummaryCards({
))}
{/* Custom Summary card */}
<button
- onClick={() => setShowBuilder(true)}
+ onClick={() => {
+ posthog.capture("home_card_clicked", { kind: "custom_summary_open" });
+ setShowBuilder(true);
+ }}
className="group text-left p-2 border border-dashed border-border/40 bg-muted/5 hover:bg-foreground hover:text-background hover:border-foreground transition-all duration-150 cursor-pointer"
>
<div className="text-sm mb-0.5">{"\u2728"}</div>
@@ -205,7 +219,13 @@ export function SummaryCards({
{/* Discover / Show More card */}
{discover.length > 0 && (
<button
- onClick={() => setShowAll(!showAll)}
+ onClick={() => {
+ posthog.capture("home_card_clicked", {
+ kind: showAll ? "discover_collapse" : "discover_expand",
+ discover_count: discover.length,
+ });
+ setShowAll(!showAll);
+ }}
className="group text-left p-2 border border-border/40 bg-muted/10 hover:bg-foreground hover:text-background hover:border-foreground transition-all duration-150 cursor-pointer"
>
<div className="text-sm mb-0.5">{"\u{1F50D}"}</div>
@@ -221,13 +241,21 @@ export function SummaryCards({
</div>
</button>
)}
- {onOpenConnection && visibleConnectionSetupSuggestions.map((connection) => (
+ {onOpenConnection && visibleConnectionSetupSuggestions.map((connection) => {
+ const openConnection = () => {
+ posthog.capture("home_card_clicked", {
+ kind: connection.id === "connections" ? "connection_browse_all" : "connection_setup",
+ connection_id: connection.id,
+ });
+ onOpenConnection(connection.id);
+ };
+ return (
<div
key={connection.id}
role="button"
tabIndex={0}
- onClick={() => onOpenConnection(connection.id)}
- onKeyDown={(e) => e.key === "Enter" && onOpenConnection(connection.id)}
+ onClick={openConnection}
+ onKeyDown={(e) => e.key === "Enter" && openConnection()}
className="group relative text-left p-2 border border-border/40 bg-muted/10 hover:bg-foreground hover:text-background hover:border-foreground transition-all duration-150 cursor-pointer"
>
<div className="mb-0.5 flex h-4 w-4 items-center justify-center">
@@ -242,7 +270,8 @@ export function SummaryCards({
{connection.description}
</div>
</div>
- ))}
+ );
+ })}
</div>
{/* Expanded: more templates */}
@@ -341,7 +370,14 @@ export function SummaryCards({
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.15, delay: i * 0.05 }}
type="button"
- onClick={() => onSendMessage(s.text)}
+ onClick={() => {
+ posthog.capture("home_card_clicked", {
+ kind: "auto_suggestion",
+ position: i,
+ connection_icon: s.connectionIcon ?? null,
+ });
+ onSendMessage(s.text);
+ }}
className="group flex min-h-[34px] w-full items-center gap-1.5 px-1.5 py-1.5 text-left font-mono text-muted-foreground transition-colors duration-150 hover:bg-muted/25 hover:text-foreground"
title={s.text}
>
@@ -381,6 +417,10 @@ export function SummaryCards({
open={showBuilder}
onClose={() => setShowBuilder(false)}
onGenerate={(prompt, timeRange) => {
+ posthog.capture("home_card_clicked", {
+ kind: "custom_summary_generate",
+ time_range: timeRange,
+ });
setShowBuilder(false);
onSendMessage(prompt, `\u2728 Custom Summary \u2014 ${timeRange}`);
}}