If you’re using the Divi Contact Form, you’ve probably noticed that the default Form Submission trigger in Google Tag Manager doesn’t fire. That’s because Divi submits forms using AJAX instead of a traditional page reload.
A simple workaround is to detect Divi’s success message, push a custom event to the dataLayer, and use that event to send a conversion to Google Analytics 4 (GA4).
Step 1: Create a Custom HTML Tag
In Google Tag Manager, create a new Custom HTML tag.
- Tag Type: Custom HTML
- Trigger: All Pages
Paste the following script into the tag:
<script>
(function () {
var observer = new MutationObserver(function (mutations) {
for (var i = 0; i < mutations.length; i++) {
var addedNodes = mutations[i].addedNodes;
for (var j = 0; j < addedNodes.length; j++) {
var node = addedNodes[j];
if (
node.nodeType === 1 &&
node.className &&
node.className.indexOf('et-pb-contact-message') !== -1
) {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'divi_form_submit'
});
}
}
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
})();
</script>This script watches for Divi’s success message (et-pb-contact-message). When a visitor successfully submits the contact form, it pushes a custom event named divi_form_submit into the dataLayer.
Step 2: Create a Custom Event Trigger
Next, create a trigger in Google Tag Manager.
Trigger Settings
- Trigger Name: Contact Form Submission
- Trigger Type: Custom Event
- Event Name:
divi_form_submit
Save the trigger.
Step 3: Create a GA4 Event Tag
Now create a new GA4 Event tag.
Use the following settings:
- Tag Type: Google Analytics: GA4 Event
- Event Name: Contact Form Submission
- Trigger: Contact Form Submission
If you’re already using a GA4 Configuration Tag (or Google Tag), select it for this event tag.
Step 4: Test Everything
Before publishing your GTM container:
- Click Preview in Google Tag Manager.
- Open your website.
- Submit the Divi contact form.
- Verify that the
divi_form_submitevent appears in the GTM preview. - Confirm that your GA4 Event tag fires successfully.
Once everything looks good, publish your GTM container.
That’s It!
Your Divi Contact Form submissions are now being tracked in Google Analytics 4 using Google Tag Manager.
This approach is lightweight, doesn’t require any Divi plugins, and works by detecting Divi’s AJAX success message instead of relying on the default Form Submission trigger, making it a reliable way to track contact form conversions.