How To Display AdSense Ads On WordPress AMP Pages Easily

AdSense publishers are aware that ads do not display on AMP pages even after adding up adsense codes manually or using Auto ads. It is also very disheartening to adsense publishers after having their blog post on first page of search engines but looking closer to the boosted post, they found out that AMP did its work by bringing it there to first page.

This can make one lose a couple of dollars online. Thankfully, we can now display adsense ads on AMP pages easily on WordPress. How? This tutorial will lead you to your destination.

But for some who can’t or don’t recall what AMP is and its work, here is just a recap of AMP:

“AMP is an abbreviation given to Accelerated Mobile Pages which is an open-source project that revolutionized the way we browse websites on mobile devices. The websites that use this technology have web pages that load instantly without any page loading delays what so ever.”

Now, let’s continue on how to implement ads on AMP pages in WordPress easily. You can easily display ads on AMP pages using several plugins. However, many of them come at an extra cost – but you don’t have to spend a dime to get this done – It’s not as difficult as you imagine.

For us to display ads on our AMP pages, we’ll make use of an available tool on our adsense dasboard known as Auto Ads. This Auto Ads when enabled allows google display series of ads everywhere automatically on your site except the AMP pages.

Check Out:  How to Add A Donation Button On Your WordPress Site

Also, if you are very observant on your adsense dashboard, you’ll get to see a feature added newly which is under “Optimizations >> Lab”.

The new feature found there is known as the “AMP Auto Ads”.

• The first step you need to take is to turn on this feature on your adsense dashboard just like the one above.

• After which, you’ll be taken to the next place where you’ll be given two codes where the first one will be on your header and the second on the body of the AMP page.

We are going to do a little coding now…

Head over to your WordPress dashboard and select Appearance >>> Editor >>> Function.php file.

Here we will use hooks, header action hook as amp_post_template_head & footer action hook as amp_post_template_footer. Make sure you use a child theme (Recommended).

Replace //Your Header/Footer code with AMP Ad’s Header/Footer Code in the code below

Add this snippet below to your theme’s functions.php file

// Adding Header Code in AMP pages in WordPress
function wroffle_amp_my_custom_head($amp_template) {
//Your Header Code



Similarly, add the snippet below to your theme’s functions.php

//Adding Footer Code in AMP pages in WordPress
function wroffle_amp_my_custom_footer($amp_template) {
//Your Footer code


Remember to replace //Your Header Code with the first code copied from your adsense dashboard and //Your Footer Code with the second code copied too.

Save and allow up to 5minutes to integrate.

About the author

Alvin Uchenna

A Passionate Blogger With A Keen Eye In Helping People To Develop, Design And Monetize Their Blogs.


Leave a Comment

%d bloggers like this: