How to insert ads within the post content in AMP pages of WordPress

Advertisement

AMP content is important if you want better visibility on Google search. If you own a news website, you can get a chance to feature in top carousel results shown as top stories. If you are still not sure what is AMP, read out article on AMP. If you want to install AMP on your WordPress website, read how to setup AMP on WordPress.

After setting up the AMP, the most important thing we think about adding ads. The native AMP plugin by Automattic does not offer option to insert ads. There are few plugins but they only offer ads at top and bottom of the content. I also wrote how to add Adsense ads on AMP pages. But, if you want to insert ads within the content, you need to buy the premium version of the plugin.

If you are not willing to pay and are ready to tweak code of your WordPress theme, you can manually add code in your blog’s AMP pages. You just need to copy and paste this code in your theme’s functions.php file. Make sure you have already AMP setup on your blog before using this code.

Insert ads within the post content in AMP

Add the given code in your theme’s functions.php file and make sure to alter the Adsense ads code.

You only need to add your AMP ad code in place of the sample code.

Advertisement

I use the same code on my website Techlomedia and it really helped me. Because people generally ignore ads at top and bottom of the content. In-content ads work better. I have also seen improvements on my Adsense earnings after setting up the in-content ads on AMP. So, you should also do the same.

If you find it hard to implement AMP ads by using the code, you can always ask via comment. I will surely help you.

Advertisement