How to track WPForms in Google Tag Manager?

WPForms is one of the most popular form plugins to use on a website. The plugin is user friendly and allows you to drag and drop features so that you can create simple but elegant submission forms. It's important to track contact form submissions and other activity on your website so that you can make …

WPForms is one of the most popular form plugins to use on a website. The plugin is user friendly and allows you to drag and drop features so that you can create simple but elegant submission forms.

It's important to track contact form submissions and other activity on your website so that you can make strategic decisions.

When you have the right Google Tag Manager (GTM) triggers in place, you can set up and track conversions and events in Google Analytics, Google Ads, Facebook Business, Yandex. Metrica and other tools. This allows you to gain a bit more accurate picture of the events and conversions – the actions people are performing and the actions you want them to take – that are occurring on your website.

GTM Custom Event trigger wpFormSubmit, used by the GA, Facebook and Yandex contact form tags
GTM Universal Analytics event tag with the formId variable as Action, firing on the wpFormSubmit trigger

I couldn't connect WPForms and GTM's 'Form Submission' event, so I believe the two aren't compatible, which means we need to create our own event.

This is how you do it:

Step 1: Create a Custom Event Trigger and name it as ‘wpFormSubmit’. The event triggers during the wpForm submission.

Google Tag Manager trigger set to Custom Event with the event name wpFormSubmit

Step 2: To capture the data, create a new Data Layer Variable and turn on the Form Built-In variables. Select the ‘formId’ variable, it is required to implement the code.

GTM Data Layer Variable named formId (version 2) that captures which WPForms form was submitted

Step 3: Then create the Google Analytics tag Event Listener to send the wpForm data to Google Analytics and set it to fire on the ‘wpFormSubmit’ trigger. Similarly, the data can be sent to Facebook, Yandex, etc as an event.

GTM Google Analytics event tag: category Contact Form Submit, action formId, fired by wpFormSubmit

Now, the code below will send the information to the Data Layer for the Google Tag Manager to pick up.

<script>
  window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({
    'event': 'wpFormSubmit',
    'formId': 'Simple Contact Form'
  });
</script>

The WPForms Confirmations setting has several options. I found the one that worked best was the 'Message' one.

Select the 'Text' view and copy and paste the JavaScript code above so it runs on a successful submission.

WPForms Forms Overview listing the Simple Contact Form, the name sent as formId
WPForms Confirmation type set to Message, with the wpFormSubmit dataLayer.push script in the Text tab

Follow the steps above and you'll be able to track WPForms contact form submissions easily.

You found us because of SEO, how is your SEO? Call us on 07902155143 Or request a call back below.
TRUSTED BY LEADING BRANDS
Tower London
Out and Out
Bedstar
Hunter Boots
Care Fertility
Aroma Zone
Interflora
Unbiased
Vera John
Bubble
Mint Outdoor
EsportsJunkie
Magna Valor

Ready to Improve Your SEO?

Contact us for a free assessment—no commitment required.

Built with ssg