Info
Content

Using the CMP with AMP websites

Integrating the cookie consent / CMP into your AMP Website

Please note: For AMP websites automatic blocking of codes and cookies is not possible. All third party codes must therefore be adjusted (see below).

In order to use the CMP with a website that is build with AMP (https://www.ampproject.org/) the following steps need to be done:

1. Add the following lines to your <head> section:

<script async custom-element="amp-consent" src="https://cdn.ampproject.org/v0/amp-consent-0.1.js"></script>
<meta name="amp-consent-blocking" content="amp-ad">

Please note, that AMP does not support all features. Here are some examples for features that are not supported via AMP:

  • Position of the layer is always bottom / full width
  • Automatic consent via scroll/navigate is not possible
  • Consent type is always domain specific
  • Size of the layer is fixed, hence paddings/borders are limited
  • Once the consent is given, AMP controls the further behavior
  • AdBlocking / Postponing is limited

Please note, that there will be an update to the AMP framework in the future, which will allow AMP more features.

Blocking codes if consent is not given

AMP does not (yet) support the blocking of specific vendors by using the IAB consent string. This means that (currently) you can only use general blocking/unblocking for AMP and not specific blocking by vendor.

In order to block ads or analytics codes from your AMP website is no consent is given, simply add the data-block-on-consent attribute to your amp-ad or amp-analytics element. Example:

<amp-analytics data-block-on-consent type="googleanalytics">
</amp-analytics>

For further information on blocking, see also the AMP reference: https://amp.dev/documentation/components/amp-consent?format=websites#blocking-behaviors

Known issues with AMP

Storage limit exceeded

For pages that are hosted on the AMP servers (e.g. news.google.com or ampproject.org) the current maximum storage limit for consent information is 1200 characters. This includes the IAB TCF string, Google Additional Consent Information and some more data. If all data together exceeds the limit, no data is stored. The visitor will therefore appear as a new visitor on the next page impressions and will be asked again (and again and agai ...).

In order to avoid this, please ensure to limit the amount of vendors in your vendorlist.

Back to top