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.
FAQ
Do self-hosted session recordings affect site performance?
The recording script adds minimal overhead — PostHog’s recorder captures DOM mutations (not screenshots), so CPU and bandwidth impact is comparable to Hotjar’s. Expect 50-100 KB of additional data per page load for the recording library. The main performance consideration is server-side: storing recordings requires significant disk space. A site with 500 sessions/day generates roughly 5-10 GB/month of recording data. Use retention policies to auto-delete recordings older than 30-90 days.
Can I get heatmaps without Hotjar?
PostHog doesn’t include native heatmaps, but Matomo’s Heatmap & Session Recording plugin ($229/year) provides click maps, move maps, and scroll maps alongside session recordings. If heatmaps are your primary need, Matomo’s plugin is the closest self-hosted equivalent. Alternatively, PostHog’s event tracking can show you where users click by tracking click events with element selectors — not a visual heatmap, but functionally similar data.
How much server resources do session recordings require?
PostHog’s full self-hosted stack (analytics + recordings + feature flags) needs 8+ GB RAM and runs ~20 Docker containers — it’s a substantial deployment. OpenReplay is lighter at 4+ GB RAM. Storage is the main scaling concern: budget 10-20 GB/month per 500 daily recorded sessions. For smaller sites (under 100 sessions/day), a $20/month VPS with 8 GB RAM handles PostHog comfortably. For high-traffic sites, dedicated storage volumes and retention policies are essential.
Can I mask sensitive user data in recordings?
Yes. PostHog supports granular privacy controls: maskAllInputs hides form field values, maskTextSelector masks specific elements by CSS class, and blockSelector prevents entire DOM sections from being recorded. You can also exclude specific pages from recording entirely. This is equivalent to Hotjar’s privacy controls but with the advantage that masked data never leaves your server — Hotjar masks data after it’s already transmitted to their servers.
Is there a self-hosted alternative to Hotjar’s user feedback surveys?
PostHog includes a Surveys feature that replicates Hotjar’s on-site feedback widgets. You can create NPS surveys, open-text feedback, and multiple-choice polls triggered by user behavior, page URL, or user properties. For dedicated survey functionality, Formbricks provides a more feature-rich self-hosted survey platform with advanced targeting and visual builders. Both store responses on your infrastructure.
Can I record mobile app sessions, not just web?
PostHog supports session recording for React Native mobile apps (iOS and Android), capturing touch interactions, screen transitions, and user flows. OpenReplay focuses on web only. Matomo’s recording plugin is web-only as well. For mobile-specific UX research, PostHog is currently the only self-hosted option with mobile session recording — Hotjar launched mobile recording in 2024, and PostHog’s implementation is comparable in capability.
How do I find specific user sessions without Hotjar’s filtering?
PostHog’s recording list supports filtering by user properties (email, plan type), events performed (clicked checkout, viewed pricing), page URLs visited, recording duration, and cohort membership. You can jump from a product analytics chart directly to recordings of users who match that data point — for example, click on a funnel step to watch recordings of users who dropped off. This analytics-to-recording integration is actually more powerful than Hotjar’s standalone filtering.
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