How to display Google Adsense AMP ads on AMP Website / WordPress website

The benefits of showing Google Adsense Auto ads on AMP compatible pages are,

  • Auto ads for AMP automatically place and optimize the ads for you so you don’t have to spend time doing it yourself.
  • Auto ads for AMP analyze your AMP pages and find new places to show ads based on your layout, content, and existing AMP ads.
  • You place the same script and code once on each page that you want Auto ads for AMP to show. Google takes care of the rest.

For enabling Auto Ads for AMP, login to your google adsense account and from left sidebar, click on “Auto Ads” and from opened window, “Auto Ads for AMP” this will show the page as below,

From this, turn ON the display ad format as we can see in above image.

Once you enabled Ad formats, you will get the code like below, for pasting on head tag of your website, as below,

<script async custom-element="amp-auto-ads"

After this is done, copy and paste code shown just below above code which consists your adsense ID to body tag of your website as,

<amp-auto-ads type="adsense"

That’s it, you have to do this only once on all the pages where you want to show the ads.

For WordPress, this needs to be done only one.

you can place the code required to be pasted to head by modifying wp-content/themes/your_theme/header.php

And for body tag code, modify wp-content/themes/your_theme/footer.php to add code, just before closing of body tag.

Android Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question