All Collections
How to track form submissions using Google Tag Manager
How to track form submissions using Google Tag Manager

Track form submissions using Google Tag Manager

Sam avatar
Written by Sam
Updated over a week ago

Google Tag Manager is a tag management system (TMS) that allows you to quickly and easily update measurement codes and related code fragments collectively known as tags on your website or mobile app. Once the small segment of Tag Manager code has been added to your project, you can safely and easily deploy analytics and measurement tag configurations from a web-based user interface.

We recommend the GTM approach as it is easy to implement and two bits of code of GTM can do the entire work.

Above all, the Google Tag Manager approach requires no further code editing/modification. You simply paste the code in tracking code--------> Head and Body start of the landing page and you are done setting it up.

Here is an article that explains in detail where you have to paste the GTM code within Swipe Pages.

Let's get started with the steps involved in tracking the Form:

This article assumes that you have already copied and pasted the Google Tag Manager script into its appropriate section of the landing page within Swipe Pages.

In this article, I will be sending the form submission event to my Google Ads account.

Once you are done creating a form submission event in your Google Ads dashboard, please navigate to your GTM account.

Based on the instructions from the above article, please copy-paste the GTM tracking code within your landing page.

Setting up a Tag:

  1. Create a new Tag by clicking on the "New" button on your GTM dashboard.

  2. Based on the conversion ID and conversion label from your Google Ads conversion event settings, create a Tag with the appropriate title and save it.

Setting up the Trigger:

This is the most important step of the process. Here is how we do it.

  • Step 1:
    Create a new Trigger by clicking on the "New" button on your GTM dashboard.

  • Step 2:
    Provide an appropriate title for your trigger.

  • Step 3:
    Click on the trigger configuration and select "Form Submission" on the trigger type list.

  • Step 4:
    Now, we need to add a CSS class for the Form. Please go to the builder view of the page.
    Select the Form which you wish to track and under the advanced settings of the Form, add the CSS class within the CSS class field.
    A CSS class can be any word of your choice. In this video, I will be using the word "run" as the CSS class for the Form.
    Now, let us connect the Trigger and the form on the page using the CSS class.
    In the trigger configuration, select "Form submissions". Then, select "Form Element" from the drop-down menu of built-in variables.

    In the drop-down of criteria, select "matches CSS selector".
    Enter the CSS selector on the adjacent field in this format: .CSSCLASS form
    For example: If the CSS class provided to the Form is "run", then, enter .run form as the CSS selector in the adjacent field.
    (please note that there must be a space between the CSSclass and form)

  • Step 5:
    Now, link the tag with the respective trigger that we created as shown below.

Debugging the event setup:

Now, we have set the event by combining the tag and the trigger. Before we hit "submit" to Publish the changes, we must debug the event setup using the "preview mode" and check if everything is working properly.

Here is how it is done:

  • Click "preview" on the top right corner of the screen and type in the page URL in the dialogue box that opens up. Please wait for the debug window to open up as a new browser tab.

  • Now, submit the form that is supposed to be tracked in the debug window and then, press "finish" on the debugger popup.

  • Click on the "Form submit" on the left tab and see if the event name provided, which is, in this case, "Google Ads conversion tracking" is present there. Also, check if the pattern matched the CSS selector: .run form

    Publishing the event:

    Since we have verified that the event is firing, we can now click submit to publish the event.

Did this answer your question?