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
  • Create a new account and container
  • Add a new container to an existing account
  • Install the container
  • Add, update and publish tags

Was this helpful?

  1. Google Tag Manager
  2. answer

Setup and install Tag Manager

PreviousConsiderations before you installNextTag Manager and gtag.js

Last updated 5 years ago

Was this helpful?

Install Google Tag Manager to configure and deploy tags, including tags from , , , and . At a high level, the steps are:

  1. , or use an existing account, at (A new container is created by default, and you can create additional containers within each account.)

  2. in your website or mobile app.

    1. For web and pages: Add the container snippet as instructed by Tag Manager, and remove any existing tags.

    2. For mobile apps: Use the Firebase SDK for or .

  3. .

A Tag Manager account represents the topmost level of organization. Typically, only one account is needed per company. A Tag Manager account contains one or more containers, and there are specific container types that may be used for websites, AMP pages, Android apps, and iOS apps.

Create a new account and container

  1. In Tag Manager, click Accounts Create account.

  2. Enter an account name and optionally indicate whether you'd like to share data anonymously with Google and others.

  3. Click Continue.

  4. Enter a descriptive container name and select the type of content: Web, AMP, Android, or iOS. If setting up a mobile container, select whether you're using the Firebase SDK or one of the legacy SDKs.

  5. Click Create.

  6. Review the Terms of Service and click Yes if you agree to those terms.

When your new container first loads, you will be prompted with the web container installation code snippet, or to get started with Tag Manager as part of the SDK for your chosen mobile platform. You can your code snippets now, or click OK to clear this dialog. You can always set up your container first and install the container snippet or SDK later.

Add a new container to an existing account

  1. In Tag Manager, click Accounts next to the relevant account name.

  2. Choose Create Container.

  3. Repeat steps 4–6, listed above.

Install the container

  1. In Tag Manager, click Workspace.

  2. Near the top of the window, find your container ID, formatted as "GTM-XXXXXX".

  3. Click your container ID to launch the Install Tag Manager box.

  • Place the <script> code snippet in the <head> of your web page's HTML output, preferably as close to the opening <head> tag as possible, but below any dataLayer declarations.

  • Place the <noscript> code snippet immediately after the <body> tag in your HTML output.

To ensure that tags do not fire twice, remove from your code any hardcoded tags that have been migrated to your Tag Manager container.

To help protect your container from 3rd party snooping, the Tag Manager web page snippet uses HTTPS by default.

  • Place the <script> portion of the JavaScript snippet just above the closing </head> tag.

  • Place the <amp-analytics> section immediately after the opening <body> element.

Add, update and publish tags

Now that a container is installed, you're ready to add new tags.

    • To add a tag: Click New. Select the tag type and specify triggers for when the tag should fire.

    • To edit a tag: Click a tag in the list and make changes on the "Edit Tag" page. For example, you might update the triggers for when the tag should fire.

    • To delete a tag: Click a tag in the list. On the "Edit Tag" page, click the menu in the upper right corner of the screen and choose Delete.

  1. Preview mode gives you an opportunity to inspect your Tag Manager configuration on your site or app to make sure everything behaves as expected. On the web, you can use the debug option to see which tags fire as you browse and interact with the site.

  2. When you're ready, click Submit in the upper-right corner of the screen to begin publishing your changes. Add details such as a Version Name and Version description, then click Publish.

Was this helpful?

How can we improve it?

If you are not experienced with code or do not have access to your website or mobile app code, you may need to enlist the assistance of a developer for this step. Developers can learn more at the .

Copy and paste the code snippets into your website as instructed in the Install Tag Manager box, or download and install the appropriate mobile SDK. See below for tips on , , and installation.

If you have reason to deploy your Tag Manager containers in a way that supports non-secure pages, you may do so by adjusting the source URL protocol in your container snippet to // instead of https://.

Read the for more information.

Implementation of Tag Manager for mobile apps is done in conjunction with the . Visit the Tag Manager developer documentation to learn how to get started with and .

Click from the navigation menu.

From any web page in a workspace with unpublished changes, click Preview. .

For mobile apps, read the developer documentation for and .

Most Tag Manager implementations start with a Google Analytics page view tag deployment. Get step by step instructions for how to .

Tag Manager Developer Quick Start Guide
Web pages
Learn more about using protocol-relative URLs.
AMP pages
AMP & Tag Manager setup guide
Mobile apps
Firebase SDK
Android
iOS
Tags
Learn more
Android
iOS
deploy a Google Analytics tag
Install the Google Tag Manager container snippet
Google Ads
Google Analytics
Floodlight
3rd parties
tagmanager.google.com.
AMP
Android
iOS
Create an account
Install the container
Add and publish your tags
install
web
AMP
mobile