Creating surveys

Last updated:

|Edit this page

To create a new survey, go to the surveys tab in the PostHog app, and click on the "New survey" button in the top right.

This presents you with a form where you can complete the details of your new survey:

Create a survey

Here's a breakdown of each field in the form:

Display mode

There are two options for displaying a survey:

  1. Popover: Use PostHog's prebuilt user interfaces to show survey's as a popover in the bottom corner of the screen.

  2. API: Implement your own survey UI and use PostHog to handle display logic, capturing results, and analytics.

Question type

PostHog supports multiple questions types. All survey types are available for both popover and API display modes.

TypePreview
Open textOpen text survey
LinkLink survey
Rating - emojiEmoji rating survey
Rating - numberNumber rating survey
Single choice selectSingle choice select survey
Multiple choice selectMultiple choice survey

Targeting

This specifies the conditions a user must meet to be shown the survey. A user must meet ALL the conditions to be eligible.

You can target your survey to specific users based on:

  • Linked feature flag: Whether a user has a specific feature flag enabled. For example, if you're rolling out a new landing page using a feature flag new-landing-page, you can gather feedback only from users who have that flag enabled.

  • Page URL contains: Where the current URL contains a specific string.

  • Selector matches: Whether a specific element appears on the page with the specified class name or ID. For example, you can target a survey with #my-button or .my-button selector.

  • User/group properties: You can target a survey to users who have a specific user or group property. For example, you can target a survey to users who have a property is_paying=true.

Survey targeting options

Want your survey to show up after a delay? Use selector matching to match a class, then add logic to add that class to your page after a delay. See the full set up in our on how to show a survey after a delay

Launching your survey

Once you've set up your survey, click "Save as draft" to save your survey. This enables you to review any changes before launching. Then, when you're ready to launch, click the "Launch" button.

If you've created a popover survey, your survey will begin showing immediately.

If you've created an API survey, you'll need to add your custom survey code before launching.

Questions?

Was this page useful?

Next article

Implementing custom surveys

Note: This is not required for popover surveys . If you're using PostHog's survey API to create a custom survey UI, there are 2 steps to integrating with PostHog: Step 1: Fetch active surveys To fetch the surveys currently enabled for a user, call posthog.getActiveMatchingSurveys() . Alternatively, if you wish to do survey targeting yourself, you can call posthog.getSurveys() to return a list of all surveys from PostHog. Both methods return a callback with a surveys object: Thus you…

Read next article