How to Track AMP Pages in Google Analytics
Do you wish to learn more about tracking AMP pages in Google Analytics? AMP is an acronym for Accelerated Mobile Pages. It’s an open source initiative to boost user experience on the internet by making web pages fast and mobile friendly. Google contributes to this initiative. I decided to write this article after encountering problems following a shift to AMP for this website.
After setting up everything, I discovered that my website’s metrics were no longer showing up in Google Analytics (GA). It soon became clear that tracking for AMP pages and regular pages is different in analytics. This article aims to make life easy for others who may be in my situation. Really, the solution is simple, but it took me an entire day to arrive at it. Below is a summary of the steps that you need to take to enable tracking for AMP pages in Google Analytics. Click on the links to jump to the relevant sections;
Steps to Set Up Google Analytics for AMP Pages
The following is how to track AMP pages in Google Analytics;
- Install the official AMP plugin for WordPress
- Choose a Template Mode. We chose the Standard mode, meaning ALL our traffic will become AMP.
- Go to Analytics in the AMP plugin’s Advanced Settings.
- Choose analytics type and enter your Google Analytics tracking ID Here, you need to choose googleanalytics under type and then enter your tracking code.
- Now you can save your changes and go back to Google Analytics. You will see that your AMP traffic is now being tracked.
Our set up
Just to give you brief information about my setup; my website runs on WordPress. All along, I had been tracking my stats using Google Analytics (GA).
I used to use Jetpack, but discovered a while back that it was significantly slowing down my site. Something to do with it having too many modules, probably.
Moving over to AMP
Anyway, a few days ago, I impulsively decided to move over to AMP. Perhaps not impulsively; Search Console had been nagging me with messages about how I could benefit from the move. So, I decided to download the official AMP plugin.
All that you need to do to get going is to install the plugin. It’s really an easy process. Once that was done, I then waited an hour or so before going to Analytics to see if everything was still okay. To be honest, I expected an immediate boost in traffic. A bit unrealistic, I know.
Imagine my shock, therefore, upon discovering that I no longer had even a single bit of traffic. My figures had dropped to absolute zero! I thought maybe I had broken something during the move to AMP.
However, after a bit of Googling, I discovered that there is need to make some changes in Analytics following a move to AMP. Tracking does not continue as if nothing has happened. That is where I hit a brick wall. There is really very limited information out there about how to make the transition less painful.
What were the problems?
The issues that I encountered were multi-fold. First, I discovered that I needed to create a new analytics property for tracking AMP pages. That’s the advise that you get from Google. They say you should not track AMP and non AMP pages at the same time.
So, I decided to create a new property as advised. Unfortunately, Google has moved over to Analytics 4. That’s probably one of the reasons that I ended up spending a day or so trying to solve the issue of tracking AMP pages in Google Analytics.
GA4 does not yet work for AMP. That caused me a lot of grief. I was trying to use the GA4 code on the Google Analytics plugins that I was installing and discarding on my site. The result was complete failure. So, how did I solve this issue?
Tracking AMP Pages in Google Analytics Solution
This is one of those things where you spend days trying to solve a problem, only to realize that the solution was in front of your all along. So, I will show you in this article how to track amp in Google Analytics.
1. Install the official AMP plugin for WordPress
Tracking AMP pages in Google Analytics begins with the installation of the official AMP plugin. If you go to Plugins on your WordPress dashboard, you will see the plugin that I am talking about.
This plugin is the one that’s supported by Google. If you have chosen a different plugin, this solution to tracking AMP pages in GA will still work. So, keep reading.
2. Choose a Template Mode
Once the plugin has been installed and activated, you will be required to choose your template mode. This is important, and it’s another reason why I had issues. You have three template modes to choose from; Standard, Transitional and Reader;
Standard Mode
Under this mode, all your content becomes AMP. You only have a single theme and that will be used on both desktops and mobile devices. That’s the option that I went with. And it’s the recommended option if you really wish to go all out on AMP.
Unfortunately, it also means you will be getting absolutely no data in your Google Analytics. That’s because all your pages will now be AMP, while your GA will be configured for regular pages. It’s what happened to me.
Transitional mode
You can also opt for the transitional mode. This mode is for those looking to ease their way into AMP as opposed to jumping in as I did.
In this mode, you will have 2 sets of URLs, one for AMP and another that’s non AMP. This is the recommended mode if there are plugins on your site that are not AMP compatible.
Reader mode
In reader mode, you will essentially be using two themes, one that’s AMP and another that’s non AMP. This mode is not recommended.
3. Go to Analytics under Advanced Settings
This is where I took the wrong turn. As you can see in the screenshot below, there is an Analytics section in the AMP plugin’s Dashboard. It’s under Advanced Settings. I clearly saw that it was there, but I didn’t take it to mind. Off I went looking for another plugin to enable me to get GA tracking for my AMP pages.
So, you need to go to Advanced Settings in order to start tracking AMP pages in Google Analytics. You can see what I am talking about in the above screenshot. Click on the plus sign to further expand the section.
4. Choose your vendor
Now you need to choose the vendor for the analytics tool that you are using. Currently, a number of vendors are accepted. These include Acquia Lift, Adobe Analytics, Baidu Analytics, Facebook Pixel and many more. You can get the complete list here.
For this example, we will be doing our tracking through Google Analytics. So, we will choose the googleanalytics. That immediately brings up a piece of code that we need to modify to start tracking our AMP traffic in Google Analytics.
5. Enter your Google Analytics Tracking ID
Now you will need to enter your Google Analytics tracking ID. This is where I was making a mistake. I was entering the tracking ID for my GA4 property. That won’t work.
If you are creating a new property, it needs to be in the old UA-XXXXX format. As mentioned earlier, Analytics does not yet have GA4 tracking for AMP pages.
6. Save your changes and start tracking AMP pages in Google Analytics
Now, the only thing that remains to be done is to save your changes. Once that is done, wait a few minutes and go back to Google Analytics. You will now notice that your AMP traffic is now being tracked in Google Analytics.
Should I create a new GA property?
We noted earlier that you are advised to create a new GA property for your AMP traffic. That way, you will be monitoring both AMP and non AMP pages. However, we decided against this for the simple reason that the Standard mode that we went with is all out AMP.
It means even somebody accessing our site from a desktop will be getting AMP pages. So, what would be the reason for having separate tracking? But it’s really up to you.
If you have chosen the Reader mode, you will want to create a new property. Even the Transitional mode requires that you do so because some of your traffic will be non AMP.