Mautic is a very flexible and powerful Marketing Automation tool.

When you create forms in Mautic for online campaigns, it’s important to track conversions from Google Analytics in order to optimize your media placement spend.

Using Google Tag Manager

In order to track Mautic from form submissions found in Google Analytics, you need to use Google Tag Manager.

A powerful tag manager can allow you to configure tags, triggers and variables.

When used with JavaScript and (or) RegEx effectively, the possibilities become endless. It is the latter that will serve as the subject of this tutorial. RegEx is extremely useful for extracting information from any text by searching for one or more matches of a specific search pattern, even an HTML page.

Create a Mautic Form

First, you need to build a Mautic form.

Once the form is created, you must integrate it into your website with the automatic option found in JavaScript.

The form will automatically generate on your page.

Inspect the Form

To understand what we are going to look for in the form, use the Google Chrome Inspector. Hover over the form area, right-click and select Inspect.

In the example above, we find on line 1 the element of the form. We need to find his ID, mauticform_newsletteren. Since all Mautic form ID’s begin with mauticform_, we will use RegEx to retrieve all form ID’s.

Line 2 is the confirmation message, empty in the example. When the form is submitted and confirmed, the confirmation message appears in this item. We will use the class mauticform-message to detect the element when a message is displayed.

Creating the variable

The difficulty with Mautic forms is that the HTML tag that confirms the submission of the form is still present on the page. However, this item is empty and prints the message only when it has message confirmation.

For this purpose, we will use the variable DOM Element. This is a variable in Google Tag Manager that allows you to “scratch” the content directly from the Document Object Model (DOM). In other words: with this help of this function, you can transfer any text on your website into a variable and pass it on to Google Analytics.

  1. Go to Variables
  2. Scroll down to user-defined variables and click New.
  3. Choose Variable Type – DOM Element Variable
  4. Selection Method – CSS Selector
  5. In the Element selector field, type div.mauticform-message
  6. Leave the name of the attribute empty.
  7. The title of the variable could be DOM – Mautic Form Success Message.
  8. Click Save.

This variable will help the trigger to detect the submission confirmation of the form.

Set up the trigger

  1. Trigger Type – Form Submission
  2. Wait for Tags – check
  3. Check Validation – check
  4. DOM – Mautic Form Success Message matches RegEx .*
  5. Form ID – matches RegEx mauticform_.*

The trigger will find all forms whose ID starts with mauticform_, or all Mautic forms and it will launch the tag when a message is displayed, or the confirmation of submission of the form.

Set up the tag

Configuration d'une balise Mautic sous Google Tag Manager

  1. Tag Type  – Google Analytics – Universal Analytics
  2. Track Type – Event
  3. Category – Mautic Form
  4. Action – Submission
  5. Label – {{Form ID}}
  6. Google Analytics Settings

Set Google Analytics

At this point, Google Analytics already tracks the events related to the programmed submission extracted from the Mautic form, but they are not registered as a conversion goal. You can view events in Google Analytics under Behavior> Events.

The final step is to set up a conversion goal.

  1. Navigate to Admin> Objectives
  2. Click New Objectives
  3. Click the Custom radio button.
  4. Name the goal and select the radio button Event.
  5. Fill out the fields as on Google Tag Manager:
    1. Category – Mautic Form
    2. Action – Submission

In our example, we use RegEx again, because we want to track two different language forms for the same purpose. We have therefore inserted our form ID accordingly: mauticform_newsletter.*

The field value can be left empty, or you can use it if there is a monetary value.

Conclusion

Remember to test your form and visit Google Analytics to see if your conversion has been saved.

Confirmation of forms is very important for optimizing campaigns and for monitoring marketing actions in general. It allows you, among other things, to calculate the conversion rate of the different channels you use.

To fully understand the power of metrics related to Google Analytics, I invite you to sign up for one of the digital marketing courses offered by Parkour3.

Contact an Expert


French-English Translation Services Provided By Robert Fabris

Google Analytics and Mautic (Open Source Marketing Automation): How to track digital conversions?

Jeffrey Labrecque

Web Advisor, Google Adwords and Google Analytics Individual Qualified

Category: Marketing Automation