Content MarketingMarketing & Sales VideosMobile and Tablet MarketingSearch 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.

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

Douglas Karr

Douglas Karr is CMO of OpenINSIGHTS and the founder of the Martech Zone. Douglas has helped dozens of successful MarTech startups, has assisted in the due diligence of over $5 bil in Martech acquisitions and investments, and continues to assist companies in implementing and automating their sales and marketing strategies. Douglas is an internationally recognized digital transformation and MarTech expert and speaker. Douglas is also a published author of a Dummie's guide and a business leadership book.

Related Articles

Back to top button
Close

Adblock Detected

Martech Zone is able to provide you this content at no cost because we monetize our site through ad revenue, affiliate links, and sponsorships. We would appreciate if you would remove your ad blocker as you view our site.