How to setup Google Analytics event tracking in Divi?

Hi Guys,

This tutorial can give you quick easy fix for setting up Google Analytics event tracking in Divi Contact form. Before going forward, I assumed your website is well  set up with ga code and it’s working fine.

Here logic is to use jQuery(Javascript library) to track form submit an event and keeping validation to ensure there is no error. This solution may not cover all the cases but cover almost 99% use cases.

Kindly add this js script in your custom .js file or can use WP add_inline_script().

		let dcHasError = true;
		setTimeout(function() { // now wait 1000 milliseconds...
          $('.et_pb_contact_form input').each( function() {
          	if( false === $(this).hasClass('.et_contact_error') ) {
          		dcHasError = false;
          		return false;
          if( true === dcHasError) {
          	ga('send', {
    		  hitType: 'event',
    		  eventCategory: 'event category name',
    		  eventAction: 'Form Submit',
    		  eventLabel: 'event category name'

Hope this helps to anyone struggling to tracking Divi contact form.


Join the Conversation


Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: