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 an AMP container
  • Add the Tag Manager snippet
  • Configure your container and publish
  • Page variables

Was this helpful?

  1. Google Tag Manager
  2. answer

AMP & Tag Manager setup guide

PreviousCustom tagsNextContent experiments for mobile apps

Last updated 5 years ago

Was this helpful?

The (AMP) is an open-source web platform that helps to improve the performance of your web content. AMP includes built-in support for Google Tag Manager. This document describes the recommended way to set up Google Tag Manager on AMP pages.

To install Tag Manager for AMP:

  1. an AMP container in Tag Manager.

  2. the Tag Manager snippet to your AMP pages.

  3. tags in your Tag Manager container and publish.

Create an AMP container

Tag Manager features an AMP container type. Create a new AMP container for your project:

  1. On the screen, click More Actions () for the account you'd like to use. Select Create Container.

  2. Name the container. Use a descriptive name, e.g. "example.com - news - AMP".

  3. Under Where to Use Container, select AMP.

  4. Click Create.

Your container is now ready. The next step is to install the Tag Manager code on your AMP pages.

Tag Manager will provide information on how to best install the code snippet, and you can refer to the for further guidance.

Add the Tag Manager snippet

After you create your new AMP container, the Install Google Tag Manager screen will appear. Tag Manager provides two code snippets. Copy these code snippets so that they appear on your AMP pages.

Note: To access the code snippets later, click the container ID number at the top of your workspace overview page, or click Admin and then Install Google Tag Manager.

The first snippet adds the amp-analytics component to your AMP page. This code is placed at the end of your page's <head> section, and should only appear once on the page.

<!-- AMP Analytics --><script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>

Important: Only add this code to your page if it does not already exist, and ensure it only appears once per page.

The second snippet configures amp-analytics to use Tag Manager. Place this code immediately after the opening <body> element. Replace GTM-CONTAINER_ID with your Tag Manager's container ID, or copy and paste the entire snippet from the Tag Manager user interface.

<!-- Google Tag Manager --> <amp-analytics config="https://www.googletagmanager.com/amp.json?id=GTM-CONTAINER_ID" data-credentials="include"></amp-analytics>

Configure your container and publish

When your pages have the container snippet correctly installed, they will be able to fire tags deployed from Tag Manager. The next step is to create tag configurations and publish the container.

To create a new tag:

  1. Click Tags New.

  2. Configure the tag with information provided by your tag vendor.

  3. Click Triggering and add one or more event conditions that will cause the tag to fire.

  4. Name the trigger and click Save.

Page variables

Tag Manager can capture AMP variables and use them in tag and trigger configurations. For instance, a page that sells shoes might have variables that describe the properties of a particular shoe. These values can be used to create Tag Manager variables:

<amp-analytics config="https://www.googletagmanager.com/amp.json?id=Tag Manager-XXXXXX;Tag Manager.url=SOURCE_URL" data-credentials="include"> <script type="application/json "> { "vars" : { "type": "shoes", "color": "red" } } </script> </amp-analytics>

To create a user-defined variable in Tag Manager that captures the color variable from the above code:

  1. Click Variables.

  2. Under User-Defined Variables, click New.

  3. Click Variable Configuration and select AMP Variable.

  4. In the Amp Variable Name field, enter the field name (e.g. "color".)

  5. Give the variable a descriptive name (e.g. "AMP Variable - color".)

  6. Click Save.

Was this helpful?

How can we improve it?

Click Tag Configuration and select the tag type from the list of .

Repeat these steps for any additional tag configurations. When your container configuration is ready, for the changes to take effect.

publish your container
Adobe Analytics
AT Internet
Burt
Chartbeat
Clicky
comScore
Custom image
Cxense
Floodlight
Google Ads
Google Analytics
Salesforce DMP (Krux)
LinkedIn
LinkPulse
Médiamétrie
mParticle
ÖWA
Parse.ly
Piano
Quantcast
Segment
SimpleReach
Snowplow
Webtrekk
Accelerated Mobile Pages Project
Accounts
Create
Add
Configure
next section
supported AMP tags