Knowledge Base
  • Chào mừng bạn tới trang hỗ trợ sản phẩm của chúng tôi !
  • Page Site Builder
    • Bắt đầu tạo một trang web
      • Thêm một section
        • Sao chép section
        • Cài đặt section
        • Di chuyển section
      • Thêm một page
      • Thêm kết nối SSL
  • HubSpot CRM
    • crm-setup
      • Get started with objects
    • contacts
      • Create contacts
      • A guide to your contacts home
      • Work with your contact records
      • HubSpot's default contact properties
      • Property field types in HubSpot
      • Set up your import files
      • Import data to checkbox properties
      • Manage your properties
      • Import contacts, companies, deals, tickets, products, or notes
      • View and analyze previous imports
      • Troubleshoot import errors
      • Deduplicate contacts, companies, deals, tickets, and products
    • companies
      • Create companies
      • A guide to your companies home
      • Work with your company records
      • HubSpot's default company properties
    • deals
      • Create deals
      • A guide to your deals home
      • Work with your deal records
      • HubSpot's default deal properties
    • tickets
      • Create tickets
      • Work with your ticket records
      • A guide to your tickets home
      • HubSpot's default ticket properties
  • Google Ads
    • Topic
      • Setup and basics
      • Measure results
      • Manage ads
      • Smart campaigns
      • Billing
      • Learn
      • Google Partners
      • Your guide to Google Ads
      • Google Ads basics
      • Create ads and campaigns
      • Choose where and when ads appear
      • Find out if your ad is running
      • Account administration and security
      • Glossary
      • Local Services ads
      • The Google Ads mobile app
      • Ads and approvals
      • Campaign settings
      • Budgets and bids
      • Keywords
      • Reach your audience
      • Target placements and topics
      • Multiple or large accounts
      • Connect your goals to data
      • Find and run reports
    • Google Ads Help
  • Google Analytics
    • answer
      • Get started with Analytics
      • Find your way around Analytics
      • Guided tours
      • Manage and configure Analytics
      • Hierarchy of organizations, accounts, users, properties, and views
      • Diagnostics messages
      • How to get support
      • Google Marketing Platform Partners
      • Introducing Google Marketing Platform
      • Organizations
      • Google Analytics Home
      • Search in Google Analytics
    • Topic
      • Set up (web)
      • Set up (mobile apps)
      • Universal Analytics (UA)
      • Glossary
      • Troubleshoot Analytics problems
      • Understand the Analytics account structure
      • Accounts
      • Properties
      • Reporting views
      • Reporting-view filters
      • User management
      • Common issues
      • Monitor account health and performance
      • Audience reports
  • Google Tag Manager
    • answer
      • Tag Manager overview
      • Considerations before you install
      • Setup and install Tag Manager
      • Tag Manager and gtag.js
      • Introducing Google Marketing Platform
      • The data layer
      • Components of Google Tag Manager
      • Supported tags
      • Conversion linker
      • Google Optimize
      • Custom tags
      • AMP & Tag Manager setup guide
      • Content experiments for mobile apps
      • Custom templates
      • Community Template Gallery
      • Google Marketing Platform Partners
      • Data Processing Amendment
    • Topic
      • Tags
      • Triggers
      • Variables
      • Google Analytics
      • Google Ads
      • Floodlight
      • Accounts
      • Workflow
      • Organization
      • Troubleshooting
Powered by GitBook
On this page
  • Components of Google Tag Manager
  • Triggers and variables
  • Variables and the data layer
  • Data layer implementation scenarios
  • Related resources

Was this helpful?

  1. Google Tag Manager
  2. answer

Components of Google Tag Manager

Search

Clear search

Close search

Google apps

Main menu

Send feedback on...

This help content & information

General Help Center experience

Components of Google Tag Manager

Understand how tags, triggers, variables, and the data layer work together.

Google Tag Manager uses these concepts to handle how tags are configured and fired:

  • Tag: A tag is code that send data to a system such as Google Analytics.

  • Trigger: A trigger listens for certain events, such as clicks, form submissions, or page loads. When an event is detected that matches the trigger definition, any tags that reference that trigger will fire.

  • Variable: A variable is a named placeholder for a value that will change, such as a product name, a price value, or a date.

  • Data layer: Tag manager implements a data layer to temporarily hold values in the client so that they can be used by tags, triggers, and variables.

In this article we will explore how these concepts work together.

If you don't use a tag management solution, the code for each tag is added directly to the source code. With Tag Manager, you instead control all of your tags from a web user interface.

Triggers and variables

  • Event: Page View

  • Trigger Type: Page View

  • Fire On: Some Page Views

    • Fire the tag when these conditions are true: URL contains example.com/purchase/receipt.html

Configure built-in variables or custom variables to make information available to your application when you need it. Use these variables in trigger conditions or to pass information to tags.

Variables and the data layer

You don't necessarily need to set up a data layer in order for variables to retrieve information. Tag Manager Variables can also be configured to retrieve values directly from JavaScript variables, first-party cookies, from the DOM. However, the best practice is to have your variables retrieve information directly from a well-organized data layer object. A data layer implementation can minimize the likelihood of data loss from inadvertent code changes, encourage a well organized and accessible data model, and simplify troubleshooting.

Note: For web applications, every page must have code that adds the needed information onto the data layer. The data layer does not automatically persist across pages.

Data layer implementation scenarios

Consider these points help you decide if a data layer implementation is right for your needs:

  • If your tags only need to fire when pages load (i.e. they don't need to fire in response to user interactions on the page) and the tags don't need any information beyond URL and referrer, you only need to add the container snippet to each page of your site. A data layer implementation is probably not necessary.

  • If your tags only need to fire when pages load, but need information beyond URL and referrer (such as the page type or user ID), you may need to add code that creates a data layer and pushes information to it.

Related resources

Was this helpful?

How can we improve it?

PreviousThe data layerNextSupported tags

Last updated 5 years ago

Was this helpful?

A is a snippet of code that executes on a page or mobile app. Tags can serve a variety of uses, but most of the tags used in tag management systems are designed to send measurement information from your site to a third party. Examples include the and the .

Tags execute, or fire, in response to events. Events could be page loads, button clicks, page scrolls, etc. In Tag Manager, you define to listen for those events and specify when tags should fire.

Tag Manager has many to choose from, and you may configure additional . For example: the predefined variable "url" contains the address of the currently loaded page. If you want a tag to fire only on the page example.com/purchase/receipt.html, define a trigger with these settings:

The is used to temporarily hold data. It is a structured format that is understood by Tag Manager to make it easy for you to move that data from your web page or mobile app to tags, triggers, and other variables in Tag Manager.

If the data you wish to use isn't available until after the user has interacted with the page, you will need to add code that , and then you will have to configure Tag Manager to leverage the data layer when the desired events occur.

tag
Google Analytics tag
Google Ads conversion tag
triggers
built-in variables
custom variables
data layer
pushes data to the data layer
About tags
How triggers work
Variables
Developer Guide