Story highlights

If you find that google's responsive AMP ad code doesn't do everything you need, you may modify your ad code to better meet the requirements of your site. The following examples show you how to correctly make these modifications.

Example 1: AMP ad with variable width and fixed height

This example shows you how to create an AMP ad unit with a variable width and fixed height (100px). We recommend you leave the width as responsive so it fits naturally with the rest of your page layout.

To create this AMP ad unit, replace the data-ad-client and data-ad-slot values in the following code with your own publisher ID and ad unit ID:

<amp-ad
   layout="fixed-height"
   height=100
   type="adsense"
   data-ad-client="ca-pub-1234567891234567"
   data-ad-slot="1234567890">
</amp-ad>

Example 2: AMP ad with fixed width and height

This example shows you how to create an AMP ad unit with a fixed width (300px) and a fixed height (250px).

To create this AMP ad unit, replace the data-ad-client and data-ad-slot values in the following code with your own publisher ID and ad unit ID:

<amp-ad
   layout="responsive"
   width=300
   height=250
   type="adsense"
   data-ad-client="ca-pub-1234567891234567"
   data-ad-slot="1234567890">
</amp-ad>

Sited sources:- Google amp adsense

How to modify your responsive AMP ad code

thomas

thomas thomas


Published