amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

[Master feature] Enable user choice using <amp-consent> component

Open zhouyx opened this issue 8 years ago • 63 comments

Overview

A new <amp-consent> component that enables publisher to get consents from readers and manage their consents.

Format

<amp-consent>
   <script type='application/json'>{
     “consents”: {
        “consentInstanceABC”: {
           “checkConsentHref”: “endpointABC.com”,
           “promptUI”: “template1”
         },
        “consentInstanceDEF”: {
           “checkConsentHref”: “endpointDEF.com”,
           “promptUI”: “template2”
         }
      },
     “policy”: {
         “policyABC”: {
             “waitFor”: {
                “consentInstanceABC”: [],
              }
           }
     }
   }</script>
   <div id=”template1”>
     Collect consent for instance ABC
     <button on="tap:consentInstanceABC.dismiss">Dismiss</button>
     <button on="tap:consentInstanceABC.accept">Accept</button>
     <button on="tap:consentInstanceABC.decline">Decline</button>
   </div>
   <div id=”template2”>
     Can we use your cookie?
     <button on="tap:consentInstanceDEF.accept">Accept</button>
   </div>
 </amp-consent>

Consent instance

config

Each unique consent instance keeps a list of endpoints to get and update consent states. Initially, the configuration is simple:

  • checkConsentHref: An endpoint to use to check the consent status
  • promptUI: An ID corresponding to the UI container to display that's meant to collect this consent.

In the future, configuration options may be expanded for more functionality:

{
  checkConsentHref: (required)
  promptUI: (required)
  disableLocalStorage: (optional) true/false. Default to false - controls whether state does not get kept in local storage (see below)
  acceptHref: (optional) - an endpoint that is requested when the consent is accepted
  rejectHref: (optional) - an endpoint that is requested when the consent is rejected
  dismissHref: (optional) -  - an endpoint that is requested when the consent is dimissed
}
checkConsentHref

Request

Make a POST request:

{
  consentInstanceId // string for the consent ID being asked about
}

In the future, this may be expanded to include:

{
  consentInstanceId // string for the consent ID being asked about
  ampUserId // For server to identify the user
  timestamp // value stored on client side, can be empty
}

Response

Expect a response with an boolean value:

{
  'promptIfUnknown': boolean (true/false)
}

Consent Policy

A default consent policy will be auto generated to wait for every consent instance. One can overwrite the default consent policy by declaring a new consent policy instance with id "default". Or add other consent policy instances to the <amp-consent> config.

Consent Policy Instance Config

Each unique consent policy instance creates a consent blocking behavior unit that instruct other components on the page. It keeps a list of consent instances to wait for. Initially, the configuration is simple:

  • waitFor: A JSON object that declare the list of consents to wait.
'waitFor': {
  'ABC': [] // Only empty array accept now.  
}

In the future, configuration options may be expanded for more functionality:

{
  'waitFor': {
    'consentId': [] // Array of items that's associated with that consent instance
  }
  'timeout': timeout in case user never respond
}

Storage

All consent instance state will be stored and handled client side. For each consent instance. LocalStorage looks like

  • Key: amp-consent:${consentInstanceId}
  • Value: true/false (won’t store anything for unknown state)

Blocking Components

Use data-block-on-consent=consent-policy-id to block AMP components with consents. If no consent-policy-id is specified, "default" consent policy instance will be used.

Individual AMP component can override default blocking behaviors and implement blocking logic itself.

UI

UI Restrictions

Prompt UI

  • Only a single UI can be shown at a time.
  • Position fixed and stick to the bottom of the page

Revocation button

  • Will only be displayed after consent state is determined
  • Can overlap when there are multiple consent instances.

Text

  • All text will be static inlined. No template replacing will be supported
Revocation Button Design

Coming soon, we will support the ability to specify a UI container that will be displayed once the prompt has been handled. This can be used optionally to enable a persistent UI affordance to be displayed that allows the end user to revoke their previous choice and pick a new choice.

zhouyx avatar Feb 28 '18 18:02 zhouyx

Some feedback:

We should avoid the term revocation to talk about the full list management flow. Maybe some terminology like "consent prompt" vs. "consent management" would sufficiently differentiate them.

In the "config" section, could you clarify the two options that are presented? It looks like the 2nd one just uses more fields.

Could you add a section talking about data persistence (viewer case and origin case)?

CONSENT_RESTRICT_STATES.CONSENT_NEEDED: It seems like it's valid for this value to be returned even if a list of items is returned, none of which requires consent. Basically, my reading of the items is:

  • NO_CONSENT_RESTRICT: Consent is being asked for by this page, but it should be ignored (could be used to convey decisions relating to geo)
  • CONSENT_NOT_NEEDED: How is this case differentiated from the previous one? Are we asking the caller to summarize the outcome of the response or is this acting like an override (in which case it seems to be like NO_CONSENT_RESTRICT.
  • CONSENT_NEEDED: Related to the above, is this saying to definitely prompt, or is it just saying that we should let the rest of the consent logic decide what to do on the page. Maybe we need some sort of prompt/no-prompt decision in this enum.

fullConsentStateList: Is id meant to be something the publisher comes up with, or is it specifically meant to say "id"?

CONSENT_STATE.DISMISS: How do you imagine this is needed? I could see AMP sending it to the pub, but I can't imagine when it's useful for the pub to tell this to AMP.

CONSENT_INSTANCE_STATUS: Can we provide more granular information about consent status to a component? Specific items/vendors?

Component management: We should include affordances for timeouts and define the defaults for consent blocking. For example, if the page has an amp-consent component but it's silent on which elements it applies to, we should conservatively block the element from loading.

rudygalfi avatar Feb 28 '18 21:02 rudygalfi

Where variable replacement is overridden in the case of no consent, for example client id, it would be useful for the publisher to be able to specify a default value rather than just returning blank.

jpettitt avatar Mar 02 '18 20:03 jpettitt

Hi,

Can I ask what would be the difference with this and using the <amp-user-notification> and displaying a banner at the bottom of the screen asking people to accept cookies or not see a screenshot of one I have running on a production website:

untitled

~I blanked out the website, due to the owner not wanting to show the website. But you can see the Cookie Consent banner at the bottom.

ghost avatar Apr 03 '18 16:04 ghost

@ayumihamsaki One key difference is that you can collect a user response of yes or no. amp-user-notification only supports being dismissed (and storing that so that the notification doesn't re-appear).

rudygalfi avatar Apr 03 '18 20:04 rudygalfi

@ayumihamsaki there are a number of subtle differences which are designed to comply with the detail in the GDPR. Amongst other things;

consent: the user should be given ability to optin or out, a solo accept button is equivalent to a pre-ticked box (which is non-compliant),

storage: You are required to keep an up-to-date record of users preference status and be able to demonstrate that record upon request (local storage in this instance), and

optout: The user should be able to change their mind with as much ease as they opted in, preferably using the same mechanism (DP by design).

There is a bunch more reasons. It's worth noting that cookies are one of the most ambiguous topics of the GDPR, mentioned one (I recall) but included in the scope without much direction on how to comply. It is the EU's view that much of the data collected using cookies can be used alone or in combination to pinpoint a specific users (IP, GA snippet, Zip or postcode) so it is well within scope.

P.S. Good solution @zhouyx this will help a bunch of people

armstrongMayall avatar Apr 03 '18 20:04 armstrongMayall

@rudygalfi Assuming this is intended primarily for GDPR, will Google Search and other consumers of cached AMP pages actually execute this consent flow when displaying a publisher's AMP page, or will Google obtain its own consent from EU users which will cover the display of cached AMP pages, much like what's needed for 3rd party display ads, etc? In other words, is this component intended only for publishers who serve AMP as their primary experience from the own domain, or is it also intended for cached pages served by 3rd parties like Google Search? (Eg, will Google Search require the user to click through the publisher's AMP consent flow for every publisher displayed in the Google Search carousel?)

src-code avatar Apr 04 '18 05:04 src-code

@src-code: Whilst individual companies' interpretations of applicable law may vary, it's clear that each entity that processes personal data of European users must have a valid legal basis - such as end user consent - to do so. For Google AMP cache pages, the entities processing personal data would include Google, the publisher and any vendors the publisher works with. That's why the AMP Project is building tools to enable those entities to seek consent, if they require it for their own compliance. Put simply: because the publisher chooses the behaviors and vendor integrations in the page, the publisher is primarily responsible for managing the compliance obligations that stem from those choices.

rudygalfi avatar Apr 09 '18 16:04 rudygalfi

@zhouyx Will it be default to pass credentials in the CORS requests (eg for acceptHref?) Or at least be configurable? I assume it'll be possible but not documented yet...

src-code avatar Apr 09 '18 22:04 src-code

Moving discussion from https://github.com/ampproject/amphtml/pull/14557#issuecomment-380626787 to here for more visibility (@zhouyx @src-code) regarding support for multiple consent instances. @src-code:

@zhouyx We have a requirement to show and beacon multiple steps of consent, eg a separate step for IAB consent.

@src-code, can you provide more details on the use case and user experience? As @zhouyx said, we're going with single consent support for now, but that's mainly because we'd like to collect feedback on multi-consent related experiences?

I assume by supporting, say, 2 consent states, you want two pieces of data set that can both be either "accepted" or "rejected". Then, the question is what kind of experience you want to design for gathering those. Would it be one gathered after the other serially? Do you want both toggleable kind of like checkboxes in a form?

rudygalfi avatar Apr 12 '18 00:04 rudygalfi

Is there a way to detect location on AMP pages? In the case of GDPR, we would only want to show the AMP consent messages to readers who are in the EU.

sjmeff avatar Apr 13 '18 20:04 sjmeff

@sjmeff FYI: There is <amp-geo> extension that is currently under development. Currently <amp-consent> allows you to configure the server response with the promptIfUnknown value, that tells AMP to not ask for consent if unknown.

zhouyx avatar Apr 13 '18 20:04 zhouyx

@sjmeff amp-geo is in the current dev-channel build. The server side is not yet deployed but you can test it with #amp-geo=XX to force the country code. It should be fully functional early next week, just waiting on a final code review sign off.

jpettitt avatar Apr 13 '18 21:04 jpettitt

You have an error in your example. In here:

<div id="template2">
     Can we use your cookie?
     <button on="tap:consentInstanceDEF.accept">Dismiss</button>
</div>

Either the button should have the text "Accept" or the action should be dismiss. Also, I noticed that fancy quotes have crept in; you might want to remove those.

Tonsil avatar Apr 16 '18 13:04 Tonsil

It would be beneficial for a number of reasons to make this compatible with the IAB Transparency & Consent Framework, as this is with high likelyhood the standard that most publishers will base their consent solutions on: http://advertisingconsent.eu/

jweigt avatar Apr 17 '18 08:04 jweigt

@jweigt it is in our plans to be compatible with the IAB proposed solution but can you tell us what you see to be not compatible at this point?

jasti avatar Apr 18 '18 17:04 jasti

We wanted to update this thread with some features we plan to implement in the future. Please note that we haven't committed to implement all the features and the final set will be based on the feedback we receive after amp-consent has been launched.

'checkConsentHref' related

  • Enhance ‘checkConsentHref’ to respond with additional key value pairs, including support for variable substitution that can be sent to components that are blocked on consent
  • Use amp-geo to selectively trigger consent if the user is from a certain country
  • Use amp-geo to configure different consent UIs for users from different countries

Others

  • Get consent markup in real-time instead of hardcoding it in the document
  • Support making consent buttons active only upon reading the entire consent by the user (e.g. needing to scroll all the way to the bottom indicating that the user has read the content)
  • Support for multiple amp-consents to work sequentially
  • Get amp-consent to work sequentially with amp-user-notification
  • [updated after comment below]Support per vendor consent. i.e. User should be able to accept consent on a per vendor basis.

Please add any other features that we've missed to consider or upvote any of the features with a comment.

jasti avatar Apr 18 '18 17:04 jasti

Question: For "multi-consent", are there plans to allow consent to be modeled as a set of checkboxes that get submitted with a single button like

<amp-consent id="consent">
  <input type=checkbox name=google value=google>
  <input type=checkbox name=facebook value=facebook>
  <button on="tap:consent.accept">Accept</button>
</amp-consent>

Or something like that?

cramforce avatar Apr 19 '18 16:04 cramforce

@cramforce, yes. It's actually one big difference between the way amp-consent works versus the IAB proposal - getting consent on a per vendor basis. This would also mean that each vendor integrated in AMP will need to have a unique ID recognized by ad networks because not only does the AMP page need to block requests, so does the ad auctions as well. I've updated the comment with future enhancements with this FR.

jasti avatar Apr 19 '18 16:04 jasti

I'm still trying to understand what will be required of publishers for GDPR compliance with regard to advertising seems to provide some tools that will be useful but until there is clarity of what http://advertisingconsent.eu/ means in reality its hard to know.

However, it is important that not consenting is not the same as avoiding advertising. Looking at some of the examples and ideas shown in seems to show that this can be used to show / not show parts of the page.

In the case of advertising that consent / non consent needs to be passed into the advertising system so that the advertising network (tool) can decide what to serve the user even if they can't use cookies.

Page 16/17 of http://advertisingconsent.eu/wp-content/uploads/2018/03/Transparency-Consent-Framework-Presentation-Website.pdf give some examples of what a pop up might look like and in the case of mobile devices this is a more complex version of the current (accept cookies banner that many have).

The key is can the amp-consent tool be sophisticated enough to ask the intial question and if a person wants granularity punt them to a part of the site to complete the process.

I don't know the answer but with a month until GDPR goes live there are many more questions than answers for these questions.

QES avatar Apr 20 '18 12:04 QES

@QES, some thoughts below.

  • Purpose based consent on a per vendor basis isn't supported right now but we plan to in the future.
  • Once we have purpose based consent, AMP will make the status available so each ad network implementation can read vendor consent status and purpose to process appropriately.
  • Reg UI from 16/17. Please see https://ampbyexample.com/user_consent/advanced_user_consent_flow/ and let us know if you aren't able to configure the UI as you'd like
  • Reg punting user to another site - yes, that's possible by configuring a link in the initial consent string but it isn't recommended since there is no easy way for the user to get back to the originating page.

Let us know if you have other thoughts/ comments.

jasti avatar Apr 24 '18 14:04 jasti