{"id":284539,"date":"2026-03-04T18:06:18","date_gmt":"2026-03-04T18:06:18","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/tracking-for-divi\/"},"modified":"2026-03-04T19:33:35","modified_gmt":"2026-03-04T19:33:35","slug":"tracking-for-divi","status":"publish","type":"plugin","link":"https:\/\/sa.wordpress.org\/plugins\/tracking-for-divi\/","author":20325961,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.1.1","stable_tag":"1.1.1","tested":"6.9.4","requires":"5.3","requires_php":"7.4","requires_plugins":null,"header_name":"Tracking for Divi","header_author":"Kuba Serafinowski","header_description":"Track successful Divi contact form submissions.","assets_banners_color":"","last_updated":"2026-03-04 19:33:35","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/ko-fi.com\/kubaserafinowski","header_plugin_uri":"https:\/\/github.com\/zizzfizzix\/tracking-for-divi","header_author_uri":"https:\/\/kuba.wtf\/","rating":0,"author_block_rating":0,"active_installs":100,"downloads":319,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq"],"tags":{"1.1.0":{"tag":"1.1.0","author":"kubawtf","date":"2026-03-04 18:05:53"},"1.1.1":{"tag":"1.1.1","author":"kubawtf","date":"2026-03-04 19:33:35"}},"upgrade_notice":[],"ratings":[],"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.1.0","1.1.1"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[43896,10731,4093,550],"plugin_category":[36],"plugin_contributors":[257115],"plugin_business_model":[],"class_list":["post-284539","plugin","type-plugin","status-publish","hentry","plugin_tags-datalayer","plugin_tags-divi","plugin_tags-tag-manager","plugin_tags-tracking","plugin_category-analytics","plugin_contributors-kubawtf","plugin_committers-kubawtf"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/tracking-for-divi.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Ever wanted to track the built-in contact form from Divi? If you tried using Google Tag Manager's built-in form submit events to do it you probably noticed an inflated number of events flowing.<\/p>\n\n<p>This is because the form submission event is triggered even if there are form validation errors or the server returns another error.<\/p>\n\n<p>Since Divi doesn't provide any JavaScript events to hook into there is no straightforward way to find out if a message has actually been sent.<\/p>\n\n<p>To get around this, this plugin listens to the network communication that is happening underneath. It's based on the same mechanism Divi itself uses.<\/p>\n\n<p>There are three options now:<\/p>\n\n<ol>\n<li>a <a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/datalayer\">dataLayer<\/a> event<\/li>\n<li>a <a href=\"https:\/\/support.google.com\/analytics\/answer\/12229021\">Google Analytics 4 event<\/a> (using gtag.js)<\/li>\n<li>a <a href=\"https:\/\/support.google.com\/google-ads\/answer\/1722022\">Google Ads conversion<\/a> (also using gtag.js)<\/li>\n<\/ol>\n\n<p>You can use either one of them or event all of them together.<\/p>\n\n<p>You'll be able to customize the dataLayer variable if you're <a href=\"https:\/\/developers.google.com\/tag-platform\/tag-manager\/datalayer#rename_the_data_layer\">not using the standard naming<\/a>, and the event names, separately for dataLayer and gtag.<\/p>\n\n<h4>Data layer reporting<\/h4>\n\n<p>The structure of the object pushed to the dataLayer is the following, with the default naming:<\/p>\n\n<pre><code>{\n  event: \"contact_form_submit\",\n  formId: string,\n  postId: number,\n  formData: {\n    name: string,\n    email: string,\n    message: string,\n  },\n  allFormData?: Record&lt;string, unknown&gt;, \/\/ when \"Include all form data\" is enabled\n}\n<\/code><\/pre>\n\n<p>It's up to you to use or discard the form data.<\/p>\n\n<h4>Google Analytics 4 reporting<\/h4>\n\n<p>The Google Analytics event is sent with flattened parameters:<\/p>\n\n<pre><code>gtag(\n  \"event\",\n  \"contact_form_submit\",\n  {\n    form_id: \"divi\/contact-form-0\",\n    name: \"John\",\n    email: \"john@example.com\",\n    message: \"Hello\",\n    \/\/ additional fields when \"Include all form data\" is enabled\n  }\n);\n<\/code><\/pre>\n\n<p>Form data (name, email, message) is included by default. When \"Include all form data\" is enabled, all form fields are flattened into the event parameters.<\/p>\n\n<p><em>This will only work if you have a <a href=\"https:\/\/support.google.com\/google-ads\/answer\/11994839\">Google Tag<\/a> already deployed on the website i.e. the <code>gtag()<\/code> function is available.<\/em> Otherwise, you will see a warning in your console like this:<\/p>\n\n<blockquote>\n  <p>Tracking for Divi: gtag event failed, gtag is not defined<\/p>\n<\/blockquote>\n\n<h4>Google Ads conversion reporting<\/h4>\n\n<p>The Google Ads conversion is sent like so:<\/p>\n\n<pre><code>gtag(\n  \"event\",\n  \"conversion\",\n  {\n    send_to: \"&lt;conversion_id&gt;\/&lt;conversion_label&gt;\",\n  }\n);\n<\/code><\/pre>\n\n<p>There is no default for <code>conversion_id<\/code> and <code>conversion_label<\/code> as they are always created individually in Google Ads.<\/p>\n\n<p><em>This will only work if you have a <a href=\"https:\/\/support.google.com\/google-ads\/answer\/11994839\">Google Tag<\/a> already deployed on the website i.e. the <code>gtag()<\/code> function is available.<\/em> Otherwise, you will see a warning in your console like this:<\/p>\n\n<blockquote>\n  <p>Tracking for Divi: Google Ads conversion event failed, gtag is not defined<\/p>\n<\/blockquote>\n\n\n\n<p><strong>Note:<\/strong> This plugin hasn't been thoroughly tested with Divi forms that redirect to a success page. The tracking works just as well, however the redirect could interrupt the tracking flow e.g. if Google Tag Manager has a lot of logic and doesn't trigger the tags in time. The tags themselves these days <a href=\"https:\/\/support.google.com\/analytics\/answer\/9964640#event-batching\">use the beacon API<\/a> (see <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Beacon_API\">MDN<\/a> for reference) so the requests shouldn't be interrupted as long as they are fired before website unload.<\/p>\n\n<!--section=installation-->\n<p>All you need is to install it by uploading the zip file or using the plugin directory from within your WordPress website when the plugin is approved.<\/p>\n\n<p>There is no configuration necessary if you only plan to use the dataLayer. Activate and you're ready to go. However, it will only work if your current theme is <em>Divi<\/em> or its child theme.<\/p>\n\n<!--section=faq-->\n<dl>\n<dt id=\"how%20do%20i%20track%20form%20submissions%20with%20google%20analytics%3F\"><h3>How do I track form submissions with Google Analytics?<\/h3><\/dt>\n<dd><p>You can use Google Tag Manager to set up a trigger on the <code>contact_form_submit<\/code> event (default name) and set up a Google Analytics event tag that will be sent on the trigger.<\/p>\n\n<p>Alternatively, if you have gtag.js deployed on your website you can opt for direct reporting on the Settings page.<\/p><\/dd>\n<dt id=\"can%20i%20use%20a%20renamed%20datalayer%20variable%3F\"><h3>Can I use a renamed dataLayer variable?<\/h3><\/dt>\n<dd><p>Yes, by default this plugin uses a variable named <code>dataLayer<\/code>, however you can change that on the Settings page.<\/p><\/dd>\n<dt id=\"can%20i%20use%20a%20different%20event%20name%3F\"><h3>Can I use a different event name?<\/h3><\/dt>\n<dd><p>Yes, by default this plugin uses a <code>contact_form_submit<\/code> event, however you can change that on the Settings page.<\/p><\/dd>\n\n<\/dl>","raw_excerpt":"Track successful Divi contact form submissions with dataLayer events, Google Analytics, and Google Ads conversions.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/284539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=284539"}],"author":[{"embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/kubawtf"}],"wp:attachment":[{"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=284539"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=284539"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=284539"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=284539"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=284539"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/sa.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=284539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}