Skip to content

Formbricks surveys in Easy8

Short in-app surveys (CSAT and CES) let product teams measure how users feel about a feature. A feature shows a feedback button; clicking it opens a popover with the survey. The survey structure lives in Formbricks; Easy8 renders it with Design System components, takes all visible texts from its own translations and stores the answers back in Formbricks.

Setup

Surveys are offered to a logged-in user only when all of these hold:

  • the feature toggle easy_formbricks_surveys_enabled is on for the user (registered as experimental in easy_plugins/easy_formbricks_surveys/config/initializers/features.rb),
  • both environment variables below are set.

Formbricks is operated by Easy8, so the connection is configured through the environment of each Easy8 instance:

Variable Value
EASY_FORMBRICKS_URL Base URL of the Formbricks instance, e.g. https://formbricks.example.com
EASY_FORMBRICKS_WORKSPACE_ID Workspace ID from the Formbricks dashboard URL

With any of these missing nothing is requested and no button is rendered. Formbricks.enabled? (easy_plugins/easy_formbricks_surveys/app/services/formbricks.rb) is the backend check; the page receives the same answer as window.EasyFeature.formbricksSurveysEnabled.

Adding a survey to a feature

1. Define the survey in Formbricks

  1. Actions → Add action → Code action. Choose a key that names the feature, for example issue_detail_feedback. Easy8 code refers to the survey only through this key.
  2. Create a survey with:
  3. exactly one CSAT or CES question; write only the feature name into its text (for example Task 2.0), Easy8 builds the sentence around it,
  4. optionally a Free text question after it for the reason,
  5. Required on the rating, if every response must contain it.
  6. Settings:
  7. Survey Type → Website & App,
  8. Survey Trigger → the code action from step 1,
  9. Response Options → Auto-progress rating and NPS questions to move on right after the user picks a number,
  10. Visibility & Recontact → Keep showing while conditions match keeps the button available after an answer; other options hide it after the first display or answer.
  11. Optionally add:
  12. the hidden fields easy_user_id and instance, so every response tells which user and instance it came from,
  13. a number Variable auto_open_after_days, see below.
  14. Publish. Easy8 picks up changes within 5 minutes.

2. Place the button in Easy8

Put the button among the feature's header or toolbar actions. The button renders only when a published survey uses that action and its display option allows it. Without Formbricks or a matching survey nothing is rendered, so feature code does not need to guard it.

From Vue, import it from the module entrypoint:

<script setup lang="ts">
import { FormbricksFeedback } from "@/src/shared_modules/formbricks_feedback";
</script>

<template>
  <FormbricksFeedback action-key="<action key>" />
</template>

From a Rails view, use the Design System helper. It renders the easy8-formbricks-feedback-button custom element and returns nothing when surveys are off:

<%= formbricks_feedback_button(action_key: "<action key>") %>

The helper takes only action_key:. The component is shown in Storybook as Shared Modules/FormbricksFeedback.

Behaviour of the popover:

  • Display option limits only what is offered. Reopening the popover after a finished response starts a new attempt.
  • Automatic opening: with the Variable auto_open_after_days, the popover opens by itself on the next page load when the user has not answered that many days after the button was first offered. It opens only once, and not while the workspace cooldown since another survey is running. Without the variable it never opens by itself.

Example: CSAT in the task detail header

  • Formbricks: code action issue_detail_feedback, a CSAT question with the text Task 2.0, a Free text question, auto-progress on, Keep showing while conditions match, Variable auto_open_after_days = 7.
  • Easy8, in app/frontend/src/issue_detail_v2/header/components/IssueDetailHeaderActions.vue, next to the other header buttons, with ISSUE_DETAIL_FEEDBACK_ACTION_KEY (issue_detail_feedback) from app/frontend/src/issue_detail_v2/header/constants/feedback.ts:
<FormbricksFeedback :action-key="ISSUE_DETAIL_FEEDBACK_ACTION_KEY" />
  • The user sees a feedback button; clicking it opens "How satisfied are you with Task 2.0?" with a scale from 1 to 5, then "What's the main reason for your rating?". If they never click it, the popover opens by itself a week after they first saw the button.

Answers and delivery

  • A rating given before the last step is saved in Formbricks as an unfinished response and stays there until the response is finished. Reopening the same popover keeps the answers on screen; reloading the page does not prefill them.
  • Only a finished response marks the survey as answered.
  • If delivery of a finished response fails permanently, its answered mark is cleared, and an unfinished response it would have finished stays open for the next answer. The survey is offered again unless an earlier finished response of the user still marks it answered or its display option has no displays left (Show only once, or a reached display limit).
  • Answers are validated (minimum length, range, required) and reported as errors. The page URL is sent without query and fragment.
  • The scale is keyboard operable: it is one Tab stop and the arrow keys select a value. With auto-progress selecting a value moves on, whether by a click or from the keyboard; the scale stays above the follow-up, so the rating can still be changed.

Texts and translations

Formbricks defines the structure only. All visible texts come from easy_plugins/easy_formbricks_surveys/config/locales/*.yml under easy_formbricks_surveys, in the user's language. The feature name from the Formbricks question is interpolated as %{feature}; when it is empty, Easy8 is used.

Text CSAT CES
Question csat.question ces.question
Scale labels csat.lower_label, csat.upper_label ces.lower_label, ces.upper_label
Free-text question csat.follow_up ces.follow_up
Free-text placeholder csat.placeholder ces.placeholder

textarea_label, ending.headline, ending.subheader, feedback_button, heading, next and finish are shared. New languages go through the usual translation of these keys. Formbricks multi-language surveys, labels, placeholders and ending cards are ignored.

What Easy8 takes from Formbricks

Formbricks setting Behaviour in Easy8
CSAT / CES question Exactly one per survey; a row of DS buttons from 1 to its range.
Free text question DSTextarea for long answers, otherwise DSTextField.
Required Blocks moving on until the question is answered.
Display option Whether the button stays: once, until answered, always, or a limited number of times.
Recontact days Only for automatic opening: the survey value, otherwise the workspace cooldown, counted from the last survey shown.
Auto-progress rating questions A rating alone in its block moves on right after a value is selected.
Free text character limit Minimum and maximum length of the answer; without a limit Easy8 caps answers at 5000 characters.
Hidden fields easy_user_id, instance Filled in by Easy8.
Variable auto_open_after_days Days before the popover opens by itself.

Not supported: other question types (rating, NPS, multiple choice, matrix and so on) or more than one CSAT/CES question, segment targeting (Easy8 does not sync contacts), display percentage and delay. Such surveys are skipped or the settings ignored. Conditional logic is also ignored: questions follow block order. Formbricks styling and branding are not used.

Testing locally

  • Turn the feature toggle on for your user and point the two environment variables at a local Formbricks (see Setup), then restart the Rails server.
  • Open the page with the button. Changes in Formbricks reach Easy8 within 5 minutes because of the definition cache.
  • To test automatic opening or a hidden button again, clear the user's survey history:
pref = User.find(id).pref
pref[:formbricks_surveys] = {}
pref.save!

Code locations

The backend is delivered by the internal plugin easy_formbricks_surveys; paths below are relative to easy_plugins/easy_formbricks_surveys/ unless marked as core.

  • Gate: app/services/formbricks.rb.
  • Formbricks client, survey definition, survey selection and per-user history: app/services/formbricks/ (client.rb, survey.rb, survey_selector.rb, survey_history.rb).
  • Background delivery to Formbricks with retries: app/jobs/formbricks/.
  • GraphQL: query formbricksSurveyOffer(actionKey) in app/api/easy_graphql/resolvers/formbricks_survey_offer.rb; mutations recordFormbricksSurveyOffer, recordFormbricksSurveyDisplay and submitFormbricksSurveyResponse in app/api/easy_graphql/mutations/formbricks/; types in app/api/easy_graphql/types/formbricks_survey*.rb; the Query and Mutation fields are added by patches/easy_graphql/types/query_patch.rb and mutation_patch.rb.
  • Page flag window.EasyFeature.formbricksSurveysEnabled: set by the hook in app/utils/easy_formbricks_surveys/hooks.rb.
  • Rails helper component (core): app/easy_design/design_system/components/formbricks_feedback_button.rb.
  • Vue module (core): app/frontend/src/shared_modules/formbricks_feedback/.

When UTM tracking is enabled, every mutation carries utm_campaign=formbricks_surveys, utm_content set to the action key and utm_term set to offer, display, partial or submit.

The per-user history (displays, answers, open response, when the button was offered) is kept in UserPreference[:formbricks_surveys], keyed by survey id. It grows by one entry per survey id, and entries of deleted surveys are not pruned.