Cross-Domain Tracking for Funnels, Iframes and Checkouts: Don't Lose a Single Lead
Why leads from Heyflow, Perspective, Typeform, ClickFunnels, Calendly or Digistore24 lose their source, and how to pass the session across domains, iframes and checkouts.
Contents
- Why leads lose their source when switching domains
- The principle: hand over an identifier
- Connecting several of your own domains
- Funnel builders with custom code: Heyflow and Perspective
- Tools without custom code: Typeform and Calendly
- Checkout pages: Digistore24 and CopeCart
- Custom widgets and special cases
- How to test your setup
- Common mistakes
- How LeadMetrics helps
The Meta ad is running, the landing page converts, and still your CRM fills up with leads that have no source, checkout sales show up as "direct" and booked calls don't appear in any report. The reason is almost always the same: somewhere along the way the visitor switches domains, and the tracking loses them.
This guide is for performance marketers, agencies and coaches running funnel setups. By the end you'll know why funnel builders, iframes and checkout pages break tracking, which ways there are to hand over the session, and how to connect Heyflow, Perspective, Typeform, ClickFunnels, Calendly, Digistore24 and CopeCart in practice.
Why leads lose their source when switching domains
Almost all website tracking is client-side tracking: a script in the browser reads UTM parameters and click IDs on the first page view and stores them in first-party cookies. That works as long as the visitor stays on the same domain. A typical lead funnel, though, looks like this:
- Click on the ad, landing page on
your-company.com - Form embedded as an iframe from
heyflow.siteortypeform.com - Booking through a calendar widget
- Purchase on the Digistore24 or CopeCart checkout page
Each of these handovers runs into three technical limits:
- Cookies are per domain. A cookie from
your-company.comcan't be read onheyflow.site. To the tracking on the second domain, the visitor is a stranger with no source. - An iframe is a separate document. The script on your page can neither read nor fill the fields inside a third-party iframe.
- Third-party cookies are largely blocked. A script inside the iframe has its own cookie storage for the other domain, and browsers increasingly block it. Safari, for example, has blocked cookies for cross-site resources by default since March 2020 (WebKit).
The result: the lead arrives by webhook, but with no connection to the visit that holds the ad click.
The principle: hand over an identifier
Every cross-domain tracking solution follows the same principle. Because the destination domain can't read the cookies, an identifier is passed along explicitly. Google Analytics 4, for example, does this with the _gl linker parameter, which is appended to links between the configured domains. It requires the same Google tag with the same measurement ID on all domains (Google Analytics Help).
For lead funnels there are four ways to pass on the session:
| Situation | Approach |
|---|---|
| Visitor follows a link between your own domains | Session identifier as a URL parameter on the link |
| Funnel builder allows custom code and forwards all fields | Script in the funnel, session ID in a hidden field |
| Form or booking tool without custom code, but with a redirect | Redirect to your thank-you page with the email address in the URL |
| Link into a checkout | Session identifier in the checkout link |
Underneath all of this, matching on contact details acts as a safety net: if the session already knows the visitor's email address or phone number, a lead that arrives later finds its session even without a session ID.
Connecting several of your own domains
If the landing page lives on offer.com and the application form on careers-company.com, you need classic cross-domain tracking. In LeadMetrics the setting is called Multi Domain Tracking. When it's on, the script automatically appends the session identifier to links pointing to other domains. The script on the destination domain picks up that session instead of starting a new one.
What matters:
- The same snippet everywhere: Every domain has to run exactly the same tracking snippet from the same project. Copy it rather than generating it again with different settings.
- Real links only: The session is passed on
<a href>links. Iframe sources, URLs built in JavaScript and form actions are not rewritten. - Think about subdomains: If visitors follow links between
www.andfunnel., the setting is worth turning on there too.
Funnel builders with custom code: Heyflow and Perspective
Funnel builders like Heyflow and Perspective let you add your own code to the funnel and forward all form fields by webhook. That's the most reliable case:
Add the script to the funnel
Paste the tracking script into the funnel's head code. In Perspective, on every page of the funnel.Create a hidden field
Add a hidden field namedlm_session_idand set its content to exactly{{LM_SESS}}, with nothing else. The script replaces the placeholder with the current session ID.Connect the webhook
Add the LeadMetrics webhook URL in the funnel tool. Every lead arrives with its session ID and is matched exactly to its visit.
If the funnel isn't its own page but an iframe on your landing page, it starts a session of its own unless something else is handed over. The lead does get attributed, but to a visit whose source is your landing page rather than the ad. In that case the session also has to be passed into the iframe URL. It's simpler to link from the ad straight to the funnel. If the tool supports custom domains, the funnel can also run on a subdomain of your website, where it shares cookies with your site.
ClickFunnels and Meetovo also allow custom code, but their webhooks only send a fixed set of fields. A hidden session field won't arrive there. Add the script anyway: it detects the email address in the form, and the lead is matched on contact details.
Tools without custom code: Typeform and Calendly
Typeform forms and Calendly bookings usually run in an iframe where you can't execute your own script. The solution is a redirect after submission to a thank-you page on your domain that runs the tracking script. The tool passes the email address in the URL, for example ?email=. The script reads it, the session now knows the person, and the lead arriving in parallel by webhook or Zapier finds its session.
- Typeform: Enter the thank-you page under "Redirect on completion" and insert the answer from the email field as a parameter, for example
https://your-company.com/thank-you?email={{field:email}}. - Calendly: In the event type settings under "Confirmation Page", redirect to an external site and enable "Pass event details to your redirected page". The booking itself reaches LeadMetrics via Zapier.
Two details decide whether it works: phone numbers have to be URL-encoded (%2B1… instead of +1…), otherwise the plus sign is lost. And the thank-you page has to run the same tracking snippet as the landing page.
Checkout pages: Digistore24 and CopeCart
For info products and coaching, the funnel often ends in a payment provider's checkout. Here the session is passed through the checkout link. Put the __LM_SESS__ placeholder into the link, and the script replaces it with the session ID before the click:
| Checkout | Link parameter |
|---|---|
| Digistore24 | ?cid=__LM_SESS__ |
| CopeCart | ?metadata=__LM_SESS__ |
| Stripe Checkout / Payment Link | ?client_reference_id=__LM_SESS__ |
The sale then comes back by webhook with that identifier and lands with the ad the buyer came from. Note that only regular links on your page are rewritten. A button that builds its URL in JavaScript won't get a session ID.
Custom widgets and special cases
If you have your own configurator, a custom booking widget or a page where form detection can't see the email field, you can identify the person yourself. A call like lmetrics.attribute({ email, phone }) attaches the email address and phone number to the current session. When the lead arrives later from the CRM or by webhook, it's matched that way.
How to test your setup
Start with test parameters
Open the landing page with the tracking parameters of a real ad, for example from the ad preview.Check the field or link
In the funnel, the hidden field has to contain a long identifier instead of the{{LM_SESS}}placeholder. In the checkout link,__LM_SESS__has to be replaced.Submit a test lead with a unique email
Submit the form with a unique test address. For redirects: do you land on your thank-you page, and is the email address in the URL?Check the attribution
The test lead has to show up with channel, campaign and ad. If the source is missing, the handover broke somewhere.
Common mistakes
- Script only on the landing page: Funnel pages, thank-you pages and second domains need the same snippet.
- Placeholder with extras:
{{LM_SESS}}is only replaced when it's the field's entire content. - Different snippets: Two domains run scripts from different projects or with different settings, so the session can't carry over.
- Redirects without parameters: A redirect or link shortener strips the session identifier.
- Your own domain as a source: The funnel builder shows up as the referrer and overwrites the ad.
How click parameters arrive cleanly in the first place is covered in the guide on UTMs and click IDs. How to go from a matched lead to revenue per ad is explained in the guide on lead attribution.
How LeadMetrics helps
- Every handover method built in:
{{LM_SESS}}for hidden fields,__LM_SESS__for checkout links, redirects with?email=,lmetrics.attribute()and Multi Domain Tracking for your own domains. - Form detection: Email and phone number from form fields are transmitted encrypted and stored on the session, including in single-page apps.
- Robust matching: Leads are matched by session ID, email address or phone number up to 90 days back, and unmatched leads are re-checked every hour.
- Ready-made connections: Heyflow, Perspective, OnePage, Meetovo, Typeform and ClickFunnels by webhook, Calendly via Zapier, and sales from Digistore24, CopeCart and Stripe. More on the lead tracking page.
Ready for better tracking?
Frequently asked questions
Terms in this guide
All termsCross-Domain Tracking
Cross-domain tracking keeps one visitor session across several domains, e.g. website, funnel and checkout. Why cookies break and how to set it up in 5 steps.
First-Party Cookies
First-party cookies are set by the domain you are currently visiting. They store things like logins, shopping carts or tracking IDs for that same website.
Third-Party Cookies
Third-party cookies are set by a different domain than the one you visit, such as an ad network, and let that domain track users across many websites.
Client-Side Tracking
Client-side tracking captures user actions with JavaScript directly in the browser and sends them from there to analytics and ad platforms.
UTM Parameters
UTM parameters are tags added to a URL (e.g. utm_source, utm_campaign) that tell analytics tools which source and campaign a visitor came from.
Landing Page · The destination page of an ad
A landing page is a page built for a campaign or offer that leads visitors to one action, such as submitting a form or booking a call.
Conversion Tracking
Conversion tracking records which users complete a desired action after clicking an ad – such as submitting a form, booking a call or buying.
CRM · Customer Relationship Management
A CRM (customer relationship management) is a system for managing contacts, leads, deals and all communication with prospects and customers in one place.
Related articles
- Client-Side vs. Server-Side Tracking: Differences, Pros and Cons for Lead GenerationClient-side vs server-side tracking: how both work, how they differ on ad blockers, cookies, privacy and data quality, and why lead gen setups combine the two.
- Instant Forms or Landing Page: Which Brings Better Leads?Meta Instant Forms bring cheap leads, landing pages often the better ones. When each route pays off, how to make Instant Forms more qualified and how to compare both fairly.
- From CRM Lead to Real Conversion: No More Flying Blind in Performance MarketingHow CRM/AdSync makes the true value of your campaigns visible – and why it's the game-changer for data-driven growth.
- Tracking without CAPI, Pixel Chaos, and Developer OverheadWhy modern marketers rely on Direct Track, one‑code tracking, and automatic form tracking
More guides
All guidesHow to Improve Meta Event Match Quality: What Data to Send
How to improve Event Match Quality in Meta: which customer data counts, how to normalize and hash it, and how fbc, fbp and event_id help your score.
Read guideCampaign Tracking with UTMs and Click IDs: Setup Guide
Set up clean campaign tracking: a UTM naming convention, dynamic parameters in Meta and Google Ads, click IDs, common mistakes and how to test it all.
Read guideClient Reporting for Agencies: How to Automate Marketing Reports for Lead Generation
Which KPIs belong in a client report for lead campaigns, how to structure a monthly report and how to automate data collection and delivery. With template and checklist.
Read guide