ad-sense-amp-example.png#asset:322:post

WordPress powered sites are getting recommendation by AdSense to support AMP(Accelerated Mobile Pages), you can see this recommendation in the Google AdSense Dashboard.

AMP regulation for designing mobile optimized version of any given page, where the stylesheet is inserted in the page itself  inside the head tag and  loading of scripts and media are done async. You can read the documentation to understand. It improves the performance on mobile devices that are running on 3G or slow internet connection.

Google offers AMP search result to mobile devices on slow network, you could still access these pages by adding /amp to your post url (example).

What made me happy and accept this change was Automattic official AMP plugin.


Steps to install AdSense in AMP plugin

Go to Plugins > Installed Plugins > AMP

Click edit (near "deactivate")

Choose single.php(amp/templates/single.php) in the right files sidebar.

Insert the following snippet wherever you prefer having the ad show up, with the required changes.

If you find the above complex you can replace the contents of single.php by replacing the contents with the snippet below

I have made a simplified version of this, all you need to do it add your publisher id and you Ad slot to the variables.

Hit Update File, and the changes should take place immediately.

If you have any issues with this leave a comment below, feedback is always accepted.