Custom JavaScript is available on all plans, including Free.
Start Here
Overview
The Custom JavaScript feature allows you to add any JavaScript code to your forms. Use it for custom analytics events, third-party integrations, A/B testing scripts, or any other functionality that requires JavaScript.Why This Matters
Sometimes you need tracking or functionality that’s specific to your stack. Custom JavaScript gives you full control to add any code to your forms—fire custom conversion events, load third-party widgets, or implement advanced tracking that built-in integrations don’t cover.Use Cases
Custom Events
Fire custom Meta Pixel, GA4, or other tracking events
Third-Party Scripts
Add chat widgets, heatmaps, or A/B testing
Custom Logic
Run code when the form loads or on user actions
Advanced Tracking
Implement custom conversion tracking
Setup Guide
Open your form settings
Go to your form in the dashboard and click on the “Integrate” tab.
Forms → Select form → Integrate tabFind Custom JavaScript
Scroll down to the Custom JavaScript section under Tracking & Analytics.
Scroll to "Custom JavaScript" sectionEnter your code
Paste your JavaScript code into the text area. The code will execute when the form loads.
Paste code into text areaCode Examples
Meta Pixel Custom Event
Fire a Lead event with custom parameters:Google Analytics Custom Event
Send a custom event to GA4:Debug Logging
Log when the form loads (for testing):Load Third-Party Script
Dynamically load an external script:Important Notes
When code runs — Custom JavaScript executes when the form page loads. If you need to run code on form submission,
consider using webhooks or workflows instead.
Troubleshooting
Code not running?
Code not running?
Open browser developer tools (F12) and check the Console tab for errors. Syntax errors will
prevent your code from executing.
Third-party function not defined?
Third-party function not defined?
If you’re calling functions like
fbq or gtag,
make sure the corresponding integration (Meta Pixel, GA4) is also enabled, or load the script first.Debugging tips
Debugging tips
Use
console.log() statements
to verify your code is running and inspect variable values in the browser console.Best Practices
- Always test your code on a test form before applying to production
- Use try/catch blocks to prevent errors from breaking your form
- Check if third-party functions exist before calling them
- Keep your code minimal - complex scripts may slow down form loading
- Document your code with comments for future reference



