GTM DataLayer Form Action

Transfer DataLayer variables to Google Tag Manager using Elementor Forms.

watch the GTM DataLayer Form Action tutorial

Play Video

Push DataLayer Variables to Google Tag Manager on form Submission.

The GTM DataLayer Form Action is a new Action After Submit made available by Gloo‘s Form Extensions. With two simple fields it will let you define dynamic variables and push them to your Google Tag Manager DataLayer. Using this we can measure all manners of user interaction with our Forms, adjust our strategy accordingly, or monitor the same values across multiple platforms that support Google Tag Manager DataLayer values, like Google Ads.

Using Form Actions Pro to pick this action is recommended. As soon as the GTM DataLayer Form Action is selected, we can see we have a built-in repeater which will let us add as many items to the Form Action. Each item contains three fields which will help define the actual Value that the Form Action will push to the DataLayer.

DataLayer Variable ID.

The DataLayer Variable ID defines the name in the name-value pair. Here we can define a name for the Variable Value that we will set in the following fields.

Data Type.

The Data Type has two options: Form Field Value and Manual Input. These choices determine the source of the DataLayer Value, and consequently, they impact how the DataLayer Value field should be configured.

  • Form Field Value

Selecting this means that the DataLayer Value will be derived from the value entered by a user in a specified Form Field. In this case, you will need to specify the Form Field ID from which you wish to capture the value, as set in the Advanced Tab of the Form Field settings, and this value will then be passed to the DataLayer.

  • Manual Input

This option will let us manually input the value to be passed to the DataLayer by either writing it directly in the DataLayer Value field, or by using a Dynamic Tag.

DataLayer Value.

The DataLayer Value is defined by either the value the user writes or otherwise inputs in the Form Field specified in the DataLayer Value ID, or by the manually selected Dynamic Tag or manual input in the same DataLayer Value ID field. The DataLayer Value field determines the actual value that will be passed to the DataLayer, with its name being determined by the DataLayer Variable ID field value.

For example, if we’re trying to pass the name written by the User in the Name Form Field of an Elementor Form to DataLayer, we would have the freedom to name it anything we’d like to in the DataLayer Variable ID. Let’s call it form-name for the sake of the example.

We would then select Form Field Value in the Data Type options, and paste the Form Field ID in the DataLayer Value field. Since the ID of our Name Form Field is name, we will write name.

Once the Form gets submitted, the GTM DataLayer Form Action will send the name written in the Name Form Field to the DataLayer.

No additional GTM keys or settings are necessary, provided the Google Tag Manager code is correctly implemented on your website. GTM can seamlessly work with the variables sent to the DataLayer by the GTM DataLayer Form Action.

Disclaimer: This feature does not gather or store any of the data and variables being passed to external resources. That said, Google Tag Manager, connected to a WordPress website through this feature will track the data and use it as stated in its policies. Remember to update your own privacy policy to reflect the usage of the data passed on to the external services you chose, according to the laws of your region. the GTM DataLayer Form Action is not a tool that can be used to exploit or otherwise eschew data protection laws.

Frequently Asked Questions

The GTM DataLayer Form Action, available through Gloo’s Form Extensions, serves to facilitate the dynamic capture and transmission of user-generated data to Google Tag Manager. It allows users to define variables and send them to the Google Tag Manager DataLayer. This action is valuable for measuring various interactions with forms, adjusting strategies accordingly, and monitoring the same data across multiple platforms supporting Google Tag Manager DataLayer values, such as Google Ads.
To configure the DataLayer Value, you need to specify three key elements: DataLayer Variable ID, Data Type, and DataLayer Value. First, you define the DataLayer Variable ID, which is the name in the name-value pair. Next, you select the Data Type, which can be “Form Field Value” or “Manual Input,” depending on the source of the DataLayer Value. If you choose “Form Field Value,” you specify the Form Field ID from which to capture the value. If you opt for “Manual Input,” you can directly input the value or use a Dynamic Tag. The DataLayer Value is the actual data that gets sent to the DataLayer, with its name determined by the DataLayer Variable ID field.
No additional configuration is required for Google Tag Manager as long as the GTM code is correctly implemented on your website. The GTM DataLayer Form Action seamlessly works with the variables it sends to the DataLayer.