The order of setup steps that connects a form submission to a qualified lead and a won deal.
Pick this if you sell through a form and a sales team, and the deal closes weeks after
the click.When you finish, you can see which campaign produced a lead, which produced a qualified
lead, and which produced revenue.
Before you start
Decide the stages you will report. Four is a good default.
Decide the durable ID your CRM uses for a lead.
Have server access for the downstream stages.
Name the stages first
Stage
Event name
Fires when
1
lead_submitted
Your form platform confirms the submission
2
call_booked
The booking platform confirms the slot
3
lead_qualified
A human or a rule marks the lead qualified
4
deal_won
The deal closes
Never fire lead_submitted on the submit-button click. A click fires on validation
errors, double-clicks, and abandoned forms. Your ad platform then optimizes toward
people who fail your form.
The path
Step
Do this
Page
1
Install web tracking before paid traffic reaches the landing page
Stage 1 runs in the browser. Stages 3 and 4 run on your server, hours or weeks later, so
the join only works if the same ID reaches both places.
Store the visitor_id on the CRM record at stage 1.
Read datalyr.getVisitorId() in the browser and send it with the form.
Pass that visitor_id on every later server event.
Send a stable order_id or event ID on stage 4, so a retry does not create a second won
deal.
Choose the optimization event
Start with the stage that has enough weekly volume for the ad platform to learn from, and
move deeper down the funnel as your downstream data proves out.
Weekly volume of the stage
Optimize toward
Under 50
lead_submitted
50 or more
lead_qualified
Enough won deals to be stable
deal_won, with the deal value
Verify
Open the landing page in a private window with ?utm_source=leadtest.
Submit the form with a test email address.
Open Events and confirm lead_submitted with utm_source=leadtest.
Advance the record to qualified in your CRM.
Send lead_qualified from your server with the same visitor_id.
Open Users and confirm both events sit on one profile.
When it doesn’t work
Symptom
Cause
Fix
Far more leads than your CRM has
The event fires on the click, not on success.
Move the call into the success callback.
Stage 3 and 4 sit on their own profiles
The server event carries no visitor_id.
Store it at stage 1 and pass it every time.
Won deals appear twice
A retry sent a new event ID.
Reuse one stable ID per deal.
The ad platform disagrees with DATALYR
Different attribution windows and timezones.
Compare the same stage, window, and timezone.
No campaign on any lead
The landing page loads the SDK after the redirect strips the parameters.
Install the snippet in <head> on the first page.
Next
Custom events: the properties a conversion rule reads.
Node SDK: send the downstream stages from your server.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"DATALYR Docs","description":"Simple guides for setting up and using DATALYR.","colors":{"primary":"#FC6600","light":"#FC6600","dark":"#FC6600"},"logo":{"light":"https://mintcdn.com/datalyr/ROJj0wlntTvU8OM_/light.svg?fit=max\u0026auto=format\u0026n=ROJj0wlntTvU8OM_\u0026q=85\u0026s=29f98b487b8f65c3bd267065db18b4b9","dark":"https://mintcdn.com/datalyr/xt7Bk8U79eZ1GtVp/dark.svg?fit=max\u0026auto=format\u0026n=xt7Bk8U79eZ1GtVp\u0026q=85\u0026s=43fe8f8da4b4e1658fe86bbeef08ff59"},"favicon":"https://mintcdn.com/datalyr/ROJj0wlntTvU8OM_/fav.png?fit=max\u0026auto=format\u0026n=ROJj0wlntTvU8OM_\u0026q=85\u0026s=f5026bdd46f056f274b9f4b111ee8f5b","appearance":{"default":"dark","strict":false},"navbar":{"links":[{"href":"https://datalyr.com","label":"Open DATALYR"}],"primary":{"type":"button","label":"Get started","href":"https://datalyr.com/signup"}},"fonts":{"family":"Inter"},"styling":{"eyebrows":"section","latex":false},"contextual":{"options":["copy","chatgpt","claude","add-mcp","cursor","vscode"],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"datalyr","hasAudioNarration":false,"actualSubdomain":"datalyr","customDomains":["docs.datalyr.com"],"gitSource":{"type":"github","owner":"datalyr","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{},"buildId":"6b0378760d7e8ddc2639c008","clientVersion":"0.0.4304","searchFilterCounts":[{"language":"default","tag":"API \u0026 MCP","count":92},{"language":"default","tag":"Getting Started","count":77},{"language":"default","tag":"Agent ads","count":15},{"language":"default","tag":"Advanced","count":14},{"language":"default","tag":"Dashboards, analyses and share links","count":14},{"language":"default","tag":"Using DATALYR","count":13},{"language":"default","tag":"Integrations","count":12},{"language":"default","tag":"Revenue","count":11},{"language":"default","tag":"SDK Reference","count":10},{"language":"default","tag":"Account \u0026 billing","count":8}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"custom.css","content":":root{--datalyr-bg: #ffffff;--datalyr-surface: #fafafa;--datalyr-surface-hover: #f5f5f5;--datalyr-border: #e7e7e7;--datalyr-text: #171717;--datalyr-muted: #666666;--datalyr-orange: #fc6600}.dark,[data-theme=\"dark\"]{--datalyr-bg: #141414;--datalyr-surface: #181818;--datalyr-surface-hover: #1d1d1d;--datalyr-border: #303030;--datalyr-text: #ededed;--datalyr-muted: #a8a8a8}html,body{background:var(--datalyr-bg)!important}body{color:var(--datalyr-text);font-feature-settings:\"cv02\", \"cv03\", \"cv04\", \"cv11\";letter-spacing:-0.006em}#navbar,#navbar-transition{background:color-mix(in srgb, var(--datalyr-bg) 94%, transparent)!important;border-color:var(--datalyr-border)!important;backdrop-filter:blur(16px)}#navbar a,#navbar button{letter-spacing:-0.01em}html body nav#sidebar{background:transparent!important;border-color:var(--datalyr-border)!important}#sidebar-content>div>div.sticky.top-0{background:transparent!important}#sidebar a,#sidebar button{border-radius:6px!important;font-size:14px;font-weight:400!important}#sidebar a:hover,#sidebar button:hover{background:var(--datalyr-surface-hover)!important}#sidebar a[aria-current=\"page\"]{background:transparent!important;box-shadow:none;border-radius:6px!important;color:var(--datalyr-orange)!important;font-weight:500!important}#sidebar a[aria-current=\"page\"]:hover{background:var(--datalyr-surface-hover)!important}#sidebar .sidebar-group{border-left:1px solid var(--datalyr-border);margin-left:4px;padding-left:8px}main{color:var(--datalyr-text)}main h1,main h2,main h3,main h4{color:var(--datalyr-text)!important;letter-spacing:-0.035em;font-weight:650}main h1{font-size:clamp(1.875rem, 3vw, 2rem)!important;line-height:1.16!important}main h2{font-size:1.5rem!important;line-height:1.25!important}main h3{font-size:1.125rem!important;line-height:1.35!important}main p,main li,main td{color:var(--datalyr-muted)!important;font-size:15.5px;line-height:1.72}main strong{color:var(--datalyr-text);font-weight:600}main a{text-underline-offset:3px}main a[class*=\"card\"],main [class*=\"Card\"]{background:var(--datalyr-surface)!important;border-color:var(--datalyr-border)!important;border-radius:10px!important;box-shadow:none!important;transition:background-color 140ms ease, border-color 140ms ease,\n transform 140ms ease}main a[class*=\"card\"]:hover{background:var(--datalyr-surface-hover)!important;border-color:#3a3a3a!important;transform:translateY(-1px)}main a[class*=\"card\"] h2,main [class*=\"Card\"] h2{font-size:1rem!important;line-height:1.35!important;letter-spacing:-0.015em}main [data-component-part=\"card-icon\"] svg{background:var(--datalyr-muted)!important;color:var(--datalyr-muted)!important}pre,code{border-radius:8px!important}aside[aria-label=\"Table of Contents\"],.toc,[class*=\"TableOfContents\"],nav[aria-labelledby=\"toc-heading\"]{position:sticky!important;top:88px!important;max-height:calc(100vh - 110px)!important;overflow-y:auto!important}@media (max-width: 768px){main h1{font-size:1.875rem!important}}"}]}
{"page":{"pagePath":"use-cases/lead-generation","slug":"/use-cases/lead-generation","pageMetadata":{"title":"Lead generation","description":"The order of setup steps that connects a form submission to a qualified lead and a won deal.","href":"/use-cases/lead-generation"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"The order of setup steps that connects a form submission to a qualified lead and a won deal.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Heading,Table,Warning}=_components;if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Pick this if you sell through a form and a sales team, and the deal closes weeks after\nthe click.`}),`\n`,_jsx(_components.p,{children:`When you finish, you can see which campaign produced a lead, which produced a qualified\nlead, and which produced revenue.`}),`\n`,_jsx(Heading,{level:`2`,id:`before-you-start`,children:`Before you start`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Decide the stages you will report. Four is a good default.`}),`\n`,_jsx(_components.li,{children:`Decide the durable ID your CRM uses for a lead.`}),`\n`,_jsx(_components.li,{children:`Have server access for the downstream stages.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`name-the-stages-first`,children:`Name the stages first`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Stage`}),_jsx(_components.th,{children:`Event name`}),_jsx(_components.th,{children:`Fires when`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`lead_submitted`})}),_jsx(_components.td,{children:`Your form platform confirms the submission`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`call_booked`})}),_jsx(_components.td,{children:`The booking platform confirms the slot`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`3`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`lead_qualified`})}),_jsx(_components.td,{children:`A human or a rule marks the lead qualified`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`4`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`deal_won`})}),_jsx(_components.td,{children:`The deal closes`})]})]})]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Never fire `,_jsx(_components.code,{children:`lead_submitted`}),` on the submit-button click. A click fires on validation\nerrors, double-clicks, and abandoned forms. Your ad platform then optimizes toward\npeople who fail your form.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`the-path`,children:`The path`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Step`}),_jsx(_components.th,{children:`Do this`}),_jsx(_components.th,{children:`Page`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`1`}),_jsx(_components.td,{children:`Install web tracking before paid traffic reaches the landing page`}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/getting-started/install-web-tracking`,children:`Install web tracking`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`2`}),_jsxs(_components.td,{children:[`Send `,_jsx(_components.code,{children:`lead_submitted`}),` from the form platform’s success callback`]}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/advanced/custom-events`,children:`Custom events`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`3`}),_jsxs(_components.td,{children:[`Call `,_jsx(_components.code,{children:`identify()`}),` with the CRM record ID`]}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/advanced/identity`,children:`Identity`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`4`}),_jsx(_components.td,{children:`Send stages 3 and 4 from your server`}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/sdk-reference/node`,children:`Node SDK`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{\"data-numeric\":`true`,children:`5`}),_jsx(_components.td,{children:`Create one conversion rule for the stage you optimize toward`}),_jsx(_components.td,{children:_jsx(_components.a,{href:`/advanced/conversion-delivery`,children:`Conversion delivery`})})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`carry-the-id-downstream`,children:`Carry the ID downstream`}),`\n`,_jsx(_components.p,{children:`Stage 1 runs in the browser. Stages 3 and 4 run on your server, hours or weeks later, so\nthe join only works if the same ID reaches both places.`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Store the `,_jsx(_components.code,{children:`visitor_id`}),` on the CRM record at stage 1.`]}),`\n`,_jsxs(_components.li,{children:[`Read `,_jsx(_components.code,{children:`datalyr.getVisitorId()`}),` in the browser and send it with the form.`]}),`\n`,_jsxs(_components.li,{children:[`Pass that `,_jsx(_components.code,{children:`visitor_id`}),` on every later server event.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Send a stable `,_jsx(_components.code,{children:`order_id`}),` or event ID on stage 4, so a retry does not create a second won\ndeal.`]}),`\n`,_jsx(Heading,{level:`2`,id:`choose-the-optimization-event`,children:`Choose the optimization event`}),`\n`,_jsx(_components.p,{children:`Start with the stage that has enough weekly volume for the ad platform to learn from, and\nmove deeper down the funnel as your downstream data proves out.`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Weekly volume of the stage`}),_jsx(_components.th,{children:`Optimize toward`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Under 50`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`lead_submitted`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`50 or more`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`lead_qualified`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Enough won deals to be stable`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`deal_won`}),`, with the deal value`]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`verify`,children:`Verify`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Open the landing page in a private window with `,_jsx(_components.code,{children:`?utm_source=leadtest`}),`.`]}),`\n`,_jsx(_components.li,{children:`Submit the form with a test email address.`}),`\n`,_jsxs(_components.li,{children:[`Open `,_jsx(_components.strong,{children:`Events`}),` and confirm `,_jsx(_components.code,{children:`lead_submitted`}),` with `,_jsx(_components.code,{children:`utm_source=leadtest`}),`.`]}),`\n`,_jsx(_components.li,{children:`Advance the record to qualified in your CRM.`}),`\n`,_jsxs(_components.li,{children:[`Send `,_jsx(_components.code,{children:`lead_qualified`}),` from your server with the same `,_jsx(_components.code,{children:`visitor_id`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Open `,_jsx(_components.strong,{children:`Users`}),` and confirm both events sit on one profile.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`when-it-doesn’t-work`,children:`When it doesn’t work`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Symptom`}),_jsx(_components.th,{children:`Cause`}),_jsx(_components.th,{children:`Fix`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Far more leads than your CRM has`}),_jsx(_components.td,{children:`The event fires on the click, not on success.`}),_jsx(_components.td,{children:`Move the call into the success callback.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Stage 3 and 4 sit on their own profiles`}),_jsxs(_components.td,{children:[`The server event carries no `,_jsx(_components.code,{children:`visitor_id`}),`.`]}),_jsx(_components.td,{children:`Store it at stage 1 and pass it every time.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Won deals appear twice`}),_jsx(_components.td,{children:`A retry sent a new event ID.`}),_jsx(_components.td,{children:`Reuse one stable ID per deal.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`The ad platform disagrees with DATALYR`}),_jsx(_components.td,{children:`Different attribution windows and timezones.`}),_jsx(_components.td,{children:`Compare the same stage, window, and timezone.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`No campaign on any lead`}),_jsx(_components.td,{children:`The landing page loads the SDK after the redirect strips the parameters.`}),_jsxs(_components.td,{children:[`Install the snippet in `,_jsx(_components.code,{children:`\u003chead>`}),` on the first page.`]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`next`,children:`Next`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/advanced/custom-events`,children:`Custom events`}),`: the properties a conversion rule reads.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/sdk-reference/node`,children:`Node SDK`}),`: send the downstream stages from your server.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/advanced/identity`,children:`Identity`}),`: join the browser and the server events.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Lead generation","description":"The order of setup steps that connects a form submission to a qualified lead and a won deal.","href":"/use-cases/lead-generation"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Before you start","slug":"before-you-start","depth":2,"children":[]},{"title":"Name the stages first","slug":"name-the-stages-first","depth":2,"children":[]},{"title":"The path","slug":"the-path","depth":2,"children":[]},{"title":"Carry the ID downstream","slug":"carry-the-id-downstream","depth":2,"children":[]},{"title":"Choose the optimization event","slug":"choose-the-optimization-event","depth":2,"children":[]},{"title":"Verify","slug":"verify","depth":2,"children":[]},{"title":"When it doesn’t work","slug":"when-it-doesn’t-work","depth":2,"children":[]},{"title":"Next","slug":"next","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"datalyr","siteName":"DATALYR Docs","title":"Lead generation - DATALYR Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-13T16:07:53.133Z","originalFileLocation":"use-cases/lead-generation.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"The order of setup steps that connects a form submission to a qualified lead and a won deal.\">\u003cmeta data-mint-head name=\"application-name\" content=\"DATALYR Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/datalyr/OtXrSaasPyqjg3q6/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/datalyr/OtXrSaasPyqjg3q6/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/datalyr/OtXrSaasPyqjg3q6/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/datalyr/OtXrSaasPyqjg3q6/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/datalyr/OtXrSaasPyqjg3q6/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/datalyr/OtXrSaasPyqjg3q6/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/datalyr/OtXrSaasPyqjg3q6/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/datalyr/OtXrSaasPyqjg3q6/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/datalyr/OtXrSaasPyqjg3q6/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Lead generation - DATALYR Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"The order of setup steps that connects a form submission to a qualified lead and a won deal.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"DATALYR Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.datalyr.com/use-cases/lead-generation\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://datalyr.mintlify.site/_mintlify/api/og/v2?division=Lead+generation\u0026amp;title=Lead+generation\u0026amp;description=The+order+of+setup+steps+that+connects+a+form+submission+to+a+qualified+lead+and+a+won+deal.\u0026amp;theme=cfd8a5cf5a95aa7efc3c16b4\u0026amp;signature=77c904a4ee0485699f1ccf177b9febcda296b99882a5fe6c0a4115f5d6e36f7c\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Lead generation - DATALYR Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"The order of setup steps that connects a form submission to a qualified lead and a won deal.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://datalyr.mintlify.site/_mintlify/api/og/v2?division=Lead+generation\u0026amp;title=Lead+generation\u0026amp;description=The+order+of+setup+steps+that+connects+a+form+submission+to+a+qualified+lead+and+a+won+deal.\u0026amp;theme=cfd8a5cf5a95aa7efc3c16b4\u0026amp;signature=77c904a4ee0485699f1ccf177b9febcda296b99882a5fe6c0a4115f5d6e36f7c\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/datalyr/OtXrSaasPyqjg3q6/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"DATALYR Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#FC6600\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.datalyr.com/use-cases/lead-generation\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/use-cases/lead-generation.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.datalyr.com/#organization\",\"name\":\"DATALYR Docs\",\"url\":\"https://docs.datalyr.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/datalyr/ROJj0wlntTvU8OM_/light.svg?fit=max\u0026auto=format\u0026n=ROJj0wlntTvU8OM_\u0026q=85\u0026s=29f98b487b8f65c3bd267065db18b4b9\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.datalyr.com#website\",\"name\":\"DATALYR Docs\",\"url\":\"https://docs.datalyr.com\",\"publisher\":{\"@id\":\"https://docs.datalyr.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.datalyr.com/use-cases/lead-generation#webpage\",\"url\":\"https://docs.datalyr.com/use-cases/lead-generation\",\"name\":\"Lead generation\",\"description\":\"The order of setup steps that connects a form submission to a qualified lead and a won deal.\",\"dateModified\":\"2026-11-13T16:07:53.133Z\",\"isPartOf\":{\"@id\":\"https://docs.datalyr.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.datalyr.com/use-cases/lead-generation#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.datalyr.com/use-cases/lead-generation#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"DATALYR Docs\",\"item\":\"https://docs.datalyr.com\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lead generation\",\"item\":\"https://docs.datalyr.com/use-cases/lead-generation\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.datalyr.com/use-cases/lead-generation#article\",\"headline\":\"Lead generation\",\"name\":\"Lead generation\",\"description\":\"The order of setup steps that connects a form submission to a qualified lead and a won deal.\",\"url\":\"https://docs.datalyr.com/use-cases/lead-generation\",\"mainEntityOfPage\":{\"@id\":\"https://docs.datalyr.com/use-cases/lead-generation#webpage\"},\"dateModified\":\"2026-11-13T16:07:53.133Z\",\"publisher\":{\"@id\":\"https://docs.datalyr.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.datalyr.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"DATALYR Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"DATALYR Docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/use-cases/lead-generation.md","siteName":"DATALYR Docs","nav":{"global":null,"tabs":[{"tab":"Getting Started","pages":[{"title":"Getting Started","href":""}]},{"tab":"Use cases","groups":[{"group":"Ecommerce","pages":[{"title":"Shopify","href":"/use-cases/shopify"},{"title":"Checkout funnels","href":"/use-cases/checkout-funnels"}]},{"group":"SaaS","pages":[{"title":"SaaS with Stripe","href":"/use-cases/stripe"}]},{"group":"Mobile","pages":[{"title":"Mobile apps","href":"/use-cases/mobile"}]},{"group":"Health \u0026 wellness","pages":[{"title":"Health and wellness","href":"/use-cases/health-wellness"}]},{"group":"Creators","pages":[{"title":"Creators with Whop","description":"Connect a tracked landing page to Whop payments, memberships, refunds, and campaign attribution.","href":"/use-cases/creators-whop"}]},{"group":"Lead generation","pages":[{"title":"Lead generation","href":"/use-cases/lead-generation"}]}]},{"tab":"API \u0026 MCP","pages":[{"title":"API \u0026 MCP","href":"/api-reference/agents"}]},{"tab":"SDK Reference","pages":[{"title":"SDK Reference","href":"/sdk-reference"}]}]},"basePath":"","title":"Lead generation - DATALYR Docs","deploymentId":"dpl_57NA6NKtrcUBhuxv6Tm2hAi21TK4","buildId":"dpl_57NA6NKtrcUBhuxv6Tm2hAi21TK4","dynamics":[],"chunks":[]}