In-app prompts

Last updated:

|Edit this page

These are instructions to set up in-app prompts using an internal tool for the PostHog team only. To set up your own, check out this tutorial on "How to add popups to your React app with feature flags"

If you want to announce a new feature, invite a customer to a Slack channel, or drive engagement of a particular feature in the product, you might want to use our internal in-app prompts tool.

How to create a new prompt

In-app prompts are powered by JSON feature flags.

  1. Create a new feature flag with the name starting with prompt-

  2. Add the payload (delete the comments such as // optional)

    JSON
    {
    "title": "title of the prompt",
    "body": "body of the prompt, can be HTML including links",
    "type": "popup", // can be "modal" or "prompt"
    "image": "url of the image", // optional
    "url_match": "regex to match url against e.g. '.*feature_flags.*'", // optional
    "primaryButtonText": "text for the primary button", // optional
    "secondaryButtonText": "text for the secondary button", // optional
    "primaryButtonURL": "url for the primary button (opens in a new window)" // optional
    }
  3. Add the cohort or user properties that you want to show the prompt to.

    • If you want to show a prompt based on events, you should create a dynamic cohort based on the event, then export the cohort and use it to create a static feature flag.
  4. Important Add the release condition that the user property ${feature_flag_name} is not set. This ensures that the prompt is only shown once.

It will only show one prompt a day, no matter how many prompt feature flags are enabled.

It's recommended to run the prompt for yourself first to make sure it works as expected. You can keep changing the text and refreshing. When you click one of the buttons, it won't show you the popup again. The easiest way to retest it is to change the feature flag name (make sure to keep the user property ${feature_flag_name} up to date) and run this in your javascript console localStorage.removeItem("prompt-last-seen").

Examples

Shows in the middle of the screen. It's more intrusive than a popup.

Modal prompt

Shows in the bottom right corner. It's less intrusive than a modal.

Popup prompt

Questions?

Was this page useful?

Next article

Overview

Our primary focus is on making our paying customers successful, not forcing sales through. We follow a 100% inbound sales model - our approach to product-led growth means that we do not do cold outreach. Our plan is to put this off for as long as possible - ideally to $50m+ ARR. While this means working with a smaller number of users than typical B2B SaaS companies, we know that the people we talk to are mostly already pre-qualified and genuinely interested in potentially using PostHog. The…

Read next article