Print

Add Google Auto Ads on AMP Pages

If you want to add Google auto ads into your AMP page just add the code below into your functions.php of your theme.

add_action('amp_post_template_head', 'wpstg_amp_custom_head');
function amp_post_template_head(){
echo '<script async custom-element="amp-auto-ads" src="https://cdn.ampproject.org/v0/amp-auto-ads-0.1.js"> </script>';
}

The last step is to add the code below into one of your wp quads ads on all pages where you activate the google auto ads. Please note that it can take up to 48h until Google shows the auto ads on your website.

<amp-auto-ads type="adsense"
              data-ad-client="ca-pub-1234567890">
</amp-auto-ads>

Change the ca-pub parameter to your personal id number.