How to embed dashboards externally on PostHog
PostHog allows you to embed dashboards externally by generating shareable links with access tokens and embedding them using iframes. You can control access permissions and customize the embedded view through dashboard settings.
Prerequisites
- PostHog account with dashboard access
- Admin or dashboard permissions in your PostHog organization
- Web development knowledge for iframe implementation
- Target website or application where you want to embed the dashboard
Step-by-Step Instructions
Navigate to your dashboard
Access dashboard sharing settings
Configure embedding permissions
- Public - Anyone with the link can view
- Password protected - Requires a password you set
- Domain restricted - Only works on specified domains
Generate the embed code
- Direct embed URL
- Complete iframe HTML code
- Access token (if applicable)
Customize embed appearance
- Set
widthandheightattributes - Add
frameborder="0"for seamless integration - Include
allowfullscreenif needed
<iframe src="https://app.posthog.com/embedded/dashboard-id?token=xxx" width="100%" height="600" frameborder="0"></iframe>Implement the embed code
<div style="width: 100%; min-height: 600px;">
<iframe src="your-posthog-embed-url" width="100%" height="600" frameborder="0"></iframe>
</div>Test the embedded dashboard
- The dashboard loads correctly
- All charts and data are visible
- Interactive elements work as expected
- The embed respects your access restrictions
Monitor and maintain access
- View embedding analytics and usage
- Update access permissions when needed
- Regenerate tokens if compromised
- Disable embedding if no longer needed
Common Issues & Troubleshooting
Dashboard not loading in iframe
Check if your domain is whitelisted in PostHog's embed settings and verify the access token is valid. Also ensure your website supports iframes and doesn't have restrictive Content Security Policy headers.
Access denied or authentication errors
Verify that external embedding is enabled for the dashboard and check if domain restrictions are properly configured. Regenerate the embed token if the current one has expired.
Dashboard appears cut off or improperly sized
Adjust the iframe width and height attributes. Use responsive CSS units like percentages and ensure the parent container has adequate space. Consider using min-height instead of fixed height.
Charts not updating with real-time data
Embedded dashboards may have caching delays. Check your dashboard's refresh settings in PostHog and ensure the embed URL includes proper parameters for data freshness. Some features may be limited in embedded views.