amp-consent: Client side consent flow with 3P iframe and no server API
I read all the documentation and variants of how to implement a CMP with amp-consent on https://amp.dev/documentation/components/amp-consent/ .
We are developing a CMP for our publishers which is service specific, it won't use any global cookie like *.consensu.org but the consent will only be stored locally in the publisher's domain. So we would like to use a client side consent flow with an iframe.
Example:
<amp-consent id="myUserConsent" layout="nodisplay">
<script type="application/json">{
"consentInstanceId": "consent-id",
"consentRequired": true,
"promptUI": "consentDialog",
"postPromptUI": "post-consent-ui"
}</script>
<div class="popupOverlay" id="consentDialog">
<amp-iframe layout="fill" src="https://3p-domain.com/cmp-ui.html" sandbox="allow-scripts allow-same-origin">
<div placeholder>Loading</div>
</amp-iframe>
</div>
<div id="post-consent-ui">
<button on="tap:myUserConsent.prompt()">Update Consent</button>
</div>
</amp-consent>
The prompt UI sends a message to the parent when the user saves the settings. The response contains the newly generated consent string.
window.parent.postMessage({
type: 'consent-response',
info: "the consent string",
action: 'accept'
}, '*');
The problems:
- How does amp-ad get access to the consent string? The request made by amp-ad seems not containing it.
- Whenever the user decides to apply changes on the earlier saved consent string, we would like to display the UI prompt reflecting the settings the user has made before. Therefore we will need read access to the consent string in the 3P amp-iframe.
Since the CMP UI is hosted on a 3P domain and used by all publishers, we can't just store the consent string in a cookie and read from there. The solution with checkConsentHref and updateConsentHref introduces lots of traffic and server costs which we would like to avoid.
Is it possible to make the stored consent string available to the prompt UI which is a 3P iframe?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.