Dashboard
Create and manage analytics dashboards for data visualization
The Dashboard resource allows you to create and manage custom dashboards for visualizing analytics data in PostHog.
Example Usage
Basic Dashboard
import * as posthog from "pulumi-posthog";
const dashboard = new posthog.Dashboard("analytics", {
name: "Product Analytics",
description: "Key metrics for product performance",
});Pinned Dashboard
const pinnedDashboard = new posthog.Dashboard("main-dashboard", {
name: "Main Metrics Dashboard",
description: "Primary dashboard for daily monitoring",
pinned: true,
});Dashboard with Multiple Insights
import * as pulumi from "@pulumi/pulumi";
import * as posthog from "pulumi-posthog";
// Create insights
const signupInsight = new posthog.Insight("signups", {
name: "User Signups",
queryJson: JSON.stringify({
kind: "TrendsQuery",
series: [{
kind: "EventsNode",
event: "user_signed_up",
name: "User Signed Up",
}],
dateRange: {
date_from: "-30d",
},
}),
});
const pageviewInsight = new posthog.Insight("pageviews", {
name: "Pageviews",
queryJson: JSON.stringify({
kind: "TrendsQuery",
series: [{
kind: "EventsNode",
event: "$pageview",
name: "Pageviews",
}],
dateRange: {
date_from: "-7d",
},
}),
});
// Create dashboard
const dashboard = new posthog.Dashboard("overview", {
name: "Weekly Overview",
description: "Weekly metrics overview",
pinned: true,
});
// Add insights to dashboard (done via Insight resource)
const signupWithDash = new posthog.Insight("signup-on-dash", {
name: "Signups",
dashboardIds: [12345], // Reference dashboard ID
queryJson: JSON.stringify({
kind: "TrendsQuery",
series: [{
kind: "EventsNode",
event: "user_signed_up",
}],
dateRange: { date_from: "-30d" },
}),
});Team Dashboard
const teamDashboard = new posthog.Dashboard("team-metrics", {
name: "Engineering Team Metrics",
description: "Performance and adoption metrics for the engineering team",
});Resource Properties
Optional Arguments
name(string): Dashboard namedescription(string): Dashboard descriptionpinned(boolean): Pin to top of dashboard list
Attributes
dashboardId: Dashboard IDname: Dashboard namedescription: Dashboard descriptionpinned: Whether the dashboard is pinned
Best Practices
1. Descriptive Names
Use clear, descriptive names for dashboards:
// ✅ Good
const dashboard = new posthog.Dashboard("customer-health", {
name: "Customer Health Metrics",
description: "Track user engagement and retention",
});
// ❌ Avoid
const dashboard = new posthog.Dashboard("dash1", {
name: "Dashboard 1",
});2. Pin Important Dashboards
Pin frequently accessed dashboards for quick access:
const mainDashboard = new posthog.Dashboard("main", {
name: "Main Dashboard",
pinned: true, // Shows at top
});3. Organize by Theme
Group related metrics in themed dashboards:
// User engagement dashboard
const engagement = new posthog.Dashboard("engagement", {
name: "User Engagement",
description: "Daily active users, session length, feature usage",
});
// Business metrics dashboard
const business = new posthog.Dashboard("business", {
name: "Business Metrics",
description: "Signups, conversions, revenue tracking",
});
// Product health dashboard
const health = new posthog.Dashboard("health", {
name: "Product Health",
description: "Error rates, performance, uptime",
});Common Use Cases
Executive Dashboard
High-level metrics for leadership:
const executive = new posthog.Dashboard("executive", {
name: "Executive Summary",
description: "Key business metrics and growth indicators",
pinned: true,
});Product Team Dashboard
Metrics for product development:
const product = new posthog.Dashboard("product-metrics", {
name: "Product Team Metrics",
description: "Feature adoption, user feedback, A/B test results",
});Operations Dashboard
Operational and technical metrics:
const ops = new posthog.Dashboard("operations", {
name: "Operations Dashboard",
description: "System health, error rates, performance metrics",
});Troubleshooting
Dashboard Not Visible
Issue: Dashboard doesn't appear in PostHog UI
Solution:
- Check that the dashboard was created successfully
- Verify you're logged into the correct PostHog project
- Refresh the PostHog UI
Cannot Add Insights
Issue: Insights don't appear on dashboard
Solution:
- Insights are added via the Insight resource's
dashboardIdsproperty - Use the dashboard's numeric ID (from PostHog) when creating insights
- Ensure the insight and dashboard are in the same project