JotForm is easy to build with and hard to track, for one reason: the form runs inside an iframe served from jotform.com. Your website's Google Tag Manager container cannot see anything inside it. No clicks, no fields, no submit.
JotForm does give you two ways out. It posts a message to the parent page when a submission completes, and it can redirect to a URL of your choice. This guide covers both, in order of reliability.
Method 1: Listen for the Submission Message
When a JotForm submission completes, the iframe posts a message to the parent window. The message is a string that starts with submission-completed followed by the form ID. We listen for it and push a dataLayer event.
Step 1: Listener tag
Create a Custom HTML tag named Listener - JotForm Submission firing on All Pages, or only on pages where JotForm is embedded:
<script>
(function () {
window.addEventListener('message', function (e) {
if (!e.origin || e.origin.indexOf('jotform') === -1) { return; }
var data = e.data;
if (typeof data !== 'string') {
try { data = JSON.stringify(data); } catch (err) { return; }
}
if (data.indexOf('submission-completed') === -1) { return; }
var parts = data.split(':');
var formId = parts.length > 1 ? parts[1].replace(/[^0-9]/g, '') : '';
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'form_submit_success',
form_tool: 'jotform',
form_id: formId
});
});
})();
</script>
The origin check ensures only messages from JotForm are accepted. The form ID lets you separate multiple forms.
Step 2: Variables, trigger and tags
Create a Data Layer Variable for form_id and a Custom Event trigger for form_submit_success. Fire your GA4 generate_lead event, your Google Ads conversion tag and your Meta Lead tag on it. Keep a Conversion Linker on All Pages.
Enhanced Conversions are not available through this method, because the email never reaches your page.
Method 2: Thank-You Page Redirect
In JotForm, under Settings, then Thank You Page, choose Redirect to an external link and point it to a thank-you page on your own site. JotForm lets you append field values as URL parameters, for example ?email={email}.
In GTM:
- Create a Page View trigger where Page Path equals your thank-you page.
- Create a URL variable for the
emailquery parameter. - Fire GA4, Google Ads and Meta tags on the trigger. Use the URL variable in a User-Provided Data variable for Enhanced Conversions.
- Add a small Custom HTML tag on the thank-you page that calls
history.replaceStateto remove the parameters from the address bar after the tags fire. - Add
noindexto the thank-you page.
This method gives you Enhanced Conversions at the cost of some exposure of the email in the URL. Many businesses are comfortable with that on their own domain. If you are not, use Method 3.
Method 3: GTM Inside JotForm
JotForm offers a Google Tag Manager integration under Settings, then Integrations. Add your container ID, and GTM loads inside the iframe. Inside that context, the JotForm thank-you page is a normal page view and the form fields are normal inputs, so you can track submission with a Page View trigger and read the email for Enhanced Conversions with a DOM variable before submit.
The downside is that conversions inside the iframe may not carry the Google Ads click identifier from your main site unless cross-domain linking is set up in the Conversion Linker, with both your domain and jotform.com listed. Set that up and test it.
Testing
- GTM Preview on the page with the embed. Submit the JotForm.
- For Method 1, confirm
form_submit_successappears with the form ID. For Method 2, confirm the thank-you page view and the email variable. - Confirm one fire each of GA4, Google Ads and Meta.
- Check the Google Ads request in a tag debugger such as the Insighter Debugger extension.
- Open the thank-you URL directly. If you used Method 2, you will see it fires. That is the known weakness; keep the page out of search and navigation.
Common Problems
- No message arrives. Check the browser console with a quick
window.addEventListener('message', e => console.log(e.origin, e.data))to see what JotForm actually sends. Message formats have changed over time. - Fires twice. Both methods live at once. Keep one.
- Conversion shows no campaign attribution. The iframe method with GTM inside JotForm lacks cross-domain linking. Add it, or switch to Method 1 or 2.
Recommendation
Use Method 1 for most sites. Add Method 2 if you need Enhanced Conversions and are comfortable passing the email through your own thank-you URL. Use Method 3 when the form is the main conversion and you want full control inside the iframe.
