Skip to main content
Docs Feedback allows you to measure how clear your documentation is.

Purpose

Your users don’t spend as much time thinking about your product as you do. To fight the β€œCurse of Knowledge” you have to measure how clear your docs are.

Installation

To get this running, you’ll need a bit of time. Here are the steps we’re going through:
  • Set up Formbricks Cloud
  • Build the frontend
  • Connect to API
  • Test

1. Setting up Formbricks Cloud

Create a Formbricks Cloud account, then a survey from the Docs Feedback template β€” New Survey β†’ Choose a template, then search for it. Open Settings β†’ Survey Type and make sure Link survey is selected. A new survey inherits its type from the workspace channel chosen during onboarding, so a workspace set up for a website or app creates app surveys by default β€” check it rather than assuming it. This matters more than it looks. You are going to post responses to the client API from your own frontend, so nothing here uses the Formbricks widget. An app survey cannot be published without a trigger β€” survey-menu-bar.tsx refuses to save one with no triggers β€” which is why older versions of this guide told you to invent an action that never fires. A link survey has no such requirement, so the workaround is unnecessary.

Set the question IDs

The frontend below refers to questions by ID, so give them names you will recognise. Open a question, click Show Question settings at the foot of its card, and set the Question ID:
The answers must match the frontend too. If you replace β€œYes πŸ‘β€ and β€œNo πŸ‘Žβ€ with your own wording, change the choices in the code below to match β€” they are compared as strings.
Question IDs can only be changed before a survey is published. Afterwards they are fixed, because the responses already collected refer to them. Set them now.
Publish the survey.

2. Build the frontend

Your frontend might work differently Your frontend likely looks and works differently. This is an example specific to our tech stack. We want to illustrate what you should consider building yours.
Before we start, lets talk about the widget. It works like this:
  • Once the user selects yes/no, a partial response is sent to the Formbricks API. It includes the feedback and the current page url.
  • Then the user is presented with an additional open text field to further explain their choice. Once it’s submitted, the previous response is updated with the additional feedback.
This allows us to capture and analyze partial feedback where the user is not willing to provide additional information. Let’s do this πŸ‘‡
  • Open the code editor where you handle your docs page.
  • Likely, you have a template file or similar which renders the navigation at the bottom of the page:
doc navigation Locate that file. We are using the Tailwind Template β€œSyntax” in this case.
  • Write the frontend code for the widget. Here is the full component (we break it down right below):
Entire Widget
Let’s break it down! Setting the local states and getting the current URL:
State Management
Disabling feedback if config environment variables are not set properly:
Disable feedback if incorrect config env vars
The actual frontend (read comments):
Actual Frontend

3. Connecting to the Formbricks API

The last step is to hook up your new frontend to the Formbricks API. To achieve that, we followed the β€œCreate Response” and β€œUpdate Response” pages in our docs. Here is the code for the handleFeedbackSubmit function with comments:
handleFeedbackSubmit() function definition
And this is the updateFeedback function with comments:
updateFeedback() function definition
We’re almosr there! 🀸

4. Setting it up for testing

Before you roll it out in production, you want to test it. To do so, you need two things:
  • the workspace ID
  • the survey ID of your test survey
Open the survey and read both out of the address bar β€” they are the two path segments:
Now, you have to replace the IDs and the API host accordingly in your handleFeedbackSubmit:
Replace the ID and API accordingly
And lastly, in the updateFeedback function
Replace the ID and API here as well

You’re good to go! πŸŽ‰

Something doesn’t work? Check your browser console for the error. Need help?Β Reach out in GitHub Discussions