Leadtosale

Custom trackers

  • Custom trackers let you send leads to Leadtosale from any event source, either from your website using JavaScript or from your own server.
  • Use when form trackers or call trackers don’t fit your use case (e.g., AJAX submissions, button clicks, chat widgets).
  • Leads sent from your website have full attribution added automatically.

Creating a custom tracker

  • Navigate to the ‘Trackers’ section of your container using the top menu.
  • Click “Create” on the Custom Tracker card.
  • Create a new custom tracker
  • After saving, click “Instructions” on the tracker to see the code for your tracker, including its ID and API key.
  • Custom tracker instructions

Configuration options

Tracker name - A name to identify this tracker. Used to segment leads.

Status - Active or disabled.

Require email address - Submissions without an email address are treated as invalid leads.

Notify users on submission - Send email notifications to selected users when new leads arrive.

Integrations - Send a new lead event to GA4 and/or send new leads to the Meta Conversions API on each submission.

Sending leads from your website

Call document.createLead() with the data you want to capture and your tracker’s ID (shown in the tracker’s instructions):

document.createLead({
    email: "user@example.com",
    phone: "+1234567890",
    name: "John Smith",
    // Add any custom fields
    custom_field: "custom value"
}, 1);
  • createLead() can be called anywhere on your page after the container snippet loads.
  • Pass an object with any fields you want to capture.

Sending leads from your server

Use your tracker’s API key (shown in the tracker’s instructions) to post leads as JSON:

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 your API key secret. Don’t use it in code that runs in the browser.
  • To attribute server-side leads, include fields like gclid, utm_source, utm_medium, utm_campaign, ga_cookie or fbc_cookie in the JSON body. They’re saved as attribution data rather than lead details.

Data captured

For leads sent from your website, the following are captured in addition to your custom fields:

  • Google Analytics cookies (GA and GA4)
  • Facebook tracking cookies (fbc, fbp)
  • UTM parameters (source, medium, campaign, term, content)
  • Google Click IDs (gclid, dclid)
  • Referrer URL
  • Device and browser information
  • IP address and geolocation

Common use cases

  • Chat widgets - Capture leads when a chat conversation completes.
  • Forms not supported by the form tracker - Track submissions from forms that don’t dispatch a ‘submit’ event.
  • CRM or backend events - Send leads from your server when they’re created in another system.

Testing

  • Call document.createLead() from your browser console with test data and your tracker ID.
  • Verify the lead appears in your dashboard with all expected fields.
  • Check that attribution data is correctly captured.
Custom trackers let you send leads to Leadtosale from any event source, either from your website using JavaScript or from your own server. Use when form trackers or call trackers don&rsquo;t fit your use case (e.g., AJAX submissions, button clicks, chat widgets). Leads sent from your website have full attribution added automatically. Creating a custom tracker Navigate to the &lsquo;Trackers&rsquo; section of your container using the top menu. Click &ldquo;Create&rdquo; on the Custom Tracker card. After saving, click &ldquo;Instructions&rdquo; on the tracker to see the code for your tracker, including its ID and API key. Configuration options Tracker name - A name to identify this tracker. Used to segment leads. Status - Active or disabled. Require email address - Submissions without an email address are treated as invalid leads. Notify users on submission - Send email notifications to selected users when new leads arrive. Integrations - Send a new lead event to GA4 and/or send new leads to the Meta Conversions API on each submission. Sending leads from your website Call document.createLead() with the data you want to capture and your tracker&rsquo;s ID (shown in the tracker&rsquo;s instructions): document.createLead({ email: &#34;user@example.com&#34;, phone: &#34;+1234567890&#34;, name: &#34;John Smith&#34;, // Add any custom fields custom_field: &#34;custom value&#34; }, 1); createLead() can be called anywhere on your page after the container snippet loads. Pass an object with any fields you want to capture. Sending leads from your server Use your tracker&rsquo;s API key (shown in the tracker&rsquo;s instructions) to post leads as JSON: curl -X POST https://api.leadto.sale/submit_json/&lt;tracker_id&gt; \ -H &#34;Authorization: Key &lt;api_key&gt;&#34; \ -H &#34;Content-Type: application/json&#34; \ -d &#39;{&#34;email&#34;: &#34;user@example.com&#34;, &#34;name&#34;: &#34;John Smith&#34;}&#39; Keep your API key secret. Don&rsquo;t use it in code that runs in the browser. To attribute server-side leads, include fields like gclid, utm_source, utm_medium, utm_campaign, ga_cookie or fbc_cookie in the JSON body. They&rsquo;re saved as attribution data rather than lead details. Data captured For leads sent from your website, the following are captured in addition to your custom fields: Google Analytics cookies (GA and GA4) Facebook tracking cookies (fbc, fbp) UTM parameters (source, medium, campaign, term, content) Google Click IDs (gclid, dclid) Referrer URL Device and browser information IP address and geolocation Common use cases Chat widgets - Capture leads when a chat conversation completes. Forms not supported by the form tracker - Track submissions from forms that don&rsquo;t dispatch a &lsquo;submit&rsquo; event. CRM or backend events - Send leads from your server when they&rsquo;re created in another system. Testing Call document.createLead() from your browser console with test data and your tracker ID. Verify the lead appears in your dashboard with all expected fields. Check that attribution data is correctly captured.