Capturing Website Forms with the JavaScript SDK
Install one snippet on your site so LeadToSheet can capture submitted forms automatically.
When to use the SDK
The JavaScript SDK is the default source for websites you control. It watches form submissions in the browser, captures the submitted field values, and sends the lead into the same pipeline as every other LeadToSheet source.
- Use it for contact forms, quote forms, newsletter forms, and other forms rendered directly on your site.
- It captures page URL, referrer, UTM parameters, ad click IDs, browser data, and timezone when those values are available.
- Captured leads can still be routed to Google Sheets, CRMs, alerts, auto-replies, and custom webhooks.
Important
If a form lives inside a third-party cross-origin iframe, the SDK cannot read its fields directly. Use a native source, a provider webhook, or a controlled postMessage bridge for those forms.
Set it up
- 1
Open Sources
In LeadToSheet, open the site you want to capture from, then choose Sources in the sidebar.
- 2
Open JavaScript SDK
Click the JavaScript SDK tile and copy the snippet shown for that site.
- 3
Paste it on your website
Add the snippet inside the <head> section of your site's HTML (or through your tag manager) so it loads on every page with forms. Placing it in <head> ensures it's ready before any form on the page is submitted — the script tag is async, so it won't block page rendering.
- 4
Submit a test lead
Submit one of your forms, then check the Leads page and connected Google Sheet for the new row.
Tip
Install the snippet once at the layout/theme level where possible. The SDK can capture multiple forms on the same page and keeps each form separated in LeadToSheet.
