> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datalyr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Lead generation

> Connect campaigns and form submissions to qualified leads, sales outcomes, and revenue.

Use this setup when the first conversion is a form, booked call, application, or demo request, but the real business outcome happens later. The goal is to measure the full path without treating every form submission as equal.

## Define the funnel first

Choose a small set of stages that correspond to actual business decisions. A common model is:

1. `lead_submitted`
2. `call_booked`
3. `lead_qualified`
4. `deal_won`

Use stable names and document what causes each event. Button clicks, form views, and validation errors should not masquerade as completed leads.

## 1. Track acquisition and submission

Install the Web SDK before paid traffic reaches the landing page. Send the lead event only after the form or booking platform confirms success—not when the submit button is clicked.

Include useful, non-sensitive properties such as form name, offer, or location when they help segment performance. Do not place raw personal or sensitive information in ordinary event properties.

## 2. Establish a stable identity

After the form creates a record, identify the visitor with your own durable lead, contact, or account ID. Use the same ID when later stages are reported from your application or backend. If email is used for supported matching, normalize it consistently and follow your consent and privacy requirements.

## 3. Report downstream outcomes

Send qualified-lead and closed-deal events from a trusted backend using the [Node SDK](/sdk-reference/node), or connect a supported revenue source when payment happens through Stripe, Shopify, Whop, or another available integration.

Include a stable event or transaction ID so retries do not create duplicates. For won revenue, include the final value and currency. Do not expose private server credentials in browser code.

## 4. Configure optimization deliberately

Connect the acquisition platforms and begin with the event that has enough volume and accurately represents success. As downstream data becomes reliable, move optimization from raw submissions toward qualified leads or won revenue.

## 5. Verify the complete path

Submit a test lead from a tagged private session, create the corresponding record, advance it through at least one downstream stage, and confirm all events appear on one journey in the correct order.

## Common problems

* **Too many leads:** the event fires on a click instead of confirmed success.
* **Later stages are unattributed:** the backend event lacks the stable ID established at submission.
* **Duplicate closed deals:** retries do not reuse the same event or transaction ID.
* **Ad platforms disagree with Datalyr:** compare the same stage, attribution window, timezone, and date basis.

## You are done when

A test lead can move from campaign click to a confirmed form submission and downstream outcome on one customer journey, and the chosen optimization event reaches the correct ad account.
