How to Add Google Tag Manager to Magento 2 AMP Pages

In this article, you will learn how to integrate Google Tag Manager into Magento 2 AMP extension. Google Tag Manager allows you to easily configure and deploy tags on your AMP pages, including tags from Google Ads, Google Analytics, Floodlight, and 3rd parties. Please follow the steps below to integrate Google Tag Manager correctly.

How to Create AMP Container in Google Tag Manager

Step-by-step guide:

  1. Create an account at tagmanager.google.com or use an existing Google Tag Manager account. 
  2. Follow the official guide and create an AMP container in Google Tag Manager.
  3. After you create your new AMP container, the Install Google Tag Manager screen will appear. There, Google Tag Manager provides you with two code snippets.
  1. Copy and paste the code to the Snippet field of the Magento 2 AMP Extension configurations in Magento admin panel.
  2. Do not perform any action on this code, as it will be automatically added to your Magento 2 AMP pages.
google tag manager tag snippets.png

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.

You may also use the official guide to configure tags in your Tag Manager container and publish it for the changes to take effect.

How to Integrate Google Tag Manager With Magento 2 AMP Extension

In the main Magento menu, go to the Plumrocket -> AMP -> Configuration, and scroll down to Integrations -> Google Tag Manager.

Step-by-step guide:

  1. Enable: set to Yes to enable Google Tag Manager on your AMP pages.
  2. Snippet: paste the code from your Google Tag Manager account. You can access the code snippet by clicking the container ID number at the top of your workspace overview page, or click Admin and then Install Google Tag Manager.
magento 2 amp extension google tag manager integration configuration 5.png

Google Tag Manager integration with the Magento 2 AMP extension is now completed.

AMP Integrations Supported by Google Tag Manager

Was this article helpful?