Page 1 of 1

How to set up Pardot form tracking using GTM

Posted: Sun Dec 22, 2024 6:09 am
by nishat957
To track the submissions of forms within an iframe, the website that hosts the form (your Pardot domain) and the website that the form is embedded in need to communicate with eachother.

To do this, the Pardot form needs to send out a message to the main website website that is has been completed, and the main website needs to listen out for that message.

The good news is, the ease of event tracking in number phone cambodia GA4 makes it much easier to track Pardot forms, with just six steps.

Step 1: Pardot Form Template Code
First, in the Pardot form layout template’s ‘Form’ tab, amend the ‘thank you’ section to the following:

Image

It should look like this (be wary of punctuation when you copy and paste):

Screenshot of the Pardot form layout code

What this code does is fire a postMessage to the form’s parent window (the window above the iframe, essentially) upon the form’s completion. This postMessage contains an event name of ‘pardot_form_submit’ and a formName variable, which will dynamically capture the name of the form.

If you’d prefer to use a different event name, change it here and wherever you see it in the instructions below.

Once this is done, open Google Tag Manager and head to your website container.
Step 3: Create a custom formName Data Layer variable
Still within Google Tag Manager:

Navigate to ‘Variables’ in the left-hand menu.
Scroll down to ‘User-Defined Variables’ and click ‘New’.
Select the ‘Variable Configuration’ box and choose ‘Data Layer Variable’.
Enter the Data Layer Variable Name as ‘formName’.
Name the Variable as ‘Pardot Form Name Variable’ and hit ‘Save’.
Screenshot of Variable Configuration in GTM

Step 4: Create a Pardot form submission event
Create a new Tag of type ‘Google Analytics: GA4 Event’.

The Event Name should be ‘pardot_form_submit’ (this matches the event name used in the Listener code within your Pardot form template), and you need to add an event parameter of ‘form_name’ with the value being the new formName variable you just created.