Google Tag Manager

How does Google Tag Manager Work?

what is google tag manager
Written by Himanshu Suri

Index

S.No Action S.No Action
1 What is Google Tag Manager? 4 How to install Google Tag Manager
2 What is GTM Code? 5 Tracking Form Submissions using GTM
3 Advantage of using Google Tag Manager 6 Tracking Form Submissions in Popup

 

What is Google Tag Manager?

Google tag manager (GTM) is a consolidated tag management system which allows you to add, update codes and snippets to your website without needing to edit your site codes.

google tag manager preview

What is GTM Code?

The GTM code is a small piece of JavaScript code that is kept in the <head> and <body> section of the page enabling 3rd party tracking, reporting and analysis. Few examples of tags can be found below,

tags in google tag manager

Advantage of using Google Tag Manager

The obvious question that comes to mind is why GTM? When you can directly add codes to the website, why should you use google tag manager? The answer is, when you add all such tags (mentioned above) using GTM, you get more control over when and where the tag should fire, also how should a tag behave when fired.

Additionally, you can easily add, remove, delete, update each tag at any given point to make changes to your tracking system. You are not dependent on your development team to deploy any changes on the website.

Another highlight for the tool is, its free to use and you can preview the tags created before publishing them i.e. no more hardcoding and then testing required to see if the code is working as needed. Consolidating all your codes at one place also helps you improve your website speed.

Setting up and Installing Google Tag Manager

  1. Login to your Google Tag Manager account.
  2. Click on “Admin” tab from the navigation bar.
  3. Click on “Install Google Tag Manager” option under Container. (See Screenshot Below for Reference)installing gtm
  4. Add the code below across all your website pages under <Head> and <Body> section as instructed.gtm code for website

Tracking Form Submissions using Google Tag Manager

Submitting a form is one of the most common actions on a website. A newsletter subscription, contact form, signing up for a webinar event etc., all fall under this category. Lets see the step-by-step guide to tracking standard form submissions first,

  1. Click on “Triggers” from the left hand navigation and hit the “New” button at the top.
  2. Click “Form Submission” from the list as shown below,form tracking step 1
  3. Configure the trigger, and check the boxes labelled as “Wait for Tags” and “Check Validation” where “Wait for Tags” will ensure that your tracking tags have enough time to fire before the user is sent to the next page whereas the “Check Validation” prevents tags from firing on invalid form submissions.form tracking gtm
  4. Now set the conditions where you want the trigger to enable, using {{Page Path}} matches RegEx.* will enable the trigger across all the website pages. Next choose “Some Forms” and set the {{Form ID}} so that the trigger only enables when the condition matches the Form ID. See below,triggers in google tag manager
  5. Save the Trigger and move to Tags from the left hand navigation.
  6. Create a Google Analytics Tag and set it to the form trigger you created in the steps above.
  7. Before publishing your tag, preview your configuration using GTM’s Preview Mode. Once everything looks as expected, go ahead and hit Publish.

We will be coming soon with tracking form submissions without thank you page using GTM. Stay tuned!!

About the author

Himanshu Suri

Himanshu Suri is a digital marketing consultant. He has expertise in online marketing and web analytics. He has worked as a consultant for lot of agencies, private companies and few public figures.