A tiny interceptor that listens to Elementor Pro form submits (via admin-ajax.php), pushes
elementor_form_submit immediately, and (optionally) fires
elementor_form_thank_you on the actual redirect page detected from the AJAX response.
{
event: "elementor_form_submit",
user_data: {
action: "elementor_pro_forms_send_form",
form_id: "fc941d8",
post_id: "5",
first_name: "Test",
last_name: "User",
email: "info@example.com",
message: "Hello"
}
}
Submit Intercept
Wraps XMLHttpRequest to detect successful Elementor Pro form submits and pushes elementor_form_submit.
Dynamic Thank-You
Learns the actual redirect URL from the AJAX response and fires elementor_form_thank_you on the matching page.
Cross-domain fallback
Optional pre-redirect “thank-you” push if the final page is on another domain.
Once-per-user
Optional suppression after the first success to prevent duplicate tracking for the same browser/user.
Consistent submit & thank-you events make GA4/Ads/Meta conversions straightforward and de-duplicated.
Drop-in script—works alongside Elementor Pro without touching form settings.
Handles varied Elementor response shapes and many thank-you URLs per form.
1) Add Config (before main script)
<script>
var eleFormDLConfig = {
storeData: true,
oncePerUser: false,
pushDataLayerOnThankYouPage: true,
checkUserDataOnThankYouPage: true,
removeDataAfterDataLayerPush: true,
useDynamicThankYou: true,
pushThankYouImmediatelyIfUnknown: true,
// thankYouPages: ["/thank-you/"], // use if useDynamicThankYou = false
maxTyPathsPerForm: 10
};
</script>
2) Add the Main Script
Paste the repository’s main JS right after the config (theme, code snippet plugin, or GTM Custom HTML on All Pages).
GTM: Make sure the Config tag fires before the Main tag.
| Option | Type | Default | Description |
|---|---|---|---|
| storeData | boolean | true | Save last payload to localStorage for use on TY page. |
| oncePerUser | boolean | false | After first success, skip both submit & TY pushes. |
| pushDataLayerOnThankYouPage | boolean | true | Enable TY push on the actual redirect page. |
| checkUserDataOnThankYouPage | boolean | true | Only push TY if stored data exists. |
| removeDataAfterDataLayerPush | boolean | true | Clean up localStorage after push. |
| useDynamicThankYou | boolean | true | Learn redirect URLs from AJAX. Use static thankYouPages if false. |
| pushThankYouImmediatelyIfUnknown | boolean | true | Push TY pre-redirect if redirect URL can’t be detected (useful for cross-domain TY). |
| thankYouPages | string[] | — | Static path snippets when not using dynamic detection. |
| maxTyPathsPerForm | number | 10 | How many learned TY paths to keep per form. |
Submit
Fires immediately on successful AJAX response.
{
event: "elementor_form_submit",
user_data: { ...fields, form_id, post_id, first_name, last_name }
}
Thank-You
Fires on the actual thank-you page (dynamic) or pre-redirect (fallback).
{
event: "elementor_form_thank_you",
user_data: { ...same as submit payload }
}
Use these events as GTM triggers to send GA4 / Google Ads / Meta conversions and enhanced conversions.