Google Tag Manager – Tracking Form Submissions

To Make this work – your form must have a FORM ID in the HTML

e.g.

<form id="contact-form" action="script.php" method="post">
    <input type="hidden" name="redirect" value="http://www.opera.com" />
    <ul>

 

Log in to GTM

If you don’t already have a Container for your website – create one now

 

Once you’re set up and inside GTM

Check Variables are Set up to Allow Form ID Tracking

  • Go to Variables
  • Click Configure
  • Scroll down to forms
  • Click Form ID
form id variable
Click “Variables” in the Left-hand Menu – Check Form ID is checked

 

Trigger – Set up Form ID Trigger

  • Go to Triggers in left sidebar
  • Click New
  • Give the Trigger a Name – “Form Submitted”
  • Click on the screen/box and to configure – select “Form Submission”
  • For generic tracking of forms choose “All Forms”
  • Leave the “Wait for Tags”* option for now. Increase if tracking doesn’t work
  • Click Save

*Wait for tags gives GTM more time to fire the tags, before moving to the ‘thank you’ page.

Form Submission Trigger
Triggers – Name The Trigger

form submission trigger gtm
Select – “Form Submission”

Tag – Set up GA Event Tag

  • Click “Tags” on left sidebar
  • Give it a name – “GA Event – Form Submission”
  • Click Box to configure – choose Universal Analytics
  • Add Google Analytics UA Code*
  • From the drop down menu – Track Type – Choose “Event”
  • Several options should now appear:

tag manager

  • Name the Category – e.g. “Leads” for a contact form on your business website
  • Action – e.g. “Form Submitted”
  • Label – click the Lego icon and choose Form ID
  • Scroll down to the second box and click to choose the trigger
  • Click on Form Submitted trigger that we made earlier
  • Click Save

 

*Found in Google Analytics>Admin>Property Settings

 

Instead of adding your GA Tracking ID, it’s often best to create a Variable for your ID so that it can be changed more easily etc.
See the video below on how to do this

Variables>Click + button in top right>Name it>Choose “Constant Variable”>Paste in Code