Introducing the Formaly SDK: Survey Your Users, Inside Your Product
A lightweight JavaScript library that shows targeted, contextual surveys to the right users at the right moment, directly inside your product, without a single email.
Arindam Majumder
Founder, Formaly
Today we are shipping the Formaly SDK.
It is a small JavaScript file (under 10KB minified) that you add to your product once and then never have to touch again. From that point on, you configure everything in the Formaly dashboard: which survey to show, when to show it, who to show it to, and how it appears on screen.
No redeploys for survey changes. No email campaigns. No hoping that the right user opens the right inbox at the right time. The survey finds them, where they already are, at the moment that matters.
The honest reason we built this
I have been building Formaly for a while now. We have a good product: AI-generated surveys, a conversational chat mode, solid analytics. Teams use us to collect user research, NPS, CSAT, onboarding feedback, and more.
But there was a pattern I kept noticing: users would create a survey, share a link, and then wait. The link would go out in a Slack message, or a newsletter, or an onboarding email. Some responses would trickle in. Usually not enough.
The problem was the gap between the experience and the question. You upgraded a user to a paid plan; great, now wait for them to open an email and fill out a form. You shipped a new feature; great, hope they remember to fill out that survey you sent last Tuesday. The feedback was always from memory, always filtered through whatever mood the user was in when they happened to check their inbox.
In-product surveys close that gap. Ask the question at the moment the thing happened. The user just used the feature; ask now. They just hit an error; ask now. They just churned; ask now. That is the only version of this conversation worth having.
Tools like Pendo and Intercom have this. Formbricks has it as an open-source product. But I wanted Formaly to have it too, built on top of the same AI survey engine, the same analytics, the same editor, just delivered directly inside your product instead of via a link.
So we built it.
How it works: the 60-second version
Add the script tag. Initialize with your API key. Call Formaly.identify() with your user's attributes. Done.
Setup: complete integration
<!-- 1. Add to your layout, once -->
<script src="https://formaly.io/formaly-sdk.js" defer></script>
<script>
// 2. Initialize with your API key
Formaly.init({ apiKey: "fml_YOUR_KEY_HERE" });
// 3. Identify your user (call this after login)
Formaly.identify({
userId: currentUser.id,
plan: currentUser.plan, // "free" | "pro" | "enterprise"
daysActive: currentUser.daysActive,
role: currentUser.role,
});
</script>From here, everything else happens in the Formaly dashboard. You create a survey, configure its targeting rules (when it shows, who it shows to, how it appears) and save. The SDK picks up the config on the next page load and handles the rest.
If you want to trigger a survey manually from your own application logic:
Manual trigger
// Show after a specific user action
async function handleFeatureActivated() {
await activateFeature();
Formaly.show("your-survey-id");
}
// Listen for completions
Formaly.on("complete", ({ surveyId }) => {
analytics.track("Survey Completed", { surveyId });
});What is in the box
Six trigger types
Show surveys on a delay, after a scroll depth, on exit intent, when a specific element is clicked, on page load, or manually from your own code. Mix and match; the survey fires on whichever trigger hits first.
Audience conditions
Target by any user attribute you pass via Formaly.identify(): plan tier, days active, role, feature usage, cohort. Nine operators (equals, contains, greaterThan, exists, and more) let you build precise rules without writing custom filter logic.
Three display formats
Popup for surveys that need attention. Slide-in for non-blocking prompts that sit in a corner. Widget for a persistent feedback bubble that expands on click. Each format has configurable position: bottom-right, bottom-left, top-right, or top-left.
Built-in cooldown and completion tracking
Set a cooldown in days; the same user won't see the survey again until the window expires. Once a user completes a survey, it never shows again. All tracked in localStorage with no server round-trip.
No-code configuration
All targeting rules are configured in the Formaly editor, not in code. Change a trigger, add a condition, or swap the display format without touching your JavaScript. The SDK picks up changes on the next page load.
A clean event API
Listen for shown, dismissed, and complete events. Fire analytics, update a user profile, or trigger a follow-up flow when someone finishes. One method to add a listener, one to remove it.
Five real scenarios and how to configure them
Abstract descriptions of triggers and conditions are useful to a point. Here is what the SDK actually looks like applied to real product feedback moments.
NPS after upgrade
Trigger
Page view on /dashboard/billing/success
Audience
plan equals "pro" AND daysActive lessThan 1
Display
Popup
Why this works
The highest-signal NPS moment is immediately after someone puts money down. Context is perfect; the user just made a decision. Response rate on this trigger consistently beats email NPS by 3 to 5×.
Feature adoption feedback
Trigger
Element click on #run-report-btn
Audience
reportCount greaterThan 3
Display
Slide-in
Why this works
You know they used the feature more than once before asking. The element click trigger fires exactly when they are engaging with it, not an hour later in an email.
Churn intent survey
Trigger
Exit intent on /settings/billing
Audience
plan notEquals "free"
Display
Popup
Why this works
If a paying user is on the billing settings page and moves to leave, there is a reasonable chance they are about to cancel. One question, "What almost made you leave today?", can surface actionable retention data.
Onboarding quality check
Trigger
Delay: 10 seconds on /dashboard
Audience
daysActive lessThan 3
Display
Slide-in
Why this works
Three days in, the user has enough experience to give real feedback but not so much that the onboarding experience has faded. A short CSAT question here tells you whether your first-week experience is working.
Always-available feedback
Trigger
Element click on #feedback-widget
Audience
(no conditions; show to everyone)
Display
Widget
Why this works
A persistent floating widget gives power users and frustrated users alike a direct channel. The widget format never interrupts; it just stays available for users who want to say something.
All configuration lives in the dashboard
One of the design decisions I am most happy with: you never have to touch your codebase to change a survey's targeting rules. The SDK fetches the current config on every page load. You update the rules in the editor, save, and they are live.
This matters for teams. The engineer who installs the SDK and the product manager who owns the feedback program are probably not the same person. Once the SDK is installed, the PM can run the entire survey operation from the dashboard (creating surveys, configuring targeting, adjusting cooldowns, reading results) without filing a single ticket.
Open any survey in the Formaly editor
Scroll to In-Product Targeting at the bottom of the edit page
Toggle targeting on; a default delay trigger is added automatically
Configure display mode, triggers, audience conditions, and cooldown
Save; the change is live immediately
What makes this different from Intercom or Pendo surveys
Fair question. Intercom has in-app surveys. Pendo has in-app guides with survey overlays. They work. They are also attached to expensive platform subscriptions that bundle a lot of things you may not need.
The Formaly SDK is specifically designed around survey quality, not around messaging, engagement scoring, or product analytics. The surveys you create in Formaly are AI-generated, conversational, and backed by the same analytics engine that runs sentiment analysis, completion funnels, QC checks, and cross-tab breakdowns on every response.
You are not getting a survey bolt-on to a platform. You are getting a purpose-built feedback tool that now has a delivery mechanism that meets users where they are.
| Capability | Intercom / Pendo | Formaly SDK |
|---|---|---|
| In-product survey triggers | Yes | Yes |
| AI survey generation | - | Yes |
| Conversational / chat mode | - | Yes |
| Sentiment + theme analysis | Limited | Yes |
| Completion funnel analytics | - | Yes |
| QC / data quality flags | - | Yes |
| No-code targeting config | Yes | Yes |
| Dedicated survey pricing | - | Yes |
Size, performance, and what it does not do
The SDK is 9.8KB minified. It makes one network request on init: a single fetch to GET /api/sdk/surveys that returns only the surveys relevant to your API key with targeting rules. No polling, no WebSocket, no persistent connection. After that, all logic runs locally.
Surveys render in an iframe loaded from formaly.io/embed/[id]. This means the survey content is served from our infrastructure, not yours, and survey updates (question edits, theme changes) are reflected immediately without any involvement from your application.
It does not track users beyond the survey interaction. It does not send analytics events. It does not set any cookies. Everything it stores goes into localStorage under keys prefixed with fml_: one key per survey to track when it was last shown, one to mark completion. That is the full extent of its storage footprint.
What is coming next
This is version one. It covers the most common targeting patterns and display formats. Here is what we are building toward:
URL-pattern scoping per trigger
Already supported in the trigger config; surface it more clearly in the editor UI.
A/B testing for triggers
Run two trigger strategies in parallel and compare response rates and sentiment.
Webhook on completion
Fire a webhook when a user completes a survey; push the response to your CRM, your data warehouse, or your own analytics pipeline.
npm package
For teams using a bundler: import Formaly as a module instead of a script tag.
React / Vue / Svelte wrappers
A thin component wrapper so the SDK feels native to your stack.
If there is something specific you need that is not listed here, reach out. The roadmap is built from what teams actually ask for.
Go ship a survey
Email surveys are not going away. They still have a place, especially for surveys sent to non-users, or follow-ups weeks after an event. But for the moments that matter most (the upgrade, the first week, the feature adoption, the near-churn), in-product surveys win on every metric.
Response rate. Response quality. Time-to-insight. The context-aware question asked at the right moment, to the right user, in the right format, will always beat the email that lands two days later and competes with twelve other messages in an inbox.
The SDK is live. The install takes five minutes. Go collect some feedback worth having.
Install the SDK today
Free to start. Add the script tag, get an API key, configure targeting in the dashboard; no code changes after that.