Blocking Custom Vendor Scripts by Using data-block-on-consent

Overview

The AMP Project has provided an attribute to block components unless the user has consented. To take advantage of this feature, add the data-block-on-consent attribute to the AMP component. In effect, this means that all behaviors of the element (e.g. sending analytics pings for <amp-analytics> or the loading of an <amp-ad>) are delayed until the relevant consent instance is accepted.

Individual components may override this behavior to provide more specialized handling. Please refer to each component's documentation for details. An example of a component using this attribute is below.

<amp-ad
data-block-on-consent
width="320"
height="50"
type="doubleclick"
data-slot="/4119129/mobile_ad_banner"
>
</amp-ad>