Google AdSense is a program that allows webmasters and anyone who runs a website or blog to earn income by adding AdSense ads to their pages. When your users visit your pages and interact with ads on your pages, you get a chance to earn some money from these ads. The more users you have, the more you may be able to earn. It is easy to put AdSense ad units on regular WordPress pages. To do that, simply copy the ads unit provided when you log on to your AdSense account and create a new ad unit. Then paste the codes on any of your pages and in no time, ads should begin appearing. However, if you’re running AMP pages, the process isn’t that simple. To add AdSense on AMP pages, you’ll have to do it differently. The AMP Project is an open-source initiative that aims to make the web faster. If you’re running a WordPress blog or website and want to rank better in search engine result pages, you may want to enable AMP for your pages. If you can’t turn on AMP for your sites, then make sure that your sites run faster when compare to others.
Install WordPress AMP Plugin
A simple way to enable AMP pages for WordPress sites that are running themes not built on AMP standards is to install a recommended AMP plugin called AMP. The AMP plugin for WordPress supports fully integrated AMP publishing for WordPress sites, with robust capabilities and granular publisher controls. After installing the plugin, activate it and separate AMP pages will be created for your site.
Get AdSense Ads for AMP
After installing the WordPress AMP plugin, go to your AdSense account and enable AMP ads. Turn on Auto ads for AMP and Google will automatically show ads on all the AMP sites in your account. Just add 2 pieces of code to each AMP site where you want ads to appear. After enabling AMP ads in AdSense, you will be provided two pieces of code to add to your site. One is to be added to your AMP header and the other to the body. Copy the first piece of code that looks similar to the one below: Then go to your WordPress dashboard and navigate to Plugins ==> Plugin Editor Then select the AMP plugin and open the html-start-php page. Paste the code inside the
andsections of the page as shown below: Next, copy the second piece of code and paste it into the body section of your AMP pages. In the same html-start-php page paste the code in the body section as shown below: Save the page and exit After saving the page, ads should begin showing on your WordPress AMP pages after a few minutes.Add AMP Code via Theme Function
Because WordPress plugins are frequently updated, and all changes to the plugins will be lost after updating, it’s recommended that you add AMP code via the WordPress theme’s function.php file. To add AdSense AMP header and body code via the WordPress theme function, go to WordPress Dashboard ==> Appearance ==> Theme Editor. Then select the current theme, and open the function.php file. When the file opens, copy the two pieces of code into the file and save. AMP Header code AMP Body code Save the function.php file and you’re done. When you’re all done, AMP ads should begin appearing on your site’s pages. Conclusion: This post shows students and new users how to add AMP ad units on WordPress AMP pages. If you find errors above, please comment below to report them. You may also like the post below: