Capturing Leads From a Cross-Origin CallRail Form

Posted by: Paul Pampolino Date Posted: October 29, 2026
Back to Case Studies

Issue

A client’s /contact-us/ form needed to send leads to MCFX through an mcfx('capture') script. The page looked like a normal Contact Form 7 form, but it was only a shell. All the real fields load inside an iframe from js.callrail.com, and browsers block a parent-page script from reading or listening to fields in a frame from another origin. No on-page capture script can work here.

Solution

Three routes were laid out:

  1. CallRail webhook to MCFX (recommended). A form-submission webhook sends the payload to a small middleman (n8n, Zapier or a Cloud Run function), which forwards it to MCFX. It gets all field data reliably, but MCFX must accept server-side leads.
  2. Replace the iframe with a native form. The existing capture script then works as written, but CallRail’s attribution may stop detecting the form.
  3. Listen for a postMessage from the iframe. A console logger tests this in minutes. It likely wouldn’t include field values, so it would give a conversion without lead data.

Achievement

  1. Found the root cause (the cross-origin iframe) before shipping a script that could never have worked.
  2. Mapped three routes with their trade-offs, so the client can choose.
  3. Supplied a quick test that rules the postMessage route in or out.

Snippet/Screenshot/Link