Info
Content

Using the CMP with AMP websites

Integrating the cookie consent / CMP into your AMP Website

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 line to your <head> section:

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

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 not possible

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

 

Back to top