-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
amp-consent: Pass custom data to onUpdateHref #30049
Comments
Hi @opencmp, thanks for your issue report.
Currently, only specific fields are allowed to be passed in
What type of data are you looking to pass to |
Hi @micajuine-ho Our intent is to track the user's actions when surfing the CMP, i.e. was a consent string created before, which button was clicked etc. This information we could send to AMP via postMessage when accepting/rejecting consent, so that AMP can pass this information further to onUpdateHref which is a small Worker. This Worker can then store this information somewhere to be analysed later.. onUpdateHref does not need to pass data back to AMP, my explanation was a bit confusing trhere. The idea is to do that:
Why do we want to this? Any thoughts? |
Since the iframe belongs to you, why not just send that custom metadata to the i.e:
|
@micajuine-ho Because after accepting the consent, amp-consent immediately closes the iframe which interrupts all requests. |
The iframe tells amp-consent when to close by sending an accept post message:
So before that javascript is triggered, why not send data to the |
Because there would be a delay between clicking and closing the amp-consent layer. We would like to have the layer close instantly. |
/cc @zhouyx Do you have any ideas for this? |
AMP closes the iframe immediately to avoid having iframe running in the background. Passing the I'm seeing a few options here
Option 3 will require more discussion and review. I think maybe we can go with option 2. If so what is a good timeout value for you? @opencmp |
@zhouyx I would go with Option 2 and 1 second as default timeout. This is the quickest solution and doesnt interfere with Option 1 which could still be implemented later if needed. Option 3 might just be a special case of Option 2 with the timeout set to infinite. If you decide to implement Option 2, when will the release be available? |
AMP doesn't allow cross domain iframe running in the background. But I find this a special case to make an exception for a few reasons.
I'd like the team to review this exception before I work on the change. Once approved, the change should be trivial. The release usually takes 2 weeks. |
Feedback from design review. We agree that sending the requests in the background, and not blocking the user is best practice. |
@opencmp the change to implement Option 2 has been merged. You should be able to test via nightly build tomorrow, and expect the change to ship to stable in 2 weeks. Thanks |
We would like to pass custom data via AMP's request to onUpdateHref, so that we can receive more information about the CMP's state.
This code triggers the request to onUpdateHref:
I tried to add more properties to "consentMetadata" but with no luck.
We would appreciate if AMP could add a custom property which holds proprietary data that are sent to the url configured in onUpdateHref. Thank you!
The text was updated successfully, but these errors were encountered: