Google Analytics events with the Lead Gen Form

Leadinfo only integrates with gtm.js (Google Tag Manager) and gtag.js (the latest version of Google Analytics).

As a Marketer you want to know what the visitors on your website are doing. That is why we offer the possibility to send Custom Events to Google Analytics when someone submits a Lead Gen Form on your website. In this article you will find out how to set this up.

First, you need to know whether you are using Google Tag Manager to run Google Analytics or that the Google Analytics code is installed on your website. Ask your web administrator if you do not know how Google Analytics is installed.

Step 1: Send events to Google Analytics

Go to the Lead Gen Form settings in the Leadinfo portal and select "Action" in the right side menu. Make sure you check the box of "Send" underneath "Send event to Google Analytics on Submit".

If the Google Analytics code runs on your website, you only have to check the option send. If you are using Google Tag Manager for Google Analytics, continue to Step 2.



Step 2: Set up Google Tag Manager

When you are using Google Tag Manager, Leadinfo will create a custom event for and sends it to the dataLayer. To make sure that the event will be sent to Google Analytics, you have set up the below settings in Google Tag Manager:

  1. A variable

  2. A trigger

  3. A tag

Step 2.1: Create a variable

The first thing you need to set up is a variable in Google Tag Manager. Click "Variables" in the left menu of the Google Tag Manager console. And create a new "User-defined variables".

Give the variable the name: "LGF-Label" and select "Data Layer Variable". Enter "label" underneath "Data Layer Variable Name" and click "Save"!


Step 2.2: Create a trigger

Once you have installed the variable, you need to create a new trigger. Click on "Triggers" in the left menu of the Google Tag Manager console and add a new trigger by clicking on "New" at "Triggers".

Give your trigger the name "LGF - submit" and select "Custom Event" as a trigger type. The Event Name should be: "gtm.leadgenform.submit". Make sure you select that the trigger fires on "All Custom Events". If everything is set up correctly, you can save the trigger!


Step 2.3: Create a tag & connect the trigger

The final thing you have to set up in Google Tag Manager is a tag. Click on "Tags" in the left menu of the Google Tag Manager console and create a new tag.

Click on "Tag Configuration" and select "Google Analytics: Universal Analytics" as your Tag Type. Give your trigger a name and enter the below information into Google Tag Manager

Category = leadgenform

Action = submit

Label = {{LGF - label}}

Google Analytics Settings = The Google Analytics account you have connected

Add the trigger you created in step 2.2 by clicking on triggering. Select the trigger "LGF - submit" and click "Save".


Step 2.4: Publish the container

Now, you can finally publish the new container by clicking on "Submit" in the top right corner. From now on, the custom events are visible in your linked Google Analytics account!


Your Google Analytics event should look like this: