AMP URL, Combine With Parent URL In Google Analytics

AMP URL Issues
Home » Blog » AMP URL, Combine With Parent URL In Google Analytics
Table of Contents
    Add a header to begin generating the table of contents

    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 https://tortoiseandharesoftware.com/ but the AMP URL might look like

    https://tortoiseandharesoftware.com/amp
    or
    https://tortoiseandharesoftware.com/amp/

    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.  

    Hunter Nelson

    Hunter is the founder and president of Tortoise and Hare Software, a digital marketing agency for B2B technology companies. Hunter has more than 10 years’ experience building web applications and crafting digital strategies for companies ranging from scrappy startups to Fortune 50 household names. When not on the clock, you'll find him spending time with his family and pups, relaxing on the beach, or playing competitive online video games. See LinkedIn for more.

    4 Comments

    1. Bros on February 1, 2021 at 2:02 pm

      Hey, how can I do this when my URL is “/?amp”, e.g. “www.mysite.com/page/?amp”?

      • Hunter Nelson on February 1, 2021 at 5:10 pm

        I recommend checking out https://rubular.com/ for specific regular expressions to build. I haven’t tested this, so take it with a grain of salt, but this regular expression would match /?amp and /?amp/

        \/\?amp\z|\/\?amp\/\z

        Always test a filter in a test view before applying to any production view!

        • Bros on February 11, 2021 at 3:11 pm

          Hi, what do you mean with this test view? I can’t find one in Anayltics. Or you mean an only for this created website?

    Leave a Comment





    Table of Contents
      Add a header to begin generating the table of contents

      Free Email Course:
      Launching Your B2B Digital Marketing Program

      Enroll in our free digital lead generation crash course. A 60 day email series with twice a week emails walking through the journey of how to launch your digital marketing program and generate more B2B leads from your website. Unsubscribe at any time.

      Recent Posts
      msp marketing guide to 5 million+ ARR

      MSP Marketing Guide To 5 Million+ ARR

      In this guide we’re going to talk about how you can use MSP marketing to generate enough pipeline to get to 5 million plus in annual recurring revenue. A lot of the things we’ll talk about in this guide can be used in larger and smaller businesses but for the purposes of this guide we’ll…

      multi arm bandit

      Multi Arm Bandits And PPC Machine Learning

      In today’s post, we’re going to be talking about a common PPC machine learning algorithm of which some variant is leveraged in part by many pay per click platforms called a multi arm bandit. We’ll talk about how they compare to simple A/B tests and why understanding the types of algorithms these platforms use is…

      online lead generation tips for msps

      Top Online Lead Generation Tips For MSPs

      According to industry research by a leading managed service provider marketing firm, 94% of MSPs self-reported lead generation as their number one challenge when it comes to growing their MSP. There’s no question that the vast majority of MSPs struggle with lead generation, especially in the earlier years of their business. It makes sense, most…

      Top Content
      sample brand kit

      Branding Your MSP: How To Get Started

      Throughout the process of launching and running Tortoise and Hare Software these past 3-4 years there’s one thing that I’ve gotten consistently good feedback on. The brand! People who aren’t shopping for marketing, and have no relationship to the company will regularly come up to me at trade shows, or comment on my business card,…

      msp paid search campaigns

      The Ultimate Guide To Paid Search On Google Ads For Managed Service Providers

      Generating leads for your MSP can be a challenge. You spend so much time managing employees, making sure customer support tickets are answered, procuring hardware, and defending against cyber threats, there’s hardly time to worry about networking and doing things like posting on social media. However, you’d like to grow faster, and due to some…

      msp seo ultimate guide

      The Ultimate Guide To MSP SEO

      Search Engine Optimization (SEO) is one of the most important ways to attract new business for mid-market managed service providers (MSP). If you look at MSPs that have achieved any sort of meaningful scale and grown to the 10MM ARR mark and beyond, you will almost always see a significant portion of their growth came…

      About Us

      Tortoise and Hare Software is a boutique B2B tech marketing agency. We help companies like MSPs, SaaS providers, cybersecurity firms, and other technology service providers launch their digital marketing programs and generate inbound leads.