Content MarketingMarketing & Sales VideosMobile Marketing, Messaging, and AppsPaid and Organic Search Marketing

Accelerated Mobile Pages are a Must, But Don’t Forget Analytics!

This last month I’ve been working with a client that’s seen a noticeable decline in organic search traffic over the last year. We’ve fixed quite a few issues with the site that could impact rankings; however, I was missing one key factor in reviewing their analytics – Accelerated Mobile Pages (AMP).

What is AMP?

With responsive websites becoming the norm, the size and speed of mobile sites is greatly impacted, often slowing down the sites and providing user experiences that aren’t uniform. Google developed AMP to correct this, significantly pairing down the pages to have a similar look and feel and significantly less size; therefore, providing a similar user experience and outstanding page speed for organic search engine users. It’s a format that competes with Facebook Instant Articles and Apple News.

Sites with AMP configured are seeing three to five times the organic traffic they were seeing without the format, so I highly recommended that you integrate AMP immediately. Some people were complaining that AMP sites are displayed via Google’s URL on a mobile device, something that could negatively impact linking and sharing. Google has responded by offering a direct link to the article as well. I honestly believe the benefits far outweigh the risks.

The AMP Project: English Introduction to AMP

If you’re utilizing WordPress, Automattic released a very robust WordPress AMP plugin that outputs the appropriate format and applies the necessary permalink path. As an example, you’ll see that this article is at:

https://martech.zone/accelerated-mobile-pages/

And the AMP version of the article is available at:

https://martech.zone/accelerated-mobile-pages/amp/

I implemented AMP quickly on my site and many of my clients, but neglected to notice one critical issue. The AMP plugin didn’t support third-party Analytics integrations like Google Analytics. So, like my client, we were getting quite a bit of organic traffic going to our AMP pages but not seeing any of that traffic in Google Analytics. The decline we were seeing wasn’t a decline at all, it was just Google indexing and displaying our AMP pages instead. Very frustrating!

How to manually implement Google Analytics with WordPress AMP

The difficult means of implementing Google Analytics with AMP is to add code in your theme’s functions.php file that inserts the necessary JavaScript in your header and the call to Google Analytics in the body of your AMP page. Your header script:

add_action('amp_post_template_header','amp_custom_header');
function amp_custom_header($amp_template) {
?>
<script async custom-element="amp-analytics"
src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
<?php
}

Then your body script for adding your call to Google Analytics (be sure to replace UA-XXXXX-Y with your analytics account identifier:

add_action('amp_post_template_footer','amp_custom_footer');
function amp_custom_footer($amp_template) {
?>
<amp-analytics type="googleanalytics">
<script type="application/json">
{
"vars": {
"account": "UA-XXXXX-Y"
},
"triggers": {
"trackPageview": {
"on": "visible",
"request": "pageview"
}
}
}
</script>
</amp-analytics>
<?php
}

How to easily implement Google Analytics with WordPress AMP

The easier way to implement Google Analytics with WordPress AMP is to utilize the following three plugins:

  1. WordPress AMP
  2. Yoast SEO
  3. Glue for Yoast SEO & AMP

The Glue for Yoast SEO & AMP plugin let’s you both modify the look and feel of your AMP output as well as add the Analytics code snippet (above for the body) directly into the plugin settings.

Glue Yoast SEO AMP Analytics

How to Test Your AMP Page

Once you’ve fully implemented AMP, be sure to utilize Google’s AMP Test to ensure you don’t have any format issues.

Test my AMP Page

Your result of testing should be:

Valid AMP Page

Appreciate this content?

Sign up for our weekly newsletter, which delivers our latest posts every Monday morning.

We don’t spam! Read our privacy policy for more info.

Douglas Karr

Douglas Karr is a fractional Chief Marketing Officer specializing in SaaS and AI companies, where he helps scale marketing operations, drive demand generation, and implement AI-powered strategies. He is the founder and publisher of Martech Zone, a leading publication in marketing technology, and a trusted advisor to startups and enterprises alike. With a track record spanning more than $5 billion in MarTech acquisitions and investments, Douglas has led go-to-market strategy, brand positioning, and digital transformation initiatives for companies ranging from early-stage startups to global tech leaders like Dell, GoDaddy, Salesforce, Oracle, and Adobe. A published author of Corporate Blogging for Dummies and contributor to The Better Business Book, Douglas is also a recognized speaker, curriculum developer, and Forbes contributor. A U.S. Navy veteran, he combines strategic leadership with hands-on execution to help organizations achieve measurable growth.

Related Articles

Back to top button
Close

Adblock Detected

We rely on ads and sponsorships to keep Martech Zone free. Please consider disabling your ad blocker—or support us with an affordable, ad-free annual membership ($10 US):

Sign Up For An Annual Membership