CloseTrace
Product

Embed Lead Recovery in HubSpot Landing Pages with CloseTrace

Install CloseTrace on a HubSpot landing page in under 20 minutes and capture half-typed form drafts before the lead cools. Step-by-step.

CloseTrace Team · May 24, 2026 · 5 min read

A HubSpot landing page with a five-field demo form usually loses people at field three. Job title is fine. Company is fine. Then phone number lands and the form stalls. HubSpot's form analytics show a clean submit count, but they don't show the half-filled drafts — the prospect who typed their work email, started on phone, and closed the tab.

If you've been digging into HubSpot's submission stats wondering why "first interactions" outnumber completions by 3-4x, this is usually where the leak is.

This walkthrough adds CloseTrace to a HubSpot landing page and turns on lead recovery — the feature that captures field-level form drafts so you can follow up on the half-typed ones. Setup takes about fifteen minutes if you have admin access.

Where the script goes in HubSpot

You have three places you could drop the snippet:

  1. Site-wide tracking — Settings → Website → Pages → select your domain → Templates → Site header HTML. This loads CloseTrace on every page hosted in HubSpot under that domain.
  2. Single landing page — open the page in the editor → Settings tab → Advanced options → Additional code snippets → Head HTML. Useful when you want to test on one campaign page first.
  3. A theme partial — if you maintain a custom HubL theme, drop it into templates/partials/header.html.

For a first install, use option 2. Pick one landing page you already know loses leads — a paid traffic page, a demo request page, anything with a multi-field form.

The embed snippet

Paste this into the Head HTML box on the page settings:

<script>
  (function (siteId) {
    window.CloseTrace = window.CloseTrace || { q: [] };
    var s = document.createElement('script');
    s.async = true;
    s.src = 'https://cdn.closetrace.com/ct.js';
    s.dataset.site = siteId;
    document.head.appendChild(s);
  })('YOUR_SITE_ID');
</script>

Replace YOUR_SITE_ID with the ID from your CloseTrace workspace (Settings → Sites → copy the ID next to the domain). Save, then publish.

To verify it's running, open the page in an incognito tab, open DevTools → Network, and filter on closetrace. You should see ct.js load (200) and a /c collect call fire within a couple of seconds. If you don't see the collect call, the page is probably loading the snippet inside an iframe — HubSpot does this in the editor preview, so always test against the live URL, not the editor preview.

Turning on form draft capture

CloseTrace auto-detects HubSpot embedded forms because they share a consistent class signature (hs-form on the form element). You don't need to tag individual fields.

In the dashboard:

  1. Go to Lead Recovery → Sources and confirm the site appears with a green "receiving events" pill.
  2. Open Settings → Capture and set "Capture form drafts after" to 2 fields with content. Two is the sweet spot — one is noisy, three loses the people who only get past name and email.
  3. Add the email field as the "identifier" field. The tracker uses this to stitch drafts to the same person across sessions.

For PII, the default config redacts password, credit card, and SSN-pattern inputs. If your HubSpot form includes a custom sensitive field (insurance number, salary band, anything similar), add its name attribute to the redaction list under Settings → Privacy → Redacted fields. The GDPR rundown covers the rest.

The first thing to check after a day of data

Open Lead Recovery → Drafts, filter to the last 24 hours, and sort by "last field typed" descending. The most useful column is field where they stopped.

If 60% of drops sit on the phone field, you have a phone field problem — usually format validation rejecting international numbers, or the field being marked required on a top-of-funnel form that doesn't need it. The phone number field fix post covers the common offenders.

If drops are spread evenly across fields, the form is probably too long for the intent. Pages where visitors land from a "Watch demo" CTA shouldn't carry the same form as a "Talk to sales" CTA.

What this won't catch

Two limitations worth knowing before you sell this to your team.

Draft capture relies on the visitor actually typing into a field. If a HubSpot Smart Form pre-fills a known contact's details, that pre-fill doesn't count as a draft — only net new typing does. So for repeat visitors, your draft volume will look lower than your real abandonment rate.

HubSpot forms loaded inside the conversations chat widget also live in a separate iframe and aren't captured by default. You'd need to embed the form natively on the page for draft recovery to work there.

For the standard embedded form on a landing page, capture is reliable. That covers most paid-acquisition setups.

Wiring drafts into your HubSpot workflow

Drafts are useful inside CloseTrace, but they're more useful inside your CRM. The HubSpot integration writes captured drafts to a contact property (closetrace_last_draft_url) plus a timestamped note on the contact record.

You can then trigger a HubSpot workflow: if closetrace_last_draft_url is known and form_submission is empty after four hours, drop the contact into a recovery email send or a BDR queue. For the email copy itself, the B2B SaaS demo form recovery guide has patterns that don't sound creepy.

Next step

Pick one HubSpot landing page with a known leak — usually the highest-traffic paid-acquisition page — and install the snippet on just that page. Watch the drafts dashboard for 48 hours before deciding whether to roll site-wide. The point isn't to capture everything; it's to figure out which field is killing the form, then go fix it.