CloseTrace
Product

Embed Lead Recovery in HubSpot Landing Pages with CloseTrace

Install CloseTrace on a HubSpot landing page, track partial form journeys, and review eligible drafts in Lead Recovery. Step-by-step.

CloseTrace Team · May 24, 2026 · 5 min read

Embed Lead Recovery in HubSpot Landing Pages with CloseTrace editorial illustration

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 verifies lead recovery. Field-level behavior is captured for eligible same-document forms, while supported values appear only when the active workspace policy permits them. 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 async src="https://api.closetrace.com/t.js?k=ct_pk_YOUR_PUBLIC_KEY"></script>

Replace ct_pk_YOUR_PUBLIC_KEY with the public key from CloseTrace → Settings → Setup, or copy the full server-generated snippet from that screen. 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 t.js load (200) and a /collect call fire within a few seconds. If you don't see collection, verify the k=ct_pk_... value and test the live URL rather than HubSpot's editor preview.

Turning on form draft capture

CloseTrace detects ordinary same-document forms automatically from their fields and submit controls. Give the HubSpot form a stable ID/name where the embed permits it, then type into the live form and confirm the draft in Lead Recovery. Forms rendered inside a cross-origin iframe are outside the host page's DOM and cannot be captured by this snippet.

Replay applies the active workspace privacy policy before upload. Password, payment, authentication, SSN, date-of-birth, bank-account, and similarly named fields are permanently excluded from Lead Recovery. Add data-private to any custom field or container that must never enter replay or form drafts. The GDPR rundown covers the broader consent and notice requirements.

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.

Using drafts with your HubSpot workflow

The current release does not write a closetrace_last_draft_url property or create HubSpot workflow records automatically. Review qualified drafts in CloseTrace and move them into your existing CRM process only when you have a lawful basis to follow up. 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.