Skip to main content

Display AMP ads in WordPress

AMP ads can be created using Ad Commander and a compatible AMP plugin. AMP ads are available for any ad type, including AdSense ads.

Compatible WordPress AMP plugins

To serve AMP ads, you must first create AMP pages by implementing a compatible AMP plugin. Some popular AMP plugins include:

  • AMP by AMP Project Contributors (recommended)
  • AMP for WP

If you use a different AMP plugin and would like to request compatibility, please contact us. If a plugin offers the necessary WordPress hooks, we may be able to add compatibility to Ad Commander.

Creating AMP ads

Implementing AMP ads varies by ad type. Generally speaking, AMP ads are implemented as follows:

  • AdSense: AdSense ads can be automatically converted to AMP ads. Learn more in our AdSense documentation.
  • Image/Banner Ad: These ads are AMP-compatible. Ad Commander implements AMP-specific styling in some cases.
  • Text or Code Ads: Any code that is not AMP-compatible is stripped out by your AMP plugin. Custom AMP ads can be created as alternatives (see targeting information below).
  • Rich Content Ads: Same as above. AMP-compatible HTML will remain.
  • Groups: Many groups of ads are not impacted by AMP or non-AMP visits. However, because most Javascript is not executed by AMP visitors, rotating ad groups will not rotate. Instead, ads included in the group will stack and all show at the same time.

In all cases, incompatible script codes are stripped out, so custom code added to your ad may be removed.

Targeting AMP visits with content conditions

It is possible to create ads that either only display to AMP visitors or don’t display to AMP visitors. This is done using the AMP content condition.

AMP content targeting condition

An example use-case would be creating a group of script ads (which are not AMP compatible) and a group of AMP fallback ads. While not necessary for AdSense, other ad networks may offer AMP code that you’d like to implement.

There are several ways you could serve these AMP ads. One common setup would be to create a group of script ads and set the AMP condition to is not true. Then, create a group of AMP ads and set the AMP content condition to is true. Insert these groups in the same place using automatic or manual placements. The content condition will cause only the AMP ads to be served during AMP visits.

In this example, groups are limited by the content condition. However, the same type of logic could be implemented on the ad or placement level as well.

Impression and click tracking of AMP ads

As mentioned above, AMP visits do not execute most Javascript. Because of this, it is not possible for Ad Commander to reliably track clicks on AMP ads.

Ad Commander does track ad impressions using both Local tracking and GA4 tracking. This is done by implementing the <amp-pixel> and <amp-analytics> components.

In most cases, the impact on overall stats is minimal. However, if a site receives a large volume of AMP traffic, the click-through rate may be distorted. If this is problematic, AMP impression tracking can be disabled under Settings -> Tracking.

Other AMP limitations

By its nature, AMP visits are much more limited than a regular website visit. Here are some other limits to be aware of:

  • Page rendering and caching: AMP ads can only be served with server-side rendering. Ad Commander will automatically switch to server-side rendering during AMP visits, even if you have “Client-side only” rendering enabled. Under normal circumstances this is fine. Most page caching plugins in our experience will not cache AMP visits. However, if you happen to have a caching implementation that does cache AMP pages, it could cause incorrect ads to serve to non-AMP visitors. Please verify when implementing an AMP plugin that your site is serving the correct content to the correct visitors.
  • Consent requirement: Similarly, consent requirements will be partially broken for AMP visits due to required server-side rendering. Ad Commander will check for the specified consent cookie during ad rendering. However, most consent management implementations require Javascript to function, so ads may never show. If your implementation does work without Javascript, Ad Commander will see the consent cookie on the second page load.
  • Visitor targeting: Any visitor targeting methods that require client-side Javascript (primarily browser-based conditions) may have unexpected results. The condition will be checked with any available data, such as previously set browser cookies.
  • Popup placement: Popup placements are disabled for AMP visitors because they require Javascript.