Documentation
Netlify Connector Setup Guide
The LeadMachine Connector for Netlify connects your Netlify-hosted website to LeadMachine — the static-site counterpart of the WordPress plugin. It works with any framework deployed on Netlify (Astro, Next.js, Hugo, Eleventy, or plain HTML) and gives you three features:
- Lead Capture - Send form submissions to LeadMachine from any form on your site
- Attribution Tracking - Capture Google Ads clicks (
gclid), UTM parameters, and Facebook/Microsoft/LinkedIn/TikTok click IDs, with first-touch memory so the ad click that first brought a visitor is remembered even if they return days later to sign up - Conversion Tracking - Fire your Google Ads conversion (and optionally a GA4
purchaseevent with real revenue) when a visitor completes a form or checkout, gated on a confirmation page so abandoned checkouts are never counted
Your LeadMachine API key stays on the server (in a Netlify environment variable) and never appears in your website's source code.
New to Netlify? Two concepts
- Your site's files live in a Git repository (usually GitHub). Netlify rebuilds and publishes your site whenever that repository changes. "Installing" this connector means adding two small files to that repository.
- Netlify Functions are small pieces of server code that run at
yoursite.com/.netlify/functions/<name>. The connector uses one so your LeadMachine API key stays secret on the server.
If your developer manages the website, hand them this guide and the downloaded connector — steps 1, 3, and 4 are theirs; step 2 (adding your credentials) can be done by anyone with access to the Netlify dashboard.
Prerequisites
- Active LeadMachine account
- A website hosted on Netlify, connected to a Git repository
- Access to the site's Netlify dashboard
- Your LeadMachine Company ID
- Your LeadMachine API Key
Step 1: Get Your Credentials
Both come from the Integrations page in LeadMachine.
Finding Your Company ID
- Log in to your LeadMachine dashboard
- Go to Integrations from the sidebar
- Your Company ID is displayed at the top of the page
Getting Your API Key
- On the Integrations page, find the Netlify card (search "Netlify" or use the Lead Capture filter)
- Click the card to open its settings panel
- Copy the Site API Key shown (if none exists yet, click Generate Key)
Note: This is the same key used by the WordPress plugin. If you already use the WordPress connector, you can reuse the same key — you don't need a separate one.
Step 2: Download the Connector
- On the Integrations page, find the Netlify card and click Connector to download
leadmachine-netlify-connector.zip - Unzip it. Inside you'll find:
functions/lm-lead.mjs — the server function
- public/leadmachine.js — the browser script
- README.md — a copy of these instructions
- netlify.toml.example — only needed for non-standard setupsStep 3: Add the Two Files to Your Site
Copy the files into your website's repository:
| From the download | Into your site repository | |
| ------------------- | --------------------------- | |
functions/lm-lead.mjs | netlify/functions/lm-lead.mjs | |
public/leadmachine.js | public/leadmachine.js (or wherever your static assets live) | |
| Variable name | Value | |
| --------------- | ------- | |
LEADMACHINE_COMPANY_ID | Your Company ID from Step 1 | |
LEADMACHINE_API_KEY | Your Site API Key from Step 1 | |
| Variable name | Value | |
| --------------- | ------- | |
LEADMACHINE_API_URL | https://app.leadmachine.fyi (this is the default) | |
| Form Field | LeadMachine Field | |
| ------------ | ------------------- | |
| First Name / Name | First Name | |
| Last Name | Last Name | |
| Email (primary contact) | ||
| Phone | Phone (contact) | |
| Company | Company Name | |
| Message | Lead Notes | |
| Netlify Connector | WordPress Plugin | |
| -- | ------------------- | ------------------ |
| Best for | Static sites (Astro, Next, Hugo, plain HTML) | WordPress sites |
| Install | Copy two files into your repo | Upload a plugin zip |
| Credentials | Netlify environment variables | Plugin settings screen |
| Lead capture | Yes | Yes |
| Attribution (gclid/UTM) | Yes, with first-touch memory | Yes |
| Conversion & GA4 tracking | Yes | Yes |
| Blog post sync for newsletters | No (WordPress-only feature) | Yes |
Both send to the same LeadMachine account using the same API key. If you run both a WordPress site and a Netlify site, they can share one key.
Getting Help
If you encounter issues:
- Email: [email protected]
- Include your Company ID and the name of your website framework (Astro, Next, etc.)
- Describe the issue and include anything from the Netlify function logs (Logs → Functions → lm-lead)
Last Updated: August 2026