Resources

How to Use Google Tag Manager for Tracking Digital Marketing

convincer-image

How to Use Google Tag Manager for Tracking Digital Marketing

Looking to harness the power of Google Tag Manager (GTM) to ramp up your digital marketing and tracking practices? You’re in luck! We’ve developed this in-depth guide to show you how to set up tracking tags and tracking pixels to track metrics for your landing pages, social media, form submissions, Youtube videos, and more.

First, what is Google tag manager? We think that the best approach is to use GTM as a “centralized” tag management system (container, to be precise). Google Tag Manager works by creating and firing snippets of code based on various triggers.

This will let you manage tags, as you go, to fit your changing business requirements. It’s easy to create, test, and publish new tags from a single place without involving your developers.

Caution: One of the first steps before you begin Google Tag Manager setup is to check the tracking requirements on all the channels and review which are already running on the website to prevent duplicates.

One of the most frequent scenarios is when a google analytics snippet is already added to the website script and is collecting data, and an “All Pages View” tag is simultaneously introduced via GTM. To avoid this classic example, please be sure to check the existing tracking and only create the tags for the required parameters.

Google Tag Manager Tutorial

Create a Google Tag Manager account

  • Go to GTM. Click on “Create Account” on the top right of the screen.
  • The next screen will ask you to fill in your account and container details.
  • Under “Account Setup”, enter your account name and country. You may or may not want to select “Share data anonymously with Google and others” depending on your privacy policies.
  • Under “Container Setup”, create your container name and check any of the targeted platforms you desire.
  • Click “Create.”
  • Check T&C and on the next screen, the container is ready.

Container Dashboard – Overview

  • Your Workspace is a virtual playground of sorts. Here, you can create tags using variables and triggers, test the components of tags, publish and edit tags, and organize them using folder structure.
  • Versions stores different versions of containers. For example: after publishing a container, one can create a new version of it and make appropriate edits or debug.
  • Visit the Admin pane to view or edit your account and container settings.

How to add a GTM container code snippet into WordPress

If you are powering your website using WordPress, you can add your GTM container snippet to WordPress using one of these two methods:

Update Header.php file / Manual method

  • Find the Header.php file on your WordPress Admin Dashboard and open it.
  • Go to the “Admin” section of your GTM account. On “Container Setup”, click on “Install Google Tag Manager” and you will find a screen with 2 different code snippets.
  • Copy the first code snippet and paste it as high in the <head> portion of the page as possible. It will look something like this:<!– Google Tag Manager –>
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:
    new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
    j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=
    ‘https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);
    })(window,document,’script’,’dataLayer’,’GTM-XXXXXXX’);</script>
    <!– End Google Tag Manager –>
  • Then, paste the second code snippet immediately after the opening <body> tag:
    <!– Google Tag Manager (noscript) –>
    <noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX”
    height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
    <!– End Google Tag Manager (noscript) –>

Use a plugin to create a GTM container

  • The “Google Tag Manager for WordPress” plugin is one of the most recommended and easy to use options.
  • Install the plugin.
  • Activate the plugin and you will be taken to the setup screen. On the “General” tab you will be asked to fill in your GTM ID. You can access this ID from the “Workspace” screen of your GTM account. You’ll find it around the top-right corner, beside the “tag review” and “publish” commands. It will look like this: (GTM-XXXXXXX).

Notes:
There are two types of snippets: <script> and <noscript>. You can place <script> code anywhere on the website, the higher the better as it will load faster making the tracking more precise. NEVER place the <noscript> code in the <head> part of the website javascript. You can put all codes in the <body> tag after opening or before closing.

How to Create Tags

Now we’ll discuss how to create, test, and publish some of the most essential tags you’ll need as you set up digital tracking. These tags include:

Google Analytics Tag

  • Go to your Google Analytics account.
  • Go to “Admin” → Property → Tracking Info → Tracking Code. Here you will find the GA tracking ID for your account. Copy it.
  • Now open GTM → Workspace → click on “Variables”, name it “ga_property_id”.
  • Go to “User-defined Variables” and click “New.”
  • Under “Variable Configuration,” choose “Constant” as the variable type.
  • Next, add GA tracking ID as a value, which should look something like this: UA-XXXXXXXX-X.
  • Click “Save”.
  • Get back to GTM Workspace → Click on “New.”
  • On the next screen, you’ll start creating the GA tag. Name it “GA – All Visitors.”
  • Go to “Tag Configuration” → choose tag type → Choose “Google Analytics: Universal Analytics.”
  • Select an appropriate “Track Type,” e.g. “Page View.”
  • Check “Enable Overriding Settings in this Tag”, which will ask you to fill in the GA tracking ID. Click on the button and choose “ga_property_id” as a variable.
  • Jump to “More Settings”, click on “Advertising”. For “Enable Display Advertising Features”, choose “True.”
  • Under “Advanced Settings”, click the “Once Per Event” option for tag firing.
  • For triggering, choose “All Pages” as a trigger.
  • Hit “Save.”

As one of the primary GA tags, this tag enables traffic data capturing for all web pages. Click here to learn about how to create more specific, customized GA tags.

Google Adwords Remarketing Tag

  • Go to GTM → Workspace → Click on “New.”
  • On the next screen, name the tag “Google Remarketing Tag.”
  • Go to Tag Configuration → choose tag type → Choose “Google Ads Remarketing”
  • Add Conversion ID (mandatory). To find the Conversion ID, follow these steps:
    • Sign in to your Google Ads account.
    • Go to Tools and Settings → Shared Library → Audience Manager.
    • From the left-hand side menu, click Audience Sources.
    • Find and click Details on Google Ads tag card, the card will expand, scroll down further, and click on “Tag Setup.”
    • Click on “Use Google Tag Manager.”
    • Copy the 9-digit Conversion ID.
  • Now click “Triggering” and select triggers. This will specify the rule as to when the tag should fire. Here you should select trigger type and select “All Pages” if the remarketing tag is needed on all pages of your website.
  • Click Save to complete your tag setup.

Along with conversion ID, you would also need to add a conversion label if you already have an existing tag-based remarketing list with a conversion label. Go to the corresponding list → Tags and view details. Under the event snippet, copy the conversion label. Below is the guide on how to create a remarketing list.

How to Create a Remarketing List?

Remarketing is one of the most common and reliable techniques for marketers to engage anyone who has previously visited your website and app, by showing them your ads. You can create a website remarketing list in your Google ads account by following the steps below.

  • Sign in to your Google Ads account.
  • Under “Tools & Settings”, click “Shared Library.”
  • Click “Audience Manager.”
  • Click “Audience Lists.”

Begin creating remarketing lists by clicking on the “+” button. You have five options: Website visitors, App users, YouTube users, Customer list, and Custom combination.

  • Select one of the options, let’s say, Website visitors.
  • On the next screen, make settings for the remarketing list. Name the list, create rules for enrolling visitors on the list, and others such as duration, list pre-fill, and description.
  • Click Create audience.
  • For a more in-depth guide on these steps, go here.

Google Adwords Lead Conversion Tag

Step 1: Set and obtain Conversion Action Details in Google Ads Account

  • Login to Adwords account.
  • Click on Settings → Measurement → Conversions.
  • Under “Conversion Actions”, click on the “+” sign which will show a screen with 4 types of actions. (Website, App, Phone Calls and Import)
  • Choose the conversion option. It will take you to categories of conversions: purchase, lead, page view, sign up, and others.
  • Choose one of the categories and select the conversion details (conversion, name, value, count, conversion window, view-through conversion window, include-in conversions, and attribution model).
  • Click “Save and Continue”.
  • On the next screen, move to step 2. Set up the tag by choosing “Use Google Tag Manager.” Click it and the pane below will expand to show “Conversion ID,” “Conversion Label,” and other information. Copy and keep both values readily available because we’ll be needing them in a bit.

Step 2: Set up a tag using GTM

  • Go to GTM → Workspace → Click on “New.”
  • On the next screen, name the tag as “Adwords Lead Conversion Tag.”
  • Go to Tag Configuration → choose tag type → Choose “Google Ads Conversion Tracking”
  • Add “Conversion ID” and “Conversion Label”.
  • Under “Triggering,” select or create “Element Visibility” as a trigger type. Name the trigger as “Thankyou-VisibilityTrigger.”
  • Choose the appropriate selection method, i.e. ID or CSS selector. Learn more about this step here.
  • Under “Element Selector,” choose the appropriate selector. For the purpose of this guide, we are tracking conversion for a lead form. So, we will have to find and add a specific selector based on the element visible within the javascript of the “Thank You” pop-up page. Here is a great resource on how to find the right element if you also have a lead form and you want to create tracking for it.
  • In “When to fire this trigger”, select any of the given 3 options (Once per page / Once per element / Every time an element appears on screen) that matches your requirements.
  • Check “Observe DOM changes.”
  • Select “All Visibility Events” for “This trigger fires on”, this means whenever this element will be visible on the page, this tag will fire.
  • Now the tag is ready for testing and publishing.
  • There are a number of actions you can track using different triggers. Here is a comprehensive guide to help you can gain a deeper understanding of triggers as well as the scope and significance of each of the triggers.

We recommend these resources for creating and testing this tag:

LinkedIn Insights Tag

  • Create Campaign Manager in LinkedIn, if you do not have one.
  • Under “Account Assets,” click “Insight Tag.”
  • First-time users would need to install Insight Tag. Click on it and select “I will use a tag manager.”
  • Double click partner ID, it will be copied.
  • Now go to GTM and click “New” under “Tags.”
  • Title it “LinkedIn Insight Tag.”
  • Add Partner ID.
  • Trigger “All Pages.”
  • Save.

Set up LinkedIn conversion tracking
https://www.linkedin.com/help/lms/answer/67514

Setting Up an Event-Specific Image Pixel for Conversion Tracking
https://www.linkedin.com/help/lms/answer/93957

Here is a useful guide to Access Your LinkedIn Insight Tag

Facebook Pixel

https://www.facebook.com/business/help/1021909254506499

To track and optimize your social media ads, Facebook Pixel is the first step. Facebook Pixel is a code that helps you collect all data about the performance of your Facebook ads so that you can understand the conversion pattern, optimize the ads for improving conversions, and build the right audience for targeting as well as remarketing.

You can install the base code of your Facebook Pixel in the GTM account. For this, you will need Admin-level access for the Facebook account that you wish to track. Also, you will need to have the Facebook Business Manager set up and ready along with the URL of your website under the “Pages” section. This will enable you to reach the Pixel code.

Note: Remember, you have to have admin-level privileges to implement Pixel in GTM. Once you are designated as an admin, you can look for the Business Manager and if it does not exist, you can create one.

  • First, log in to your Google Tag Manager account → Workspace → Click on “New.”
  • On the next screen, name the tag “Facebook-Pixel-Base-Code.”
  • Go to Tag Configuration → choose “Custom HTML” as the tag type. Add your source code snippet in the available space.
  • To begin event tracking, go to Facebook → Business Manager → Events Manager → Pixels.
  • Click on “Create a Pixel” → add Pixel Name and Website URL → Click “Continue.”
    • This will show a screen as shown below. Choose “Manually Add Pixel Code to Website.”
    • You will see the source code. As you hover over the code, “Copy Code to Clipboard” will appear. Click that and the base code will be saved. Click “Continue” and this will finish installing the pixel base code.
    • Next, Facebook will recommend you visit the Event Setup Tool to track the actions of the visitors as you require.
  • Go back to “Google Tag Manager” → go to the “Custom HTML” tag and paste the source code that you copied in the previous step.
  • Click “Advanced Settings.” Choose “Once Per Event” under “Tag Firing Options.”
  • Under “Triggering,” select “All Pages.”
  • Save.

Testing Tags

The best part of GTM is that it provides a sufficient environment to test the tags before publishing so you can avoid errors.

  • To test the tags, first, install and enable Tag Manager Assistant. This is a very powerful tool you can use to test and debug all of the Google Analytics, AdWords, and DoubleClick tags.
  • Open your website in the same browser. Once the website loads, at the bottom of the page, the Tag Manager Assistant will show which tags are fired based on the trigger setup. E.g. if the trigger is “All Pages” for a particular tag, it should fire as the website loads.
  • To verify tags based on conversion actions, take conversion based testing actions. For example, to fill a form and submit, click CTA, put items in the cart, etc.
  • Click on the Tag Manager Assistant symbol in the browser and in the dropdown, check the status for all tags. Aim for achieving a green tag with a smiley face which indicates that there are no issues and it’s good to go! If the tag is red or yellow, check for issues and correct them.

There are different methods that can be used to verify that tags are working. You can find a detailed guide for this here.

Publishing Tags

Once the tags are tested and debugged, they’re ready to publish. Click on the red “Publish” button. Create a name for the version and add any description you need for future reference. Click “Publish”.

Topics: ,

Related Posts: