The data-block-on-consent
attribute is a pre-defined optional configuration that your organization can use to ensure that all behaviors of a component (e.g. sending analytics pings for <amp-analytics>
or the loading of an <amp-ad>
) are blocked until the desired action is completed.
Note: More information on blocking options can be found on the official AMP documentation page, click here. Additionally, be aware that Sourcepoint currently does not support the granular consent attribute data-block-on-consent-purposes
.
data-block-on-consent
blocking behaviors
The data-block-on-consent
attribute is added to an AMP component to block a element behavior until the relevant action is accepted. Individual components may override this behavior to provide more specialized handling.
The data-block-on-consent attribute accepts the following behaviors:
Behavior | Description |
_till_accepted |
The default blocking behavior for the attribute. The configured component is blocked until the end-user accepts all purposes and vendors on a property. Note: The component will remain blocked if only granular consent is given for a subset of purposes and/or vendors on a property. |
_till_responded |
The configured component is blocked until the end-user responds to the consent message. End-user responses that would unblock the component include:
|
_auto_reject |
The configured component will reject the consent automatically if consent is required but unknown. The reject consent decision will not be stored. |
data-block-on-consent
examples
In this section, we will review the behaviors of _till_accepted
and _till_responded
for the data-block-on-consent
attribute. In order to better illustrate each blocking behavior we will be adding the attribute to an <amp-img>
component.
/* blocking component until end-user accepts all vendors and purposes */
<amp-img
data-block-on-consent="_till_accepted"
alt="avatar"
src="https://www.w3schools.com/w3images/avatar_hat.jpg"
width="500"
height="333"
layout="responsive"
>
</amp-img>
/* blocking component until end-user interacts with consent message */
<amp-img
data-block-on-consent="_till_responded"
alt="avatar"
src="https://www.w3schools.com/w3images/avatar_hat.jpg"
width="500"
height="333"
layout="responsive"
>
</amp-img>
Comments
0 comments