Adding `onAcceptHref` and `onRejectHref` to amp-consent
For #13716
@armydee moving the discussion to separate tracking issue. We will be adding the feature soon. In the meanwhile, can you give me an example on how you are going to use them?
- Would you need
rejectHref? - Do you require user id along with the request?
- Do you need it on every consent state change?
- Do you want to the request to be sent with stored consent state before.
Thanks!
@zhouyx OK thanks. Have included answers to the points below:
- We don't have plans now to include a "reject" button, but
rejectHrefwould be useful for those who do offer reject. - No.
- Yes, on every change, we'd like to have our
acceptHrefendpoint called. - We don't need the previously stored consent, just the latest consent.
After consent has been accepted, on subsequent page views, checkConsentHref continues to be called but regardless if true or false is returned, the amp-consent element is not shown. What is the purpose for AMP to continue calling checkConsentHref in this case?
- We don't need the previously stored consent, just the latest consent.
I may not be clear. What happens in the case that user accept. And when they visit the page again, they don't need to click on accept, the consent state will remain accept (it won't change). In that case do you expect a request to be sent?
After consent has been accepted, on subsequent page views, checkConsentHref continues to be called but regardless if true or false is returned, the amp-consent element is not shown. What is the purpose for AMP to continue calling checkConsentHref in this case?
Correct, you can argue that checkConsentHref is not required with stored consent state. But checkConsentHref is not designed to only return promptIfUnknown. It can also pass sharedData (and other proposed information in the future) to AMP, which is the reason why we send that everytime regardless.
Hi @zhouyx, I'm working with @armydee and was hoping to chip in.
Yes, it would be useful if the person's prior consent stored in AMP local storage was available and could be included in the checkConsentHref request.
It would also be useful if the prior consent could be accessed by other AMP components such as amp-analytics. The use case for accessing this from amp-analytics is so the analytics application (in our case, our own) knows whether consent has been received to track a person across pages, etc.
Hi @zhouyx has there been any progress on this at all?
@armydee @benamada Work in Progress this sprint. However I still don't quite understand the usage here especially after @armydee indicates that you won't need a user id along with acceptHref request.
Can I know why you need the `acceptHref? It will be super helpful if you can describe the your use case here. Thanks.
@zhouyx The User ID may be useful after all. Initially our plan was when our acceptHref endpoint was called, we'd record the consent in a cookie tied to our main non-AMP site. The cookie we could then check with our own in-house amp-analytics tag (which also points to our site) so we know whether consent for tracking across pages is allowed.
We've realized that this is not reliable if 3rd party cookies are disabled. So User ID would actually be useful and a good solution... via acceptHref, we can record the Consent and User ID in our database. The LAST missing piece is if either the User ID and/or info indicating if consent has been received could be made available to amp-analytics in any of the requests endpoints. Then when those analytics requests endpoints are called, we'd know whether we can track the person across pages.
@benamada Thanks for the info
we can record the Consent and User ID in our database.
If this is for collecting consent once for AMP site and non AMP sites, that's something we are not able to support right now. Because even with an user id, it's hard to stitch the id across AMP pages and canonical pages. It this is only for logging, this makes sense given that you only provide an accept option. If later you wish to allow an user to revert their decisions, how are you going to track consent? I'm assuming you will be needing a timestamp with each request?
The LAST missing piece is if either the User ID and/or info indicating if consent has been received could be made available to amp-analytics in any of the requests endpoints.
We can make consent state available to analytics request. In the meanwhile you can block <amp-analytics> with the data-block-on-consent attribute, to not make a request call until consent is given.
@zhouyx initially yes we did want to collect consent once for AMP site and non-AMP site, but I realize that's not easy to do now, and we're okay to give up on that.
Logging accepts, rejects and changes in their decision is something we're considering for both our AMP and non-AMP sites. So a User ID would be useful within acceptHref and rejectHref.
I appreciate data-block-on-consent is available for amp-analytics but much much better would be if the consent state can be made available so we can at least record page views anonymously if consent hasn't been given. We quite like the data-npa-on-unknown-consent="true" option that's available on amp-ad which allows amp-ad to still function until consent is received. Something like that for amp-analytics would be a perfect solution for us, where we can still run amp-analytics "anonymously" if either consent hasn't yet been given or consent has been rejected. Thanks so much :)
This issue doesn't have a category which makes it harder for us to keep track of it. @zhouyx Please add an appropriate category.
@benamada Thank you, this is helpful
There will be a PR coming. Some design patterns:
There won't be separate acceptHref and rejectHref, but a single onUpdateHref. It will send a POST request only when the local stored state changes.
For example, if the user choose to auto reject at timeout 0 to always serve non personalized content, this onUpdateHref request won't be sent because AMP runtime never store that decision.
The POST request will contain a userId scoped within the <amp-consent> component, and the most updated consent instance state. One thing to point out is that in order to include the userId, the request won't be sent synchronously. It is possible to lose a ping.
cc @jasti
I'm tracking this for a partner which wants to prevent showing the consent screen on AMP and then again on canonical 30 seconds later.
While 3rd party cookies could be an issue it seems that when those are disabled (outside of safari I don't know the frequency of this) then the behavior would be fail safe. IOW, in those cases the session doesn't get stitched and consent is asked for again.
Additionally, there may be ways to extend this to pass amp-consent setting (maybe via an API) to the origin site.
Would it make sense to make the consent status a variable that can be variable substituted into outbound URLs?
Would this work? https://github.com/ampproject/amphtml/issues/15267 Also, here is all the work planned for amp-consent in the future. https://github.com/ampproject/amphtml/issues/15651
I suspect so. The FR is for amp-analytics purposes but I don't see why that couldn't be added to all outbound links.
Also, Zhang pointed me to John's post at https://github.com/ampproject/amphtml/issues/13716#issuecomment-388915569 which suggest use of amp-pixel with data-block-on-consent, which seems like a good workaround.
I suspect so. The FR is for amp-analytics purposes but I don't see why that couldn't be added to all outbound links.
Polluting the URL space with publishers opting in has other issues. We could allow opt-in though. @zhouyx ?
@jamesshannon If I understand it correctly, the request is to append current consent state to the outgoing link for publishers to get the state in origin.
One thing I don't understand is how can the use of amp-pixel with data-block-on-consent be a workaround to this. Probably I understand the request wrong?
I agree with @jasti that we probably don't want to polluting the URL space especially given AMP is going to support IAB vendor lists, that will be a lot of things to append. Personally I think that appending CID to the outgoing link, and having publisher figure out the consent state remotely with that CID is the right approach.
@lannka for more info regarding cid in outgoing link. Do you think that a CMP should be able to create and pass a CID just like an analytics vendor.
@zhouyx ,
Correct, you can argue that checkConsentHref is not required with stored consent state. But checkConsentHref is not designed to only return promptIfUnknown. It can also pass sharedData (and other proposed information in the future) to AMP, which is the reason why we send that everytime regardless.
Is there a better option or workaround for checkConsentHref? We are using amp-consent for GDPR compliancy and some of our users are having problem with it as it is causing an overload on the server. ref: https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/2202
@MARQAS If promptIfUnknownForGeoGroup is used but checkConsentHref is not, you can choose to not specify checkConsentHref at all. Would that work for you? Thanks.