{"id":4280,"date":"2020-05-21T13:48:07","date_gmt":"2020-05-21T10:48:07","guid":{"rendered":"https:\/\/trackingchef.com\/?p=4280"},"modified":"2023-07-02T12:02:02","modified_gmt":"2023-07-02T09:02:02","slug":"bulletproof-elementor-form-tracking-with-gtm","status":"publish","type":"post","link":"https:\/\/trackingchef.com\/google-tag-manager\/bulletproof-elementor-form-tracking-with-gtm\/","title":{"rendered":"Bulletproof Elementor form tracking with GTM"},"content":{"rendered":"\n

I’m a big fan of WordPress and Elementor<\/a>. Combined, these two pack a punch far superior to other CMSs and page builders I’ve worked with. And with over 5M active installations of Elementor (as of May 2020), I often see this combination on clients’ sites.<\/p>\n\n\n\n

When creating a measurement plan for an Elementor site, you need to take into account that not all its forms can be easily tracked. The best course of action is to redirect the users to a Thank You page after successful form submission. This interaction is simple to capture across all ad and analytics platforms.<\/p>\n\n\n\n

If you’re using an Elementor form without a Thank You page, you can use Google Tag Manager (GTM) to track form submissions in several ways.<\/p>\n\n\n\n

Form Submission Trigger<\/h2>\n\n\n\n

This is the standard trigger for tracking form submissions in GTM. You can set it up with the Form Submission trigger. While this is simple to set up, it isn’t always a solid solution as it might miss submissions (if the tag didn’t run in time) or send false positives on failed submissions.<\/p>\n\n\n\n

\"\"
Form Submission Trigger in GTM<\/figcaption><\/figure>\n\n\n\n

Element Visibility Trigger<\/h2>\n\n\n\n

This trigger is more stable than the Form Submission. The basic idea behind this trigger is identifying when a user has viewed a certain element of the page. In this case, we ask GTM to identify users that have seen the Thank Message after successful submission. <\/p>\n\n\n\n

\n

Pro tip:<\/strong>
This trigger works regardless of the text of the Thank You Message<\/p>\n<\/blockquote>\n\n\n\n

To set up this trigger, simply navigate to the Triggers page in GTM a click ‘New’. Select Trigger Type ‘Element Visibility’ and set the Selection Method to ‘CSS Selector’. Paste in the field .elementor-message.elementor-message-success<\/span>.<\/p>\n\n\n\n

Finally, check the ‘Observe DOM changes’ box, or the trigger won’t be able to identify the new page element.<\/p>\n\n\n\n

\"\"
Element Visibility Trigger in GTM<\/figcaption><\/figure>\n\n\n\n
\n

Pro tip:<\/strong>
You can use a more restrictive CSS Selector to limit the trigger to specific forms, for example by adding the form’s ID to the CSS Selector<\/p>\n<\/blockquote>\n\n\n\n

jQuery Event<\/h2>\n\n\n\n

This method uses a different approach. It adds a jQuery event listener that observes form submissions.<\/p>\n\n\n\n

In layman’s terms, every time an Elementor form is successfully submitted, an “invisible” flag is raised in the page’s HTML code. This event listener will identify that this flag is has been raised, and in turn will trigger your code.<\/p>\n\n\n\n

\n

Pro tip:<\/strong>
This method can be used to track form submissions even without GTM, by triggering the relevant conversion pixel (e.g. Facebook Lead)<\/p>\n<\/blockquote>\n\n\n\n

I like using this event listener to trigger a Data Layer push that triggers my Generic Event<\/a>.<\/p>\n\n\n\n

To use this event listener, create a new Custom HTML tag in GTM and paste in the code below. This tag should be triggered on all pages.<\/p>\n\n\n\n

<script>\njQuery(document).ready(function($) {\n    $(document).on('submit_success', function(evt) {\n        dataLayer.push({\n            'event': 'form_submit',\n            'form_name': evt.target.name,\n        });\n    });\n});\n<\/script><\/code><\/pre>\n\n\n\n

Kudos to Kova for contributing to this improved snippet.<\/strong><\/p>\n\n\n\n

\n

Pro tip:<\/strong>
Since this tracking is an inherent part of the site, in many cases I would prefer adding it directly to the site’s header\/footer instead of working via GTM<\/p>\n<\/blockquote>\n\n\n\n

If you want to use this trigger for additional platforms beyond Google Analytics, you can simply create a Trigger that captures only form submissions.<\/p>\n\n\n\n

Triggering other platforms<\/h3>\n\n\n\n

If you want to use this trigger for additional platforms beyond Google Analytics, you can simply create a Trigger that captures only form submissions.<\/p>\n\n\n\n

Navigate to the Triggers section and create a new trigger. Select the Trigger Type ‘Custom Event’ and set the Event Name to ‘form_submit’.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

This trigger can now be used to trigger conversion pixels, e.g Facebook or LinkedIn Leads.<\/p>\n\n\n

\n
\"\"
Facebook Lead event with form_submit<\/em> trigger<\/figcaption><\/figure><\/div>","protected":false},"excerpt":{"rendered":"

I’m a big fan of WordPress and Elementor. Combined, these two pack a punch far superior to other CMSs and page builders I’ve worked with. And with over 5M active installations of Elementor (as of May 2020), I often see this combination on clients’ sites. When creating a measurement plan for an Elementor site, you […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[43],"_links":{"self":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4280"}],"collection":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/comments?post=4280"}],"version-history":[{"count":11,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4280\/revisions"}],"predecessor-version":[{"id":5676,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/posts\/4280\/revisions\/5676"}],"wp:attachment":[{"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/media?parent=4280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/categories?post=4280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trackingchef.com\/wp-json\/wp\/v2\/tags?post=4280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}