ampproject / ampproject/amphtml

Allow external amp-consent flow to make iframe no-display before closing

Open
#32,748 4 comments 0 reactions 1 assignee Claimed by @micajuine-ho View on GitHub
Component: amp-consent P2: Soon Stale Type: Feature Request WG: components
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

## Describe the new feature or change to an existing feature you'd like to see

Currently, when the consent-response is sent to the parent AMP page, the iframe is closed immediately. While it is expected that the UI be immediately removed from the user's view, the CMP on the external iframe may need to also send a record of consent for the user choice to an external server (this is required for GDPR). However, because the iframe is closed immediately the call to the service is canceled before the record can be made.

This request to provide the ability to hide the iframe without closing until the external iframe responds that is ready to be closed.

## Describe alternatives you've considered

1. We have tried using the beforeunload event handler to ensure the call is completed, however, closing the iframe also cancels these and records are not recorded.
2. We have tried waiting for record call to finish before sending the consent-response to AMP. However, this caused a poor user experience as the UI within the iframe closed, but because the iframe still existed on the AMP the user wasn't able to interact with the page immediately.
3. We have tried resizing the iframe as well before sending the response, however, amp-iframes can only be sent to a minimum height of 100px which is still too large.

## Additional context

Logging records of consent is a requirement under GDPR and other privacy regulations.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.