Per-screen custom code lets you add JavaScript to individual screens using a Raw HTML element and the Fox API. Use it to read user answers, store computed values, and control navigation.Documentation Index
Fetch the complete documentation index at: https://funnelfox.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
How it works
Your custom JavaScript lives inside a Raw HTML element on a screen. To add code that applies to every screen at once, use funnel-wide custom code instead. The code runs immediately when the screen loads — and again every time the user navigates back to that screen. The Fox API (fox) is available globally from the moment the screen opens, no setup needed.
Inputs are a persistent key/value store shared across all screens. When a user picks an option or fills a field, FunnelFox saves that answer to fox.inputs under the element’s ID. You can read those values, compute new ones, and write them back — they’ll be available on every screen.
Input values are always strings. Use
parseInt(), parseFloat(), or Number() to convert them before doing math.fox.inputs.set() persist across screens. Regular JavaScript variables (const, let) are reset every time the screen reloads.
Quickstart
Add a Raw HTML element
Add a Raw HTML element to the screen where you want your code to run.
Use Fox API
Inside the HTML content editor, add a
<script> tag and use the Fox API. See the Fox API reference below for all available methods.Use cases
Capture email from URL
When a user lands from an email campaign or app notification, read their email from the URL and bind it to their FunnelFox profile. This sets it as a user property forwarded to connected integrations like Stripe and Amplitude, so purchases are attributed correctly.Calculate values from user input
Read user answers, run calculations, and store the result as a new variable. You can then use that variable anywhere in your funnel with{{variable-name}}, or use it to route users to different screens.
Custom backend integration
Intercept a button click to call your own API before navigating. Store the response infox.inputs so it’s available on later screens, or block navigation and show an error if the request fails.
Dynamic navigation logic
Route users to different screens based on multiple conditions evaluated at once. Useful when a single answer isn’t enough to decide the next step.Third-party tracking
Fire custom events to your analytics tools and ad pixels from any screen. Usefox.inputs.getAll() to include all collected answers in the payload.
Fox API reference
Properties
true in preview mode, false in production. Use to run test-only logic.The user’s browser language code (e.g.,
"en-US").Inputs
Read and write the key/value store shared across all screens.Get a value
Set a value
Get all values
Set email
setEmail() saves the email to the user’s profile, not just as a regular input. Use this for primary email collection.Get email
Subscribe to a specific input
Subscribe to all inputs
Navigation
Control which screen the user sees next.Go to next screen
Go to previous screen
Go to screen by ID
Go to screen by index
Tracking
Send custom events to connected analytics tools.Track a custom event
Stripe
Force a Stripe Checkout session to use a specific customer. If the customer ID does not exist, the Checkout session will not appear.Set customer ID
Event listeners
React to funnel lifecycle events.On restore replies
Next steps
- Learn how to add the Raw HTML element
- Add funnel-wide custom code that applies to every screen
