AMP (Accelerated Mobile Pages) is a method to build fast websites, especially for mobile devices. Due to many technical restrictions, displaying ads is not as straightforward as on “normal” websites. On this page we cover the different ways to use and the limitations of ads managed with our Advanced Ads plugin on AMP pages.
How to set up an AMP page?
The most popular solution to create AMP pages in WordPress is the AMP plugin by Automattic. It creates an AMP version of posts on a subdomain that ends with /amp/.
We built our solution for ads on AMP pages on this “official” plugin. If you are using another solution and run into issues then please let us know.
Our solution for ads on AMP pages works with the following plugins:
- AMP by Automattic (recommended)
- AMP for WP – Accelerated Mobile Pages
- WP AMP — Accelerated Mobile Pages for WordPress (limitation: removes ads in the content of archive pages)
- Facebook Instant Articles & Google AMP Pages by PageFrog (see limitation below)
- WP AMP Ninja (see limitations below)
Other plugins might also work, but if not, please let us know.
AdSense on AMP pages
Displaying the normal AdSense code is not possible on pages based on the AMP standard. The Responsive Add-On automatically converts AdSense ads (added with the AdSense ad type) into the AMP format on AMP pages.
Find more information about AdSense specific AMP features on AMP AdSense on WordPress.
AMP ad type
Many ad networks offer support for AMP already. Since they may come with different attributes, we implemented a flexible AMP ad type into the Responsive Add-On.
When you are using this ad type, you will see a form to enter custom parameters and values. You will find the supported parameters when you click on any of the networks in the list of ad networks that already use AMP. The specific parameters and values need to be checked with your ad network.
For Google DoubleClick (DFP) a basic implementation might look like this:
The AMP documentation also offers a fallback option. We implemented this as well, but couldn’t find an ad network that supports it yet.
This fallback is not meant to show up when the ad is broken or you don’t have an account with a specific network, but when the impression is not filled by the network. However, the network itself decides whether they respect this setting or not.
On the AMP page, this is described like this:
amp-ad supports a child element with the fallback attribute. If supported by the ad network, this element is shown if no ad is available for this slot.; If there is no fallback element available, the amp-ad tag will be collapsed (set to display: none) if the ad sends a message that the ad slot cannot be filled and AMP determines that this operation can be performed without affecting the user’s scroll position.
Image and other ads on AMP pages
General limitations for AMP ads
- browser-based Visitor Conditions might not work, e.g. browser-width, cookie
- only the manual placement and placements before, within and after the content are supported, but none from Advanced Ads Pro
- cache-busting in Advanced Ads Pro does not work on AMP pages
- impression tracking only works with the methods track on load and track after page printed
- when you use the reserve this space option for the ads, it cannot be centered with the Position option
- don’t use the reserve this space option when you are using an ad label for ads on your site
- some issues can occur depending on the method you used to create AMP pages. The AMP plugin by Automattic cannot create AMP code for archive pages
AMP plugin in transitional mode
The AMP plugin by Automattic, Google, and XWP has something called “transitional” (previously called “paired”) mode which uses your original theme and website features as a basis for your AMP site. This means that scripts that don’t work with AMP out of the box are still loaded. This can cause errors that might lead the AMP plugin to load the normal website instead of AMP.
If you see errors that related to a script from Advanced Ads or any of our add-ons then you can mark them as “accepted”. The AMP plugin will then block that script. Since these scripts are not working on AMP anyway, blocking them does not break anything in addition. We are working on converting all of our features to AMP versions.
Facebook Instant Articles & Google AMP Pages by PageFrog
When using ads on AMP pages with the mentioned plugin, please uncheck this option to allow the content injection.
Force AMP compliance by removing other plugins/functions from AMP pages
WP AMP Ninja