Custom Integration
1 min read
Advanced embedding options for developers and custom-built websites.
Overview
If you have a custom-built website or need more control over the integration, you have several options beyond the standard script tag.
API-Based Integration
For full control, you can use the Made For Law API directly to run calculations and display results in your own UI.
See the Developer Reference for API documentation.
Iframe Embedding
If the script tag doesn't work in your environment, you can use an iframe:
<"hl-attr">class="hl-tag">iframe
"hl-attr">src="https://app.madeforlaw.com/probate/embed?mode=embed&"hl-attr">license_key=MFL-XXXX-XXXX-XXXX-XXXX"
"hl-attr">width="100%"
"hl-attr">height="700"
"hl-attr">frameborder="0"
"hl-attr">style="border: none; max-width: 100%;"
></"hl-attr">class="hl-tag">iframe>Use the script tag method when possible. Iframe embeds are most useful when your platform restricts third-party scripts or you need a fully explicit iframe URL.
Single-Page Applications
For React, Vue, or other SPA frameworks, load the script tag dynamically:
useEffect(() => {
"hl-kw">const script = document.createElement('script');
script.src = 'https:class="hl-cmt">//app.madeforlaw.com/widget/loader.js';
script.setAttribute('data-key', 'MFL-XXXX-XXXX-XXXX-XXXX');
script.setAttribute('data-app', 'probate');
document.body.appendChild(script);
"hl-kw">return () => script.remove();
}, []);Event Hooks
Iframe embeds also emit postMessage events you can listen for:
| Event | Fires When |
|---|---|
mfl-ready |
The calculator is initialized |
mfl-resize |
The iframe height changes |
mfl-result |
A calculation is completed |
mfl-lead |
A lead form is submitted |
mfl-error |
A calculation/network error occurs |
window.addEventListener('message', (e) => {
"hl-kw">if (e.origin !== 'https:class="hl-cmt">//app.madeforlaw.com') "hl-kw">return;
"hl-kw">if (e.data?.type === 'mfl-result') {
console.log('Estimate:', e.data);
}
});See the Developer Reference for the full event contract.