Tracking Forminator form submissions with Google Tag Manager (GTM)

PUBLISHED 27 Nov 2020 - UPDATED 21 Aug 2023

This article builds on the work of Julius Fedorovicius at Analytics Mania to track Forminator's AJAX form submissions using Google Tag Manager.

Introducing Forminator

Forminator is a powerful freemium form builder plugin for WordPress with more than 400,000 active installations. It's also what I use here on technicallyproduct.co.uk. So how do you track Forminator form submissions as events in Google Analytics 4 (GA4) using Google Tag Manager?

Forminator's default behaviour is to use AJAX to send the form without reloading the page, and then display an inline message following successful form submission. As a result, the out-of-the-box 'Form Submission' trigger type in Google Tag Manager doesn't work with Forminator.

'Redirect user to a URL'

One option would be to change Forminator's settings and 'Redirect user to a URL' after a successful submission (this can be set under Forms > EDIT > Behaviour).

Forminator URL redirect

If you did this, you could then create a trigger in Google Tag Manager that fired on the 'success' page.

But what if you want to keep Forminator's default settings and still track form submissions? You're in luck - the brilliant Julius Fedorovicius at Analytics Mania has written a comprehensive guide to tracking AJAX form submissions using Google Tag Manager. This in turn makes use of an AJAX listener shared by Bounteous.

I would recommend following Julius' guide while making just a couple of small changes specific to Forminator - one to the Data Layer Variable Name, and one to the trigger.

Tweaking the Data Layer Variable Name

Here's what the data layer values for the ajaxComplete event look like in the Google Tag Manager preview and debug console following a successful Forminator form submission:

ajaxComplete in data layer

When I first wrote this post, I suggested using the Data Layer Variable Name attributes.response.success. However it occurred to me the following day that both this key and the value (true) were rather generic.

This raised the possibility that something that uses AJAX other than Forminator might add exactly the same key-value to the data layer. And if that were to happen, it could trigger false positive form completions.

Perhaps I'm being overly cautious, but I've changed my own setup to use the following Data Layer Variable Name: attributes.response.data.behav

Datalayer variable

This has a value of behaviour-thankyou on a successful form submission. Note the British English spelling of 'behaviour'! And if you Google this phrase (with quotes), the only relevant results relate to Forminator so I'm fairly confident that we will be able to avoid any false positives.

Tweaking the trigger

Your trigger in Google Tag Manager will also need to be changed to take into account the value you are capturing. My trigger looks like this:

Forminator form submission trigger

Tracking multiple forms

Since I published this article, a couple of commenters have asked about distinguishing between multiple Forminator forms. So I've written a separate guide to this: Differentiating between Forminator forms in GA4 using Google Tag Manager (GTM)

Subscribe
Notify of
guest
10 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Timotime
Timotime
3 years ago

Hey James,

thanks for your input. This looks quite good, however different forms can't be distinguished this way, can they? There is no FormID or similar passed.

Many greetings,

Timo

Genevieve Reid
9 months ago
Reply to  James Clark

Hi! Could you elaborate on this? If I was to change the displayed response message to "A team member will contact you via email shortly" what would I change the DLV to? Thanks so much for this great article though!

anonymous
anonymous
3 years ago

Thanks for this. I had initially tried Julius Fedorovicius at Analytics Mania's way and it hadn't worked and now your small tweak to the dataLayer variable actually made my Tag fire. I appreciate it

Last edited 3 years ago by anonymous
Krisztian
1 year ago

Hi, I followed the process and the tag is fired but the firing status is failed (and GA don't show the event). Do you have any idea about that error?

Alex
Alex
8 months ago

Hey James,
thanks a lot for this great article!
What do you think about their solution - https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#form-data-not-sent-to-gtm?

Abby
Abby
8 months ago

Hi James,

Thanks for sharing this! I've tried to track Forminator submissions multiple ways and the AJAX listener works, but for some reason it keeps triggering twice, with nothing to differentiate between the two ajaxComplete events. In my GA4 settings, I've selected "Ignore duplicate instances of on-page configuration" but this isn't stopping 2 form submissions being recorded. Any suggestions?

Thanks!

adrian
adrian
3 months ago

Thanks.

I want to setup Enhanced Conversions with user provided data such as name, email, etc.

Any idea, how I get those information in the DL-push?

James Clark
Hi! I'm James Clark and I'm a freelance web analyst from the UK. I'm here to help with your analytics, ad operations, and SEO issues.
10
0
What do you think? Leave a commentx
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram