-
-
Analytics
-
- Comprehensive insights into your email performance, engagement metrics, and delivery statistics.
-
+ {/* Header */}
+
+
+
Analytics
+
+ Comprehensive insights into your email performance, engagement metrics, and delivery statistics.
+
+
+
+
+
-
-
-
-
- {/* Error State */}
- {error && (
-
-
-
-
-
Failed to load analytics data. Please try again.
-
-
-
- )}
+ {/* Error State */}
+ {error && (
+
+
+
+
+
Failed to load analytics data. Please try again.
+
+
+
+ )}
- {/* Stats Grid */}
-
- {statsCards.map(stat => {
- const Icon = stat.icon;
- return (
-
-
-
-
{stat.name}
-
-
+ {/* Stats Grid */}
+
+ {statsCards.map(stat => {
+ const Icon = stat.icon;
+ return (
+
+
+
+ {isLoading ? '-' : stat.value}
+
+
+ {stat.description}
+
+
+ );
+ })}
+
+
+ {/* Email Volume Chart */}
+
+
+ Email Volume Trends
+ Daily email sends, opens, and clicks over the selected period
+
+
+ {!hasData ? (
+
+
+
+
No email data yet
+
Send your first email to see analytics here
-
{isLoading ? '-' : stat.value}
-
-
- {stat.description}
-
-
- );
- })}
-
-
- {/* Email Volume Chart */}
-
-
- Email Volume Trends
- Daily email sends, opens, and clicks over the selected period
-
-
- {!hasData ? (
-
-
-
-
No email data yet
-
Send your first email to see analytics here
-
- ) : (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- } />
-
-
-
-
-
-
- )}
-
-
-
- {/* Engagement Rate Chart */}
-
-
- Engagement Rate Trends
- Open rate percentage over time
-
-
- {!hasData ? (
-
-
-
-
No engagement data
-
- Engagement metrics will appear once emails are opened
-
-
-
- ) : (
-
-
-
-
- `${value}%`}
- />
- } cursor={false} />
-
-
-
- )}
-
-
-
- {/* Key Insights */}
-
-
-
- Performance Insights
- Key metrics and recommendations
-
-
-
-
-
-
-
-
Open Rate
-
- {stats?.openRate && stats.openRate > 20
- ? 'Your open rate is above industry average!'
- : 'Consider improving subject lines to increase open rates.'}
-
-
-
-
-
-
-
-
-
Click Rate
-
- {stats?.clickRate && stats.clickRate > 3
- ? 'Great click-through performance!'
- : 'Add more compelling calls-to-action to boost clicks.'}
-
-
-
-
-
-
-
-
-
Engagement
-
- {stats?.totalWorkflowsStarted
- ? `${stats.totalWorkflowsStarted.toLocaleString()} workflows started`
- : 'Set up workflows to automate your email campaigns.'}
-
-
-
+ ) : (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ return value;
+ }}
+ />
+ }
+ />
+
+
+
+ } verticalAlign="top" height={36} />
+
+
+ )}
+ {/* Engagement Rate Chart */}
- Event Activity
- Custom events and triggers
+ Engagement Rate Trends
+ Open rate percentage over time
-
-
-
-
{stats?.totalEvents?.toLocaleString() || '0'}
-
Total Events
+
+ {!hasData ? (
+
+
+
+
No engagement data
+
+ Engagement metrics will appear once emails are opened
+
+
-
-
-
-
-
-
- Events triggered by your contacts over the last {days} days. These can trigger workflows and
- automations.
-
-
+ ) : (
+
+
+
+
+ `${value}%`}
+ className="text-muted-foreground"
+ />
+ value}
+ formatter={(value: any) => [`${value}%`, 'Open Rate']}
+ />
+ }
+ cursor={{
+ stroke: 'hsl(var(--border))',
+ strokeWidth: 1,
+ strokeDasharray: '3 3',
+ }}
+ />
+
+
+
+ )}
+
+ {/* Key Insights */}
+
+
+
+ Performance Insights
+ Key metrics and recommendations
+
+
+
+
+
+
+
+
Open Rate
+
+ {stats?.openRate && stats.openRate > 20
+ ? 'Your open rate is above industry average!'
+ : 'Consider improving subject lines to increase open rates.'}
+
+
+
+
+
+
+
+
+
Click Rate
+
+ {stats?.clickRate && stats.clickRate > 3
+ ? 'Great click-through performance!'
+ : 'Add more compelling calls-to-action to boost clicks.'}
+
+
+
+
+
+
+
+
+
Engagement
+
+ {stats?.totalWorkflowsStarted
+ ? `${stats.totalWorkflowsStarted.toLocaleString()} workflows started`
+ : 'Set up workflows to automate your email campaigns.'}
+
+
+
+
+
+
+
+
+ Event Activity
+ Custom events and triggers
+
+
+
+
+
{stats?.totalEvents?.toLocaleString() || '0'}
+
Total Events
+
+
+
+
+
+
+
+ Events triggered by your contacts over the last {days} days. These can trigger workflows and
+ automations.
+
+
+
+
+
+
+ {/* Campaign Performance */}
+ {topCampaigns && topCampaigns.length > 0 && (
+
+
+ Campaign Performance
+ Top performing campaigns in the last {days} days
+
+
+
+
+
+
+ | Campaign |
+ Sent |
+ Opened |
+ Clicked |
+ Open Rate |
+ Click Rate |
+
+
+
+ {topCampaigns.map((campaign, idx) => (
+
+
+
+
+ {idx + 1}
+
+ {campaign.subject}
+
+ |
+
+ {campaign.sentCount.toLocaleString()}
+ |
+
+ {campaign.openedCount.toLocaleString()}
+ |
+
+ {campaign.clickedCount.toLocaleString()}
+ |
+
+ 30
+ ? 'text-green-600'
+ : campaign.openRate > 20
+ ? 'text-blue-600'
+ : 'text-neutral-600'
+ }`}
+ >
+ {campaign.openRate.toFixed(1)}%
+
+ |
+
+ 5
+ ? 'text-green-600'
+ : campaign.clickRate > 3
+ ? 'text-blue-600'
+ : 'text-neutral-600'
+ }`}
+ >
+ {campaign.clickRate.toFixed(1)}%
+
+ |
+
+ ))}
+
+
+
+
+
+ )}
+
+ {/* Top Events */}
+ {topEvents && topEvents.length > 0 && (
+
+
+ Top Events
+ Most frequently triggered events in the last {days} days
+
+
+
+ {topEvents.map((event, index) => (
+
+
+
+ {index + 1}
+
+
+
{event.name}
+
{event.count.toLocaleString()} occurrences
+
+
+
+
0
+ ? 'bg-green-100 text-green-700'
+ : event.trend < 0
+ ? 'bg-red-100 text-red-700'
+ : 'bg-neutral-100 text-neutral-700'
+ }`}
+ >
+ {event.trend > 0 ? '+' : ''}
+ {event.trend}%
+
+
+
+ ))}
+
+
+
+ )}
-
-
+
>
);
}
diff --git a/packages/ui/src/components/atoms/Chart.tsx b/packages/ui/src/components/atoms/Chart.tsx
index 35f595c..1b38638 100644
--- a/packages/ui/src/components/atoms/Chart.tsx
+++ b/packages/ui/src/components/atoms/Chart.tsx
@@ -83,13 +83,16 @@ const ChartStyle = ({id, config}: {id: string; config: ChartConfig}) => {
return (