AMP Blocking Behaviors

AMP components can block their loading until consent is accepted, until any consent choice is made (if required), or if consent is required but unknown. In addition, you can configure timeout with fallback behaviors

The following table indicates what InMobi CMP sends for consent required and the consent states, based on InMobi CMP configuration, location, and user behavior.

Getting the TCF Consent String

RTC Vendors

Certain ad vendors support real-time configuration (for the full list of supported vendors, see Supported Vendors. If you’re using amp-ad and your vendor is one of these listed vendors, you can use the CONSENT_STRING and CONSENT_STATE macros to add that information to the request URL. For more information on how to do that, see AMP Consent Integration.

Non-RTC Vendor

If your vendor needs access to the consent string but doesn’t support real-time configuration, you can check the window.context.initialConsentValue key that stores the full TCString, or check the window.context.initialConsentState which stores the AMP consent state value (either 1 or 0) within your JavaScript code.

Basic Blocking behavior example

To block components, either add the data-block-on-consent attribute to the AMP component or add the amp-consent-blocking meta tag with the list of extensions to block. 

Blocking the analytics until user accepts consent 

Example 1

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

Example 2

<meta name="amp-consent-blocking" content="amp-analytics,amp-ad" />

On This Page

Last Updated on: 23 Apr, 2024