• Product
  • Pricing
  • Docs
  • Using PostHog
  • Community
  • Company
  • Login
  • Docs

  • Overview
    • Quickstart with PostHog Cloud
    • Overview
      • AWS
      • Azure
      • DigitalOcean
      • Google Cloud Platform
      • Hobby
      • Other platforms
      • Instance settings
      • Environment variables
      • Securing PostHog
      • Monitoring with Grafana
      • Running behind a proxy
      • Configuring email
      • Helm chart configuration
      • Deploying ClickHouse using Altinity.Cloud
      • Configuring Slack
      • Overview
        • Overview
        • Upgrade notes
        • Overview
        • 0001-events-sample-by
        • 0002_events_sample_by
        • 0003_fill_person_distinct_id2
        • ClickHouse
          • Backup
          • Kafka Engine
          • Resize disk
          • Restore
          • Vertical scaling
          • Horizontal scaling (Sharding & replication)
        • Kafka
          • Resize disk
          • Log retention
        • PostgreSQL
          • Resize disk
          • Troubleshooting long-running migrations
        • Plugin server
        • MinIO
        • Redis
        • Zookeeper
      • Disaster recovery
    • Troubleshooting and FAQs
    • Managing hosting costs
    • EU-only hosting
    • Overview
    • Ingest live data
    • Ingest historical data
    • Identify users
    • User properties
    • Deploying a reverse proxy
    • Libraries
    • Badge
      • Snippet installation
      • Android
      • iOS
      • JavaScript
      • Flutter
      • React Native
      • Browser Extensions
      • Elixir
      • Go
      • Java
      • Node.js
      • PHP
      • Python
      • Ruby
      • Docusaurus v2
      • Gatsby
      • Google Tag Manager
      • Next.js
      • Nuxt.js
      • Retool
      • RudderStack
      • Segment
      • Sentry
      • Slack
      • Shopify
      • WordPress
      • Message formatting
      • Microsoft Teams
      • Slack
      • Discord
    • To another self-hosted instance
    • To PostHog from Amplitude
    • Between Cloud and self-hosted
    • Overview
    • Tutorial
    • Troubleshooting
    • TypeScript types
    • Developer reference
    • Overview
    • POST-only public endpoints
    • Actions
    • Annotations
    • Cohorts
    • Dashboards
    • Event definitions
    • Events
    • Experiments
    • Feature flags
    • Funnels
    • Groups
    • Groups types
    • Insights
    • Invites
    • Members
    • Persons
    • Plugin configs
    • Plugins
    • Projects
    • Property definitions
    • Session recordings
    • Trends
    • Users
    • Data model
    • Overview
    • Data model
    • Ingestion pipeline
    • ClickHouse
    • Querying data
    • Overview
    • GDPR guidance
    • HIPAA guidance
    • CCPA guidance
    • Data egress & compliance
    • Data deletion
    • Overview
    • Code of conduct
    • Recognizing contributions
  • Using PostHog

  • Table of contents
      • Dashboards
      • Funnels
      • Group Analytics
      • Insights
      • Lifecycle
      • Path analysis
      • Retention
      • Stickiness
      • Trends
      • Heatmaps
      • Session Recording
      • Correlation Analysis
      • Experimentation
      • Feature Flags
      • Actions
      • Annotations
      • Cohorts
      • Data Management
      • Events
      • Persons
      • Sessions
      • UTM segmentation
      • Team collaboration
      • Organizations & projects
      • Settings
      • SSO & SAML
      • Toolbar
      • Notifications & alerts
    • Overview
      • Amazon Kinesis Import
      • BitBucket Release Tracker
      • Braze Import
      • Event Replicator
      • GitHub Release Tracker
      • GitHub Star Sync
      • GitLab Release Tracker
      • Heartbeat
      • Ingestion Alert
      • Email Scoring
      • n8n Connector
      • Orbit Connector
      • Redshift Import
      • Segment Connector
      • Shopify Connector
      • Twitter Followers Tracker
      • Zendesk Connector
      • Airbyte Exporter
      • Amazon S3 Export
      • BigQuery Export
      • Customer.io Connector
      • Databricks Export
      • Engage Connector
      • GCP Pub/Sub Connector
      • Google Cloud Storage Export
      • Hubspot Connector
      • Intercom Connector
      • Migrator 3000
      • PagerDuty Connector
      • PostgreSQL Export
      • Redshift Export
      • RudderStack Export
      • Salesforce Connector
      • Sendgrid Connector
      • Sentry Connector
      • Snowflake Export
      • Twilio Connector
      • Variance Connector
      • Zapier Connector
      • Downsampler
      • Event Sequence Timer
      • First Time Event Tracker
      • Property Filter
      • Property Flattener
      • Schema Enforcer
      • Taxonomy Standardizer
      • Unduplicator
      • Automatic Cohort Creator
      • Currency Normalizer
      • GeoIP Enricher
      • Timestamp Parser
      • URL Normalizer
      • User Agent Populator
  • Tutorials
    • All tutorials
    • Actions
    • Apps
    • Cohorts
    • Dashboards
    • Feature flags
    • Funnels
    • Heatmaps
    • Path analysis
    • Retention
    • Session recording
    • Trends
  • Support
  • Docs

  • Overview
    • Quickstart with PostHog Cloud
    • Overview
      • AWS
      • Azure
      • DigitalOcean
      • Google Cloud Platform
      • Hobby
      • Other platforms
      • Instance settings
      • Environment variables
      • Securing PostHog
      • Monitoring with Grafana
      • Running behind a proxy
      • Configuring email
      • Helm chart configuration
      • Deploying ClickHouse using Altinity.Cloud
      • Configuring Slack
      • Overview
        • Overview
        • Upgrade notes
        • Overview
        • 0001-events-sample-by
        • 0002_events_sample_by
        • 0003_fill_person_distinct_id2
        • ClickHouse
          • Backup
          • Kafka Engine
          • Resize disk
          • Restore
          • Vertical scaling
          • Horizontal scaling (Sharding & replication)
        • Kafka
          • Resize disk
          • Log retention
        • PostgreSQL
          • Resize disk
          • Troubleshooting long-running migrations
        • Plugin server
        • MinIO
        • Redis
        • Zookeeper
      • Disaster recovery
    • Troubleshooting and FAQs
    • Managing hosting costs
    • EU-only hosting
    • Overview
    • Ingest live data
    • Ingest historical data
    • Identify users
    • User properties
    • Deploying a reverse proxy
    • Libraries
    • Badge
      • Snippet installation
      • Android
      • iOS
      • JavaScript
      • Flutter
      • React Native
      • Browser Extensions
      • Elixir
      • Go
      • Java
      • Node.js
      • PHP
      • Python
      • Ruby
      • Docusaurus v2
      • Gatsby
      • Google Tag Manager
      • Next.js
      • Nuxt.js
      • Retool
      • RudderStack
      • Segment
      • Sentry
      • Slack
      • Shopify
      • WordPress
      • Message formatting
      • Microsoft Teams
      • Slack
      • Discord
    • To another self-hosted instance
    • To PostHog from Amplitude
    • Between Cloud and self-hosted
    • Overview
    • Tutorial
    • Troubleshooting
    • TypeScript types
    • Developer reference
    • Overview
    • POST-only public endpoints
    • Actions
    • Annotations
    • Cohorts
    • Dashboards
    • Event definitions
    • Events
    • Experiments
    • Feature flags
    • Funnels
    • Groups
    • Groups types
    • Insights
    • Invites
    • Members
    • Persons
    • Plugin configs
    • Plugins
    • Projects
    • Property definitions
    • Session recordings
    • Trends
    • Users
    • Data model
    • Overview
    • Data model
    • Ingestion pipeline
    • ClickHouse
    • Querying data
    • Overview
    • GDPR guidance
    • HIPAA guidance
    • CCPA guidance
    • Data egress & compliance
    • Data deletion
    • Overview
    • Code of conduct
    • Recognizing contributions
  • Using PostHog

  • Table of contents
      • Dashboards
      • Funnels
      • Group Analytics
      • Insights
      • Lifecycle
      • Path analysis
      • Retention
      • Stickiness
      • Trends
      • Heatmaps
      • Session Recording
      • Correlation Analysis
      • Experimentation
      • Feature Flags
      • Actions
      • Annotations
      • Cohorts
      • Data Management
      • Events
      • Persons
      • Sessions
      • UTM segmentation
      • Team collaboration
      • Organizations & projects
      • Settings
      • SSO & SAML
      • Toolbar
      • Notifications & alerts
    • Overview
      • Amazon Kinesis Import
      • BitBucket Release Tracker
      • Braze Import
      • Event Replicator
      • GitHub Release Tracker
      • GitHub Star Sync
      • GitLab Release Tracker
      • Heartbeat
      • Ingestion Alert
      • Email Scoring
      • n8n Connector
      • Orbit Connector
      • Redshift Import
      • Segment Connector
      • Shopify Connector
      • Twitter Followers Tracker
      • Zendesk Connector
      • Airbyte Exporter
      • Amazon S3 Export
      • BigQuery Export
      • Customer.io Connector
      • Databricks Export
      • Engage Connector
      • GCP Pub/Sub Connector
      • Google Cloud Storage Export
      • Hubspot Connector
      • Intercom Connector
      • Migrator 3000
      • PagerDuty Connector
      • PostgreSQL Export
      • Redshift Export
      • RudderStack Export
      • Salesforce Connector
      • Sendgrid Connector
      • Sentry Connector
      • Snowflake Export
      • Twilio Connector
      • Variance Connector
      • Zapier Connector
      • Downsampler
      • Event Sequence Timer
      • First Time Event Tracker
      • Property Filter
      • Property Flattener
      • Schema Enforcer
      • Taxonomy Standardizer
      • Unduplicator
      • Automatic Cohort Creator
      • Currency Normalizer
      • GeoIP Enricher
      • Timestamp Parser
      • URL Normalizer
      • User Agent Populator
  • Tutorials
    • All tutorials
    • Actions
    • Apps
    • Cohorts
    • Dashboards
    • Feature flags
    • Funnels
    • Heatmaps
    • Path analysis
    • Retention
    • Session recording
    • Trends
  • Support
  • Using PostHog
  • Product manual
  • Visualization
  • Session Recording

Session Recording

Last updated: Sep 07, 2022

On this page

  • Using Session Recording
  • Ignoring sensitive elements
  • Recordings data retention
  • PostHog Cloud & Clickhouse Self-hosted
  • Legacy Postgres Self-hosted
  • Preserving recordings
  • Further controls
  • Recording configurations
  • Troubleshooting
  • Recordings are not being captured
  • Permitted domain setting
  • posthog-js configurations
  • Content security policy
  • Ad/tracking blockers
  • Website is not recording properly
  • Update posthog-js
  • Report your specific issue
Where is this feature available?
Self-hosted plans
  • AvailableOpen-source
  • AvailableSelf-Serve
  • AvailableEnterprise
Cloud plans
  • AvailableFree
  • AvailableStartup
  • AvailableSelf-Serve
  • AvailableEnterprise

Session Recording allows you to record users navigating through your website and play back the individual sessions to watch how real users use your product.

Using Session Recording

Recordings can only be used with our JavaScript library and requires the feature to be enabled in PostHog's Project Settings (/project/settings). Once enabled, the JS library will start recording sessions by default.

Session Recording does not work if you send data using Segment's SDK as this data is not collected. If you use Segment, you may want to add the PostHog library too (make sure to only send regular event data from one source).

Recordings can be toggled on and off in the JS library by appropriately setting the config. Users who opt out of event capturing will not have their sessions recorded.

To watch recordings, you can either visit the 'Recordings' page or click on any data point in an insight and from the list of persons related to that data point. This is specially useful in funnels, where you can drill down and watch recordings of users who converted or dropped off.

When watching recordings, you can change the speed as well as select the option 'skip inactive' - this will skip chunks of the recording where the user was inactive on the page.

Ignoring sensitive elements

To avoid recording passwords or other sensitive information, the default PostHog settings do not capture any user input fields in recordings (the text is replaced by '*'s). This setting can be adjusted by using the recording configurations.

If your application displays sensitive user information outside of input fields, you need to update your codebase to prevent PostHog from capturing this information during session recordings.

To do so, you should add the CSS class name ph-no-capture to elements which should not be recorded. This will lead to the element being replaced with a block of the same size when you play back the recordings. Make sure everyone who watches recordings in your team is aware of this, so that they don't think your product is broken when something doesn't show up!

Recordings data retention

Depending on how your app or website is built, recordings can take a lot of disk space. To manage this, we have the following retention policy options in place.

PostHog Cloud & Clickhouse Self-hosted

By default, recordings are automatically deleted after 3 weeks. Old recordings are deleted with Clickhouse's Table TTL. If you're self-hosting, you can set your own retention policy by updating the RECORDINGS_TTL_WEEKS configuration on your instance settings page.

Please note, if your Clickhouse storage is nearing capacity, you'll want to temporarily increase your volume size before running the command above (even if you're decreasing the value). Otherwise, the command can hang.

Legacy Postgres Self-hosted

Recordings are kept indefinitely by default. You can can set recordings to delete after a configurable number of days in the project settings page.

Preserving recordings

We're working towards a solution for archiving and preserving recordings data for future reference. You can follow up on this GitHub issue.

In order to simplify the archival process, since posthog-js 1.24.0, recording length is capped at 24 hours.

Further controls

If you want more granular controls, you can choose to enable session recording using feature flags. This enables you to control session recordings based on users with certain previous events/actions or properties (or just to capture a percentage of all sessions).

To do this set disable_session_recording in our JavaScript library config to true.

Then conditionally call the method posthog.startSessionRecording to enable it using the feature flag.

For example:

window.posthog.onFeatureFlags((function() {
if (window.posthog.isFeatureEnabled("your-feature-flag")) {
window.posthog.startSessionRecording()
}
})

Recording configurations

There are some configurations that can be used to adjust how recordings are captured.

AttributeDescription
maskAllInputs

Type: Boolean
Default: true
When true, all data from user input fields will be replaced by '*'s.
maskInputOptions

Type: Object
Default: {}
Only takes effect if maskAllInputs is false. It determines which specific input field types should be masked. An example value might be { password: true }. Options are: password, textarea, select, color, date, email, month, number, range, search, tel, text, time, url, week, and datetime-local.
inlineStylesheet

Type: Boolean
Default: true
If false, stylesheets will not be included with the recording data. Rather, a URL pointing to the stylesheet will be included. Setting this to false will decrease the storage space used for recordings and improve playback buffering time, but it can also cause some flickering in the playback experience.

To configure these options, pass them to your posthog.init call along with your other posthog-js configurations. They go inside of the session_recording attribute, like so:

posthog.init('<ph_project_api_key>', {
api_host: '<ph_instance_address>',
session_recording: {
inlineStylesheet: false
}
// ... other options
})

Troubleshooting

Having trouble with recordings? Below are some tips for getting past some common issues

Recordings are not being captured

There are a few common reasons that you may not see recordings appear in your project.

Permitted domain setting

In your project settings page, there's a section for 'Authorized URLs'. This is the list of domains where posthog will capture recordings. You should make sure it's not too restrictive.

For example, you may have https://www.example.com in the list. This will stop PostHog from capturing recordings on https://example.com.

If no domains are set here, PostHog will capture recordings on all domains.

posthog-js configurations

If you had previously disabled session recordings, you may have set the disable_session_recording option to true in posthog-js.

To re-enable session recordings you want to either remove the disable_session_recording option or set it to false.

You can read more about posthog-js configurations here.

Content security policy

When recordings are enabled, postHog-js will fetch a recorder.js script from the PostHog server. (This is not included in the default posthog-js to minimize the default bundle size)

Depending on your content security policy, this script may be blocked. If you have a default-src, script-src, script-src-elem, or connect-src directive in your CSP, you may need to add https://app.posthog.com (or your host URL if you are self hosted) to your list.

If PostHog is being blocked by your content security policy, you should see an error message in your developer console with more details.

Ad/tracking blockers

Some ad/tracking blockers will block PostHog from fetching posthog-js. If you're testing your app locally, you may need to disable any ad/tracking blockers that you're running in your browser.

Website is not recording properly

If you're having issues with recordings not looking correct, there are a couple things to do.

Update posthog-js

We're always making improvements to the recordings feature, so you'll want to make sure that you're running the latest version of posthog-js on your website.

To check the version that you're using, you can run the following in your console:

window.posthog.LIB_VERSION

Report your specific issue

To report a specific problem, you can open a GitHub issue. To help us figure it out as quickly as possible, please include the following information:

  • The URL of the page that you're trying to record
  • The version of posthog that you're using
  • The version of posthog-js that you're using
  • Details about the specific issue with your recording (e.g. how it looks and how it should look)
  • If you're on posthog-cloud, a link to the specific recording
  • Any unique details about your website (e.g. the frameworks that you're using etc.)

Questions?

Was this page useful?

Next article

Correlation Analysis

What is Correlation Analysis and what is it good for? Correlation Analysis is a feature within Funnels that will automatically highlight significant factors that affect the conversion rate of users within the funnel. The Funnels has the ability to directly compare conversion rates of users for a specific property via the breakdown feature. An example usage for the breakdown feature might be to see how the user's Operating System affects the conversion rate. However, this requires you to…

Read next article

Share

Related articles

  • How to build, analyze and optimize conversion funnels in PostHog
  • Building and measuring a sign up funnel with Next.js, Supabase, and PostHog

Jump to:

  • Using Session Recording
  • Ignoring sensitive elements
  • Recordings data retention
  • PostHog Cloud & Clickhouse Self-hosted
  • Legacy Postgres Self-hosted
  • Preserving recordings
  • Further controls
  • Recording configurations
  • Troubleshooting
  • Recordings are not being captured
  • Website is not recording properly
  • Questions?
  • Edit this page
  • Raise an issue
  • Toggle content width
  • Toggle dark mode
  • About
  • Blog
  • Newsletter
  • Careers
  • Support
  • Contact sales

Product OS suite

Product overview

Analytics
  • Funnels
  • Trends
  • Paths

Pricing

Features
  • Session recording
  • Feature flags
  • Experimentation
  • Heatmaps

Customers

Platform
  • Correlation analysis
  • Collaboration
  • Apps

Community

Discussion
  • Questions?
  • Slack
  • Issues
  • Contact sales
Get involved
  • Roadmap
  • Contributors
  • Merch
  • PostHog FM
  • Marketplace

Docs

Getting started
  • PostHog Cloud
  • Self-hosted
  • Compare options
  • Tutorials
  • PostHog on GitHub
Install & integrate
  • Installation
  • Docs
  • API
  • Apps
User guides
  • Cohorts
  • Funnels
  • Sessions
  • Data
  • Events

Company

About
  • Our story
  • Team
  • Handbook
  • Investors
  • Careers
Resources
  • FAQ
  • Ask a question
  • Blog
  • Press
  • Merch
  • YouTube
© 2022 PostHog, Inc.
  • Code of conduct
  • Privacy
  • Terms