<head> section of your Link Surveys. This is useful for adding tracking pixels, analytics scripts, chatbots, or any other third-party code.
Custom Head Scripts is only available for Link Surveys on self-hosted instances. This feature is not available for Website & App Surveys or on Formbricks Cloud.
When to Use Custom Head Scripts
Use Custom Head Scripts when you need to:- Add analytics tools (Google Analytics, Plausible, Mixpanel, etc.)
- Integrate tracking pixels (Facebook Pixel, LinkedIn Insight Tag, etc.)
- Include custom JavaScript for advanced survey behavior
- Add third-party widgets or chatbots
- Inject custom meta tags or stylesheets
Configuration Guide
Workspace-Level Scripts
These scripts apply to all link surveys in your workspace.
1
Navigate to Workspace Settings
Go to your Workspace Settings from the main navigation menu.
2
Locate Custom Scripts Section
Scroll down to the Custom Scripts card in the General settings.
3
Add Your Scripts
Paste your HTML code into the text area. You can include:
<script>tags (inline or withsrcattribute)<meta>tags<link>tags for stylesheets<style>tags<noscript>tags
4
Save Your Changes
Click the Save button to apply your custom scripts to all link surveys.
Survey-Level Scripts
Override or extend workspace scripts for specific surveys.
1
Open Share Survey Modal
Navigate to your survey and click the Share button to open the share modal.
2
Go to Custom HTML Tab
In the share modal, click on the Custom HTML tab under the “Share Settings” section.
3
Choose Script Mode
Select how you want survey scripts to interact with workspace scripts:
- Add to Workspace Scripts - Survey scripts will be added after workspace scripts (both run)
- Replace Workspace Scripts - Survey scripts will replace workspace scripts entirely (only survey scripts run)
4
Add Survey-Specific Scripts
Paste your HTML code into the “Survey Scripts” text area.Example (Facebook Pixel for a specific campaign):
5
Save Changes
Click Save to apply the survey-specific scripts.
To keep in mind
-
Scripts Don’t Load in Preview Mode — Custom Head Scripts are not loaded in preview mode (editor preview or
?preview=true). This prevents analytics tracking and pixel triggers during testing. To test your scripts, publish your survey and view it through the actual link survey URL without the preview parameter. - Link Surveys Only — Custom Head Scripts only work with link surveys. They are not available for app/website surveys, as those are embedded in your application and should use your application’s existing script management.
- Self-Hosted Only — This feature is only available on self-hosted instances. Formbricks Cloud does not support Custom Head Scripts for security and performance reasons.
- Permissions — Only Owners, Managers, and members with Manage access can configure Custom Head Scripts.
Common Use Cases
Global Analytics (Workspace Level)
Set up Google Analytics for all surveys in your workspace:Campaign-Specific Tracking (Survey Level with Add Mode)
Add Facebook Pixel tracking for a specific marketing campaign: Workspace Scripts: Google Analytics (as above) Survey Scripts:Custom Fonts (Workspace Level)
Load custom fonts for all your surveys:Troubleshooting
If your scripts aren’t loading, check:- Is it a self-hosted instance? Custom scripts only work on self-hosted Formbricks.
- Are you in preview mode? Scripts don’t load in preview—test with the actual survey link.
- Check the browser console for JavaScript errors that might prevent script execution.
- Verify your HTML syntax is correct (properly closed tags, valid attributes).