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. Please follow the quick guide below on how to get a Measurement ID and set up Google Analytics for your Magento store.

Where to Get Google Analytics Measurement ID

In order to integrate Google Analytics into your AMP pages, you need to get your Measurement ID and paste it into Magento 2 AMP Extension backend. Please follow the steps below to find Google Analytics Measurement 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 Data Streams.
How to get Google Analytics Measurement ID

Afterward, you will be redirected to the Data Streams page, where all the configured data streams are displayed.

How to get Google Analytics Measurement ID

Step-by-step guide:

  1. Select the desired stream, and copy the Measurement ID under the “Stream details”.
How to get Google Analytics Measurement ID

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. Analytics Version: choose the Google Analytics version which will be used (Google Analytics V4 is described in the documentation).
  3. Tracking ID (Account Number): insert your Google Analytics Measurement ID code in this field.
  4. Click Save Config to apply settings.
Magento 2 AMP Extension - Google Analytics Integration

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

Was this article helpful?