Search
Clear search
Close search
Google apps
Main menu

Grow your ad revenue and get your website into shape for the holiday season! Check out our blog post for additional information.

Ad code implementation

Implementation guide for AMP Auto ads (beta)

AMP Auto ads are ads that AdSense automatically places on your AMP pages. This guide shows you how to implement the AMP Auto ad code on your AMP pages.

Note that you only need to place the <amp-auto-ads> ad code once on each page that you want to show AMP anchor and/or text and display ads.

Before you get started

For example, let's say you have a site example.com and you host the AMP versions of each page under example.com/amp/. You'd add <link> tags in the <head> of each AMP and non-AMP page to indicate which content belongs together.

In the non-AMP example.com/news page:
<link rel="amphtml" href="http://example.com/amp/news">

In the AMP example.com/amp/news page:
<link rel="canonical" href="http://example.com/news">

If you host your AMP content on a separate site, you must add a <link> tag to any non-AMP pages so AdSense can discover the related AMP pages.

How to implement AMP Auto ads

Follow the steps below for each page you want to display AMP Auto ads. After you’ve published your <amp-auto-ads> ad code, AMP Auto ads will appear within a few minutes.

  1. Place the amp-auto-ads script in the <head> of your page.
    <head>
       <script async 
          custom-element="amp-auto-ads"
          src="https://cdn.ampproject.org/v0/amp-auto-ads-0.1.js">
       </script>

    <title>My AMP Page</title>

    ...
  2. Place the amp-auto-ads ad code immediately after the opening <body> tag.
    </head>

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

    ...

    </body>

    Important: Make sure you replace ca-pub-123456789123456 in the code above with your own publisher ID.

Notes:
  • Only text, display and anchor ads are supported at this time.
  • Amp Auto ads will show an appropriate number of ads based on the amount of content on your page, taking into account any hard-coded <amp-ad>s you already have.
  • Amp Auto ads will currently only show for users using a mobile device. Please test your site in a mobile device to see AMP auto ads.

How to track the performance of AMP Auto ads

You can track the performance of your AMP Auto ads by viewing the Ad behavior report on the Performance reports tab. AMP Auto ads are shown under the "AMP Auto banner ads" label in the report.

Was this article helpful?
How can we improve it?
Sign in to AdSense

Sign in to AdSense to see help for your account

Don't have an AdSense account? Sign Up for AdSense!