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

For more granular blocking you can use the data-block-on-consent-purposes="xxx" attribute, where xxx is the ID of the purpose that should be accepted. Example:

<amp-pixel data-block-on-consent-purposes="c52"></amp-pixel>

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.

Privacy policy URL not working

If you add a "dynamic" URL in your CMP settings e.g. "/path/to/url.com" and expect it to become
"https://your-domain/path/to/url.com", this will not work for AMP pages. You would need to set custom client side configurations (e.g. window.cmp_privacyurl = "https://www....") and overwrite the policy URL. Please see here:
https://help.consentmanager.net/link/101#bkmrk-in-order-to-override

 

Back to top