Website surveys are embedded directly on your website using the Formbricks JavaScript SDK. They can be triggered by user actions, page views, or custom events without requiring page navigation.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/formbricks/formbricks/llms.txt
Use this file to discover all available pages before exploring further.
How Website Surveys Work
Website surveys use the@formbricks/js-core package to:
- Initialize connection to your Formbricks environment
- Track user actions and page views
- Display surveys based on triggers and conditions
- Submit responses without page reload
Installation
Framework Integration
HTML / JavaScript
React
Next.js
Vue.js
Survey Triggers
Website surveys can be triggered by various user actions:No-Code Triggers
Configure these triggers directly in the Formbricks UI without writing code.- Page View
- Click
- Exit Intent
- 50% Scroll
Trigger surveys when users visit specific pages.URL match options:
exactMatch- Exact URL matchcontains- URL contains stringstartsWith- URL starts with stringendsWith- URL ends with stringnotMatch- URL doesn’t matchnotContains- URL doesn’t contain string
Code Triggers
Trigger surveys programmatically from your application code.completed-checkout.
Display Options
Control how often surveys appear to users:Display Once
Show survey only once per user, whether they respond or not.Display Multiple
Keep showing until user submits a response.Display Some
Show survey a specific number of times.Respond Multiple
Allow users to respond multiple times.Display Criteria
Recontact Days
Set minimum time between survey displays:Display Percentage
Show surveys to a percentage of qualifying users:Audience Targeting
Target specific user segments:User Identification
Identify users to track responses and enable advanced targeting:User data is stored locally and synced with your Formbricks instance for targeting and response tracking.
Page Change Tracking
For single-page applications, manually register route changes:Survey Display Modes
Website surveys support two display modes:Modal (Default)
Survey appears as an overlay modal:Inline
Embed survey directly in page content:Styling Customization
Customize survey appearance to match your brand:Best Practices
Initialize early
Initialize early
Call
formbricks.setup() as early as possible in your app lifecycle to ensure surveys can trigger on first page load.Use meaningful action names
Use meaningful action names
Choose descriptive action identifiers like
viewed-pricing-page instead of generic names like action1.Test thoroughly
Test thoroughly
Use your development environment to test trigger conditions before deploying to production.
Respect user experience
Respect user experience
Set appropriate
recontactDays to avoid survey fatigue. 7-14 days is recommended for most use cases.Monitor performance
Monitor performance
The SDK is lightweight (~15KB gzipped) but test performance impact on your site.
Troubleshooting
Survey not appearing
Survey not appearing
- Check browser console for errors
- Verify
environmentIdandappUrlare correct - Ensure survey type is set to App
- Confirm trigger conditions are met
- Check if user has already seen survey (displayOption)
- Verify survey status is
inProgress
Actions not tracking
Actions not tracking
- Verify action code matches exactly (case-sensitive)
- Check network tab for failed API calls
- Ensure
formbricks.setup()completed before tracking
Styling not applying
Styling not applying
- Clear browser cache
- Check for CSS conflicts with your site styles
- Verify styling object structure matches schema
Related Resources
App Surveys
Implement surveys in mobile apps
JavaScript SDK
Complete SDK reference
Conditional Logic
Create dynamic survey flows
Custom Styling
Advanced styling options