This page summarizes how vendors can access the consent state and the IAB consent string of the user in AMP.
<amp-ad> with RTC config
If you are a vendor that needs access to the consent state or the IAB consent string from an amp-ad tag with a RTC config, you can use macros: CONSENT_STRING and CONSENT_STATE to add those information to your requests URL.
If you are a vendor that needs access to the consent state or the IAB consent string from an amp-ad tag without a RTC config, Didomi allows this feature on page load by sharing the values through the sharedData object.
Didomi is sharing 2 values through window.context.consentSharedData:
consentStateValue which contains the consent state (a 0/1 value that indicates if the user has given consent to non-IAB purposes and vendors)
consentString which contains the IAB consent string
The consentSharedData is only loaded once on page load.
When the user gives consent for the first time, the consent string will only be available on the next page load and will not trigger reloading the ads.
We recommend using <amp-ad> tags with RTC config when possible as those provide more dynamic control for vendors.
If you are a vendor that needs access to the consent state or the IAB consent string from an amp-analytics tag, you can follow this implementation by comScore.