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 is directly installed in the source code of 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 for Universal Analytics

When you are using Google Tag Manager, Leadinfo will create a custom event 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

 

When you're using GA 4 go to step 3!

 

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"!

 

 

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: "gtag.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!

 


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".

 


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:

 

 

 

Step 3: Set up Google Tag Manager for GA4

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

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 variable".


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

 

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: "gtag.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!

 

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: GA4 Event" as your Tag Type.

 

Below Configuration Tag, select your Google Analytics account and enter "gtag.leadgenform.submit" below Event Name.

 

Add Event Parameters by clicking on "Event Parameters". Fill out "gtag.leadgenform.submit" below Parameter Name. And add the Variable you created in step 1. You can doe this by typing in {{Leadinfo LGF - Label}} .

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

 

 

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: