AMP URL, Combine With Parent URL In Google Analytics

AMP URL Issues
Home » Blog » AMP URL, Combine With Parent URL In Google Analytics

I recently implemented Accelerated Mobile Pages (AMP) on my site using a WordPress plugin to take advantage of the rich snippets for SEO purposes. This resulted in a small issue with the AMP URL in Google Analytics reports.

I tried 3 different plugins but ultimately settled on WP AMP. One thing these plugins all had in common was that they leveraged a completely separate URL for the AMP pages.  For instance my sites home page is but the AMP URL might look like

amp traffic shown in google analytics
Amp Traffic Shown In Google Analytics

This didn’t bother me too much until I started looking at my Google Analytics reporting and seeing multiple URL flavors.  I like to keep a view in my analytics account that has all the filters I want applied so my reporting is showing the highest quality traffic estimates for a given piece of content. So, I decided to combine the AMP URL with it’s parent page using a filter and I will be sharing that information with you.

Setting Up The AMP URL Filter

To start with, open up your analytics account and open up the site you want to apply the filter to and then navigate to your preferred view.  If you’re new to views I recommend that you have at least 3 views.

I am applying this filter to the last of these views.  Next you’ll want to click on the admin section in the bottom left of the navigation.

Admin Google Analytics

Then you’ll want to click on the filters button on the right side of the navigation menus that fly out on the admin screen.

Filters Google Analytics

On the filters screen you’ll want to do several things.

  1. Change the filter type to “Custom”
  2. Change the custom filter type to “Search and Replace”
  3. Make sure the “Request URI” filter field is selected
  4. Add the regular expression search string. \/amp\/\z|\/amp$
  5. Add the replace string /
AMP Regex Filter

What this will do is look at your URLs and find URLS that end with “/amp” or “/amp/” and replace them with “/”.  The end effect is that all AMP URLs will be combined with their parent URL.  Let’s say you have hits like this in your analytics currently.

  • /page/amp (5 hits)
  • /page/amp/ (5 hits)
  • /page (5 hits)

In the future your analytics will show all your hits across the 3 distinct URLs rolled up into one. Keep in mind that filters only apply to future traffic so your historical reports from before the filter was applied will still show the duplicate URLs.

  • /page (15 hits)

You can see the example in the filter verification screenshot below.

For me this simplifies analysis of traffic data considerably.  You can still view traffic segmented by Desktop/Tablet/Mobile so you can still get an understanding of volume of users hitting amp pages because they will simply be the mobile segment.  

Posted in:

Hunter Nelson

Hunter has more than 10 years’ experience in the software industry building and configuring software for companies such as American Express, Black Knight, Homes & Land, Verizon and more. Hunter earned his bachelor’s degree in Information Technology from Florida State University in 2009 and began his career consulting for Accenture out of the New York City office. After accruing significant experience working with Fortune 500 Clients on complex software projects as an analyst, he discovered his love for coding and building software. While practicing the craft he earned an MBA from Florida State in 2017. In 2018 he founded Tortoise and Hare Software to begin providing business value in digital consulting engagements to small and medium sized businesses and helping them along in their journey toward the Fortune 500. See LinkedIn for more.

Leave a Comment

Up Next

Google Ads Case Study For An ECommerce SaaS Provider (In Depth)

By Hunter Nelson | July 19, 2020

In this post we’re going to walk through an eCommerce SaaS google ads case study. We’ll walk you through how we took one lucky eCommerce software as a service (SaaS) provider with a 5 figure monthly ad budget, from being a company with account maintenance challenges, room for improvement on their returns, and questions on…

IT Company Digital Marketing Case Study

By Hunter Nelson | April 13, 2020

In today’s post we’re going to be talking about an IT company digital marketing case study. NetTech Consultants is a Jacksonville based IT company or Managed Service Provider as they’re commonly known as in the IT world. Back before coronavirus there was this thing called a “trade show” where large groups of people would get…

High Bounce Rate? Digital Marketing is a Game of Inches

By Hunter Nelson | September 19, 2019

One of the first metrics people are going to look at when they start toeing the waters of web analytics is their bounce rate. If you’re just getting started on your journey to building an inbound pipeline chances are you’re suffering from high bounce rate and your trying to bring it down. In this article…