How to Add Google Analytics to Magento 2 AMP Pages

In this article, you will learn how to integrate Google Analytics into Magento 2 AMP Extension. Please follow the steps below to configure it correctly.

First, you need to log in to your Analytics account. You can use the same account for your AMP pages or create a new one. If you do not have a Google Analytics account yet, or you want to create a new one, please follow the official guide on how to create a Google Analytics account.

Next, make sure to set up a property in Google Analytics for the website you want to collect data for. Note that it is important to have a Universal Analytics property.

Please follow the quick guide below on how to get Tracking ID and set up Google Analytics for your Magento store.

Where to Get Google Analytics Tracking ID

In order to integrate Google Analytics into your AMP pages, you need to get your Tracking ID and paste it into Magento 2 AMP Extension backend. Please follow the steps below to find Google Analytics Tracking ID.

Step-by-step guide:

  1. Log in to your Google Analytics account and click Admin.
  2. Select an account from the menu in the Account column.
  3. Select a property from the menu in the Property column.
  4. Under Property, click Tracking Info > Tracking Code.
google analytics tracking id 1.png

Afterward, you will be redirected to the Website Tracking page. Your Tracking ID code is displayed at the top of the page. Copy the Tracking ID code to paste it later in the configuration step.

google analytics tracking id 2.png

How to Integrate Google Analytics With Magento 2 AMP Extension

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

Step-by-step guide:

  1. Enable: set to Yes to enable Google Analytics on your AMP pages.
  2. Tracking ID (Account Number): insert your Google Analytics Tracking ID code in this field.
  3. Click Save Config to apply settings.
magento 2 amp extension google analytics integration configuration.png

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

Was this article helpful?