Keep the API key secret. Don’t use it in code that runs in the browser.
To attribute leads sent from your server, include fields such as gclid, utm_source, utm_medium, utm_campaign, ga_cookie or fbc_cookie. They’re saved as attribution data, not lead details.
Forms the form tracker can’t see: track forms that don’t fire a submit event.
CRM or backend events: send leads from your server when they’re created in another system.
Testing
Call document.createLead() in your browser console with test data and your tracker ID.
Check the lead appears in Leadtosale with the fields and attribution data you expect.
Custom trackers let you send leads to Leadtosale from your website with JavaScript, or from your own server. Use one when a form or call tracker doesn’t fit, such as for AJAX forms, button clicks or chat widgets. Leads sent from your website get attribution data added automatically. Creating a custom tracker Open Trackers in your container’s top menu. Click “Create” on the Custom Tracker card. After saving, click “Instructions” on the tracker to see its code, ID and API key. Settings Tracker name: a name for this tracker, used to group its leads.
Status: active or disabled.
Require email address: submissions without an email address are saved as invalid leads.
Notify users on submission: email the selected users about each new lead.
Integrations: send a new lead event to GA4, or new leads to the Meta Conversions API, for each submission.
Sending leads from your website Call document.createLead() with the lead’s details and your tracker’s ID (shown in the tracker’s instructions):
document.createLead({ email: "user@example.com", phone: "+1234567890", name: "John Smith", // Add any other fields custom_field: "custom value" }, 1); Call createLead() anywhere on the page once the container snippet has loaded. Include any fields you want to save. Sending leads from your server Post leads as JSON with your tracker’s API key (shown in the tracker’s instructions):
curl -X POST https://api.leadto.sale/submit_json/<tracker_id> \ -H "Authorization: Key <api_key>" \ -H "Content-Type: application/json" \ -d '{"email": "user@example.com", "name": "John Smith"}' Keep the API key secret. Don’t use it in code that runs in the browser. To attribute leads sent from your server, include fields such as gclid, utm_source, utm_medium, utm_campaign, ga_cookie or fbc_cookie. They’re saved as attribution data, not lead details. Data captured Leads sent from your website also capture:
Google Analytics cookies (GA and GA4) Facebook cookies (fbc, fbp) UTM parameters (source, medium, campaign, term, content) Google click IDs (gclid, dclid) Referrer URL Device and browser IP address and location Common uses Chat widgets: capture a lead when a chat ends. Forms the form tracker can’t see: track forms that don’t fire a submit event. CRM or backend events: send leads from your server when they’re created in another system. Testing Call document.createLead() in your browser console with test data and your tracker ID. Check the lead appears in Leadtosale with the fields and attribution data you expect.