Self-Hosted Alternatives to Hotjar
Why Replace Hotjar?
Hotjar’s free plan caps at 35 daily sessions for recordings. The Plus plan costs $39/month for 100 daily sessions. Business plans start at $99/month (500 sessions) and scale to $213/month (2,500 sessions). For high-traffic sites, Hotjar costs hundreds per month for a feature that fundamentally records what happens in your users’ browsers.
The bigger issue is privacy. Hotjar’s recording script captures DOM state, mouse movements, clicks, scrolls, and form interactions — streaming all of this to Hotjar’s servers. For sites handling sensitive data (healthcare, finance, e-commerce checkouts), this creates GDPR consent requirements and data processing agreements.
Self-hosting session recording keeps all user behavior data on your infrastructure. No third-party data processor. No per-session billing.
Best Alternatives
PostHog — Best Overall Replacement
PostHog includes session recordings as one of its core features, alongside event tracking, feature flags, A/B testing, and surveys. Session recordings capture DOM snapshots, console logs, and network requests. You can filter recordings by user properties, events, or cohorts.
PostHog’s recordings can be configured to mask sensitive elements (input fields, specific DOM nodes) for privacy compliance. Recordings are stored locally in ClickHouse — no data leaves your server.
What you get that Hotjar doesn’t: PostHog combines recordings with product analytics in a single platform. You can go from a funnel drop-off chart directly to session recordings of users who dropped off. This integration is more powerful than Hotjar’s standalone recordings.
The trade-off: PostHog’s self-hosted stack requires 8+ GB RAM and ~20 Docker containers. It’s a substantial deployment compared to Hotjar’s single JavaScript snippet.
Read our full guide: How to Self-Host PostHog
Matomo Session Recording — Best for Existing Matomo Users
Matomo offers a Heatmap & Session Recording plugin. It’s a paid add-on for the self-hosted version ($229/year for up to 4 users). If you already run Matomo for web analytics, adding session recording keeps everything in one platform.
Matomo’s recordings include heatmaps (click, move, scroll maps) — a feature PostHog doesn’t have natively. Recordings are stored in your Matomo database.
The gap: The plugin is paid (not open source), and recording capability is less sophisticated than PostHog’s. No console log capture, no network request recording, and no integration with feature flags or A/B tests.
Read our full guide: How to Self-Host Matomo
OpenReplay — Best Dedicated Alternative
OpenReplay is an open-source session replay platform purpose-built for debugging and user experience analysis. It captures DOM changes, network requests, console logs, and user interactions with deep filtering capabilities.
OpenReplay’s DevTools panel shows the exact network requests and JavaScript errors alongside the session replay — valuable for engineering teams debugging production issues.
Deployment: OpenReplay uses Docker Compose or Kubernetes. The stack includes PostgreSQL, Redis, and a custom storage backend. Lighter than PostHog but still requires 4+ GB RAM.
The gap: OpenReplay focuses purely on session replay and debugging. No web analytics, no feature flags, no A/B testing. If you need analytics alongside recordings, combine it with Plausible or Umami.
Migration Guide
Replacing Hotjar’s Script
Remove the Hotjar tracking code from your site:
<!-- Remove this -->
<script>
(function(h,o,t,j,a,r){...})(window,document,'https://static.hotjar.com/c/hotjar-...');
</script>
Replace with PostHog’s snippet:
<script>
!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){...})}(document,window.posthog||[]);
posthog.init('YOUR_API_KEY', {
api_host: 'https://your-posthog-instance.com',
session_recording: {
maskAllInputs: true, // Mask form inputs by default
maskTextSelector: '.sensitive' // Mask elements with .sensitive class
}
});
</script>
Configuring Privacy Masking
PostHog’s recording masking is critical for compliance:
posthog.init('YOUR_API_KEY', {
api_host: 'https://your-posthog-instance.com',
session_recording: {
maskAllInputs: true, // Masks all <input> values
maskAllText: false, // Set true to mask all text content
maskTextSelector: '.pii', // CSS selector for elements to mask
blockSelector: '.no-record', // CSS selector for elements to block entirely
}
});
What Transfers and What Doesn’t
| Feature | Hotjar | PostHog | Transfer? |
|---|---|---|---|
| Session recordings | Yes | Yes | Configure, don’t migrate |
| Heatmaps | Yes | No (use Matomo plugin) | Not available |
| Surveys/feedback | Yes | Yes (Surveys feature) | Recreate surveys |
| User interviews | Yes (Engage) | No | Not available |
| Funnels | Basic | Full product funnels | Rebuild in PostHog |
Historical Hotjar recordings cannot be exported or migrated. Start fresh with the new tool.
Cost Comparison
| Hotjar | Self-Hosted (PostHog) | |
|---|---|---|
| Monthly cost (100 sessions/day) | $39/month (Plus) | ~$20-40 (VPS) |
| Monthly cost (500 sessions/day) | $99/month (Business) | ~$40-80 (VPS) |
| Monthly cost (2,500 sessions/day) | $213/month (Business) | ~$40-80 (VPS) |
| Annual cost (500 sessions/day) | $1,188 | $480-960 |
| 3-year cost (500 sessions/day) | $3,564 | $1,440-2,880 |
| Session limit | Plan-dependent | Your storage |
| Retention | Plan-dependent (365 days max) | Unlimited |
| Heatmaps | Included | Not available (Matomo add-on) |
| Data ownership | Hotjar’s servers | Your infrastructure |
Self-hosting removes per-session billing entirely. The only cost scaling factor is storage for recording data.
What You Give Up
- Heatmaps. PostHog doesn’t have native heatmaps. Matomo’s paid plugin has them. If heatmaps are essential, consider Matomo’s add-on or accept the gap.
- User interview scheduling. Hotjar Engage lets you recruit and schedule user interviews through the platform. No self-hosted equivalent.
- Managed infrastructure. Hotjar handles scaling, storage, and playback infrastructure. Self-hosting session recordings requires managing storage growth — recordings consume significant disk space at scale.
- One-click surveys. Hotjar’s survey builder is polished and quick. PostHog has surveys but the builder is less refined.
- Instant setup. Hotjar is a single script tag. PostHog self-hosted requires a Docker Compose deployment with multiple services.
For most teams, PostHog’s session recordings plus integrated analytics outweigh Hotjar’s heatmaps and interview features. The cost savings fund the server infrastructure many times over.
Related
Get self-hosting tips in your inbox
Get the Docker Compose configs, hardware picks, and setup shortcuts we don't put in articles. Weekly. No spam.
Comments