amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-consent not immediately taken into account

Open nbonnotte opened this issue 8 years ago • 9 comments

What's the issue?

I have a single-page AMP website. When the user gives their consent with amp-consent, amp-analytics set up with Google Analytics does not fire a pageview request, nor event requests. It works only after refreshing the page. But then if the user remove their consent, it keeps firing until the page is refreshed again.

Note that when amp-user-notification is used to check consent, it works fine: for instance pageview is sent as soon as the user gives their consent. (But unfortunately amp-user-notification does not allow for consent removal.)

Related to #15406 (but reloading the page seems quite unnecessary to me, and it is not needed by amp-user-notification)

Or am I missing something obvious ?

How do we reproduce the issue?

https://jsbin.com/vajozutuyo/edit?html

To make it work, you would need a local copy with an endpoint for checkConsentHref serving {"promptIfUnknown": true} to force the notification.

What browsers are affected?

Chromim: Version 65.0.3325.181 Firefox: Quantum 59.0.2

Which AMP version is affected?

Version 1530043289240

nbonnotte avatar Jun 27 '18 12:06 nbonnotte

Looks like there are two issues here.

  1. When a user consents analytics is not firing until the next page view. This would be a bug if validated.
  2. When a user changes consent to reject analytics events (and presumably things like auto ad refresh) continue to fire on that page and the reject only takes effect on the next page. This is as designed, however the particular case does raise an interesting question about when a consent change should take effect.

jpettitt avatar Jun 27 '18 16:06 jpettitt

About the 2nd issue: it seems wrong to me to let the user believe their consent withdrawal is taken into account if that is not (yet) the case.

I you don't mind, I'm changing the title of the issue for something a bit more meaningful...

nbonnotte avatar Jun 29 '18 05:06 nbonnotte

/cc @jasti @lannka

jpettitt avatar Jun 29 '18 17:06 jpettitt

@nbonnotte I tested with the example page you provided. And analytics pings fire successfully after I click on accept.

When you refer to the user gives their consent, do you actually mean when user changes their consent right? which ends onthe the second issue that @jpettitt mentioned.

Right now it is by design that AMP only respect changed consent after page refresh. In most cases this makes sense, for example not to revoke an already rendered iframe. It can be an interesting topic for analytics or auto refresh ad. I'll label this as a feature request.

cc @jeffjose @jasti

zhouyx avatar Jun 29 '18 19:06 zhouyx

@nbonnotte Could you please validate if 1 is still an issue for you. Do you have a sample page? 2 is WAI in my opinion, at least for now. One way to get around this issue is to notify on the consent UI that they have to refresh the page for the consent preference to take effect.

jasti avatar Jul 16 '18 16:07 jasti

This issue hasn't been updated in awhile. @jasti Do you have any updates?

ampprojectbot avatar Nov 28 '18 04:11 ampprojectbot

Closing as this is WAI. Feel free to reopen if there's concern. Thank you

zhouyx avatar Jul 02 '19 21:07 zhouyx

Did anything on this change? I would like to use this functionality, but it appears that there is currently still no way to automatically reload the page when a user changes their consent status, is it still the case that "by design that AMP only respects changed consent after page refresh"?

cainskelton avatar Jun 05 '20 18:06 cainskelton

One thing to clarify is that if this is the first time that user gives their consent, there's no need to reload the page. Refresh is only required when the extensions/vendors have already processed the existing consent information, then the user changed their consent.

We have indeed created #28112 to support the feature. But deprioritized the task based on feedback from many vendors.

zhouyx avatar Jun 05 '20 19:06 zhouyx