DATALYR
Menu
B2B / Lead Gen Setup Guide

Track Leads to Revenue

Last updated: 2026-05-13

Get attribution tracking live in 5 minutes. DATALYR helps you track the full journey from ad click to lead to closed deal, so you know exactly which ads, campaigns, and channels are driving real revenue — not just leads.

Quick start guides: JavaScript / HTML · React / Next.js

Step 1: Create your DATALYR account

  1. Sign up at datalyr.com/signup
  2. Go to Settings → API — copy your API key (starts with dk_)

Step 2: Install the Web SDK

The Web SDK tracks visitors across your landing pages, funnels, and website so we can connect every lead back to the exact ad that brought them in.

  1. HTML: follow the setup guide
  2. React / Next.js: follow the setup guide

Install the SDK on every page in your funnel — landing pages, thank you pages, booking pages, and your main site. This is what lets DATALYR stitch the full journey together.

Step 3: Track lead events

Track key events in your funnel so DATALYR knows when a visitor becomes a lead and when that lead becomes a customer.

Common events to track:

  • Form submission (lead captured)
  • Call booked / appointment scheduled
  • Application submitted
  • Call completed / show rate
  • Proposal sent
  • Deal closed / payment received

Use the SDK’s track() method to fire these events at each stage. The more steps you track, the better you can see where leads drop off and which ad sources produce the best leads.

Step 4: Identify your leads

Call identify()with the lead’s email as soon as you capture it (form submit, booking, etc.). This is how DATALYR connects an anonymous ad click to a real person in your pipeline.

  • Call identify() on form submission, booking confirmation, or any point you capture an email
  • Pass the email at minimum
  • If you have a CRM ID or phone number, pass those too

Step 5: Connect your revenue source

Connect your payment or CRM system to DATALYR so we can track when leads actually close and how much they pay.

  1. Stripe: Go to Sources → Stripe → Connect and authorize your Stripe account. No manual webhooks needed — revenue data flows automatically. Stripe setup reference →
  2. Whop: Go to Sources → Whop in your DATALYR dashboard and copy your webhook URL. Then in Whop, go to your Developer dashboard, click “Create Webhook”, paste your DATALYR webhook URL, and select the events you want to track (payment.succeeded, membership.activated). DATALYR will automatically track purchases, memberships, and renewals. Make sure you capture the lead’s email on your own landing page with identify() before they reach checkout — this is how DATALYR links the Whop payment back to the original ad click.
  3. API / Webhooks: Send events via the DATALYR API — use this if you track deals in a CRM like GoHighLevel, HubSpot, or Close and want to send deal_closed events with revenue values when deals are won.

The key is getting accurate revenue data into DATALYR — however your business collects payment, connect that source.

Step 6: Connect your ad platforms

Connect your ad platforms so DATALYR can match ad spend to revenue and give you accurate ROAS, and we can send conversion events back server-side.

  1. Meta (Facebook / Instagram)
  2. Google Ads
  3. TikTok
  4. Other: reach out at hello@datalyr.com

Step 7: Set up conversion rules

Configure conversion rules to send the right events back to your ad platforms so they can optimize for your highest-value leads — not just form fills, but actual closed deals.

  • Go to Conversions → Add Rule
  • Pick your trigger event (e.g. deal_closed, payment_received), choose your ad platform, and set the conversion value
  • Hit Save — it’s live immediately

Conversion rules reference →

Step 8: Verify it's working

  • Set debug: true in the SDK — you should see events logging in your console
  • Submit a test lead through your funnel
  • Open Live in your dashboard — events should appear within seconds
  • Manually fire a deal_closed event via the API and confirm it shows up

Best practices

  • Optimize your ad platforms for downstream events, not just leads. Sending deal_closed or payment_receivedas your primary conversion gives ad platforms much better signal than optimizing for form fills. This is the biggest advantage of using DATALYR — you’re feeding real revenue data back to the algorithms.
  • Track every stage of your pipeline through the SDK or API: lead captured, call booked, call completed, proposal sent, deal closed. This lets you see exactly where each ad source’s leads fall off.
  • Always call identify() the moment you capture an email — this is the single most important thing for accurate attribution in lead gen.
  • If you have a long sales cycle, use the API to send deal events when they close (days or weeks later). DATALYR will still attribute the revenue back to the original ad click.
  • Don’t count leads as revenue. A form fill is not a sale. Track actual payments and closed deals as your revenue events — this is the only way to get real ROAS.

Why this matters for lead gen

The problem with most ad tracking for lead gen businesses:

  • Ad platform says you got 50 leads at $20 each — looks great
  • But only 10 of those leads showed up to a call
  • Only 3 closed, and 2 of those came from one campaign
  • The campaign that “looked expensive” per lead actually produced all your revenue

DATALYR fixes this by tracking the full journey from click to closed deal. You stop optimizing for cheap leads and start optimizing for actual revenue. Your ad platforms get better signal, your targeting improves, and your cost per acquisition drops — because you’re measuring what actually matters.