This article builds on the work of Julius Fedorovicius at Analytics Mania to track Forminator's AJAX form submissions using Google Tag Manager.
Forminator is a powerful freemium form builder plugin for WordPress with more than 100,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 (Universal Analytics) 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.
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).
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.
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:
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 am being overly cautious, but I have changed my own setup to use the following Data Layer Variable Name: attributes.response.data.behav
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 am fairly confident that we will be able to avoid any false positives.
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:
I hope this is of some use - and if you still need help tracking your Forminator form submissions in Google Tag Manager then do get in touch.