amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

[Discussion] <amp-consent> TCFv2 Support

Open zhouyx opened this issue 6 years ago • 105 comments

The Transparency and Consent Framework (TCF) is an effort to manage user consents, and have all parties understand the users consent information from regulations like GDPR.

Consent Management Platforms (CMP) helps sites to collect and manage user consent information in the TC data format. Today AMP allows a CMP to integrate with some limitations. The <amp-consent> CMP integration was designed to work with any framework that is based on a consent string format.

CMP scripts are executed in an CORS iframe that’s controlled by AMP instead of included as first party script. Because AMP handles the lifecycle of the iframe, CMPs don’t have flexibility on when to show its UI, or has the ability to provide mandatory APIs for vendors to get their TC data.

What has Changed

In the past year, the IAB TCF v2.0 has been widely adopted by most vendors. Unlike a year ago when we first designed the feature, now we don’t see the necessity to support other TC framework. This allows AMP to work together with CMPs to understand the TC data and TCF v2 APIs.

With more regulations like GDPR, we are seeing the increasing complexity for site owners to manage user consents. Thus we are seeing the trend to have more CMPs come into the area. That brings a lot more feature requests and many ask for feature parity between AMP and their non-AMP integrations.

Goal

The goal of the design revise is to come up with a solution so that

  1. Vendors don’t find integrating with AMP challenging due to user consent handling.
  2. CMPs and publishers get flexibility to manage consent prompt without hurting general user experience.
  3. AMP pages are still performant.
  4. AMP doesn’t take the liability in managing user consent data.
  5. Engineering effort is manageable.

Proposed solutions

Option 1

Allow CMP script to run in the background, it will still run in a CORS iframe, but it will be initiated at pageload time and always run in the background.
This is very similar to the CMP, non-AMP pages integration as much as possible.

Details

  • Different ad vendors will have different ways to call the TCF standard APIs
    • Fast Fetch: AMP can proxy the __tcfapi() method and send postMessage to CMP iframe
    • In iframe: Same with non AMP, Let vendor communicate with CMP iframe __tcfapiLocator directly using postMessages.
    • Analytics vendors can’t use the TCF standard APIs. AMP can provide macros for them to get vendor specific data from the TCData object. But we will start with the entire consent string.

Pros:

  • Vendors can follow the same implementations, as the same set of APIs will still be supported by CMPs.
  • Because the CMP iframe runs in the background. It has the flexibility to request to display the UI.
  • Easy implementation from the AMP side. As CMPs have all APIs provided, AMP simply passes messages between different parties.
  • This may also enable publishers to work together with CMP to manage vendors that’s not only the GVL list, as long as the two parties reach some agreement on format. (Need declarative inline config added)

Cons

  • Having CORS iframe running in the background can lead to performance and security concerns.

Option 2

This is the current approach. Pass the entire TC data consent string using AMP provided APIs

Design Details

  • AMP will provide APIs for vendors to get the complete TC data in the consent string format.
    • 3P Ad vendors can use the context.initialConsentValue
    • Fast fetch vendors can use the getConsentPolicyInfo() method
    • Analytics vendor and RTC request can use the CONSENT_STRING macro

Pros

  • No extra work on the AMP size. Support future version of the framework by default.
  • Passing TC data and handling them on the server end is the best for performance.

Cons

  • CMPs don’t get flexibility on the consent UI.
  • Difficulties for vendors to interpret TC data on the client side.
  • Ads vendors need to import libraries to do so. This can be a blocker for future vendors to integrate.

To decide if we need to change the design, we'd like to get feedback from CMPs, Ad vendors, Analytics vendors and Publishers. We are leaning towards Option 2 (The existing option) for performance reason. If so

  1. How difficult it is for ad vendors to interpret consent string without the TCF APIs
  2. Are analytics vendors OK with handling the consent string on server side?
  3. What's the limitation to CMPs having AMP runs their code in CORs iframe, and controls the lifecycle of the iframe?

cc @ampproject/wg-analytics @ampproject/wg-ads

zhouyx avatar Jan 07 '20 01:01 zhouyx

@AmazonPublisherServices @leonardlabat @bretg @wroberts-comscore for feedback since you have dealt with CONSENT_STATE and CONSENT_STRING in AMP.

@yoannOgury @PierigOgury @andresilveirah @jawadst @tla-sirdata for feedback from CMP

Thank you!

zhouyx avatar Jan 08 '20 19:01 zhouyx

Prebid Server receives RTC calls from AMP. We find it sub-optimal to have to introspect CONSENT_STRING, which could be formatted as a TCF1.0 or CCPA string.

Would it be possible to add a "CONSENT_TYPE" attribute which the CMP can add to provide a clear signal on how the string is formatted? Valid CONSENT_TYPE values could be: TCF1, TCF2, USP, etc.

How difficult it is for ad vendors to interpret consent string without the TCF APIs

Speaking for Prebid, if we had CONSENT_TYPE, we'd be happier parsing strings. We do it already in Prebid Server. In fact, we don't currently use the AMP CONSENT_STATE -- we assume that the user consent state is already encoded in the string.

It's unsatisfying and won't scale well to parse the consent string with a set of rules like:

  • if it's 4 chars and starts with a "1" it must be CCPA
  • else if it passes through the TCF1.0 parsing function, it must be TCF1.0
  • else if it passes through the TCF2.0 parsing function, it must be TCF2.0
  • else it's an error

bretg avatar Jan 27 '20 16:01 bretg

Thank you @bretg for the feedback. TCF1.0 and 2.0 should be easy to interpret as the version number is included in the TC string. But I agree that the US privacy string make things more difficult. Is there a standard name that the AMP team can follow? Could you please let us know how CMPs are passing this information in non AMP page today? Thank you

zhouyx avatar Jan 27 '20 21:01 zhouyx

In non-AMP pages, there are different IAB functions in the page that serve as the interface. For GDPR, the ad tech javascript infrastructure calls window.__cmp(). For CCPA it's window.__uspapi(). So because these separate interfaces exist, it's quite clear to the ad ecosystem how to parse the results of the call.

Being on the vendor end of RTC is quite different - we're not making the call to the CMP ourselves so don't have the context.

FWIW - prebid.js requires that publishers turn on GDPR and USPrivacy and let it know which specific interfaces to use. e.g.

pbjs.setConfig({
         consentManagement: {
           gdpr: {
            cmpApi: 'iab',  // could also be passed in statically
            ...
           },
           usp: {
             cmpApi: 'iab',  // could also be passed in statically
             ...
           }
         }
       });

bretg avatar Jan 28 '20 18:01 bretg

As a CMP first option seems attractive, it will give us more flexibility, each vendors will be able to use the exposed api or the consent string, without any specific intégration for AMP, it is the idea behind tcf implementation. This option also allows the most limited liability on AMP side.

On AMP side, the second option will need less engineering and is clearly more safe technically, and dealing with CONSENT_TYPE seems a good simple solution .

However it will force vendors to find a solution to be able to decode consent string, with one decoder by consent string type, it could be really painful for vendors, with some performances impact.

Thats why as a CMP, we prefer the first option, but the second one works also with more impacts for vendors.

In all cases, we think that AMP have to keep the hand on which kind of consent string can be provided through the amp-consent.

At the same level as the CONSENT_TYPE remark, it would also be useful to be able to set multiple consent signals (in case of a CMP managing multiple framework/regulation with one notice to the end user) 

PierigOgury avatar Jan 31 '20 14:01 PierigOgury

dealing with CONSENT_TYPE seems a good simple solution. However it will force vendors to find a solution to be able to decode consent string, with one decoder by consent string type

Not quite sure I understand you here @PierigOgury - are you suggesting that the existence of CONSENT_TYPE makes parsing harder? My take is that each RTC vendor has to have code to parse all encodings anyhow... having metadata about the encoding format just means no guessing.

bretg avatar Jan 31 '20 14:01 bretg

Hi @bretg , I mean that the first solution proposed allows to not have a decoder in case the API gives an "easier" to manage information (such as the TCF API regardless of the version). With CCPA framework it is mandatory to have a "decoder" as the API is sending only the encoded part. With the second solution a decoder is mandatory regardless of the API defined by the framework, for anyone in the amp environment (vendor and publisher). And as you mention, the CONSENT_TYPE allows for no guessing on the type of object received.

PierigOgury avatar Feb 05 '20 17:02 PierigOgury

Thanks all for the feedback.

After more discussion, the AMP team decided Option #1 is not very practical. As @PierigOgury pointed out it requires a lot engineering resources. Also it's not technically safe because AMP is not a registered CMP. Because of this we decided to stay with the current approach (Option #2)

zhouyx avatar Feb 06 '20 01:02 zhouyx

Re: CONSENT_TYPE. Sounds reasonable to add the additional information.

I only have one concern, the CONSENT_TYPE only makes sense when it is stored with consent string together and can be understand by all parties. @PierigOgury @bretg does this mean that AMP needs to declare the types of consent string framework we support and provide a list of standard type names?

zhouyx avatar Feb 06 '20 01:02 zhouyx

Hi, First sorry for my late feedback. I would like to bring more elements even if it seems the AMP team has made its decision.

I think the fact CMPs have no control on whether to display the UI is a problem. When the vendor list changes, we need to display the UI to ask consent for additional vendors while keeping previous choices. With the actual integration, we can only expire the consent string, which is obviously not what we want. TCF v2.0 also introduces a TCF Policy version that we have to take in consideration to display the UI when it changes. Additionally, the recent CNIL notice (still in public comment) indicates that the UI should be displayed again in case of "significant change". These are just some examples but we can see there can be many reasons why CMPs need to display the UI, and they change over time depending regulations and frameworks. If AMP keeps control on the display, it must ensures those rules will be applied, which I think is painful for AMP engineers and doesn't make sense as AMP is not a CMP.

As a reasonable solution, CMPs could add an attribute in the check endpoint's response to indicate to AMP that we want to display the UI while keeping the existing consent string. On AMP side, a capping could be managed to prevent CMPs from displaying the UI too often. This solution doesn't require a CORS iframe.


About reading consent data, it would be indeed very convenient for vendors to call the standard APIs and not have to decode consent strings. Actually in TCF, vendors are not supposed to decode the consent string by themselves, they should always read consents through the CMP API, which ensures them that signals are valid and the consent string is not corrupted. That point should probably be discussed with the IAB Europe as they probably didn't design the framework with AMP concerns in mind.

The limitation I see in the actual integration is that CMPs can only transmit a consent string (and maybe a future consent type). As mentioned in the discussion's description, publishers may need to work with vendors outside the GVL list (example: Google before TCF v2 adoption), so we have to transmit those additional information.

The main idea is to provide CMPs a way to transmit more information (at page load and after user submit), the challenge being to give enough flexibility to CMPs while keeping a standardized AMP structure. As a workaround to standard APIs, CMPs could then use that feature to expose decoded data to vendors. Once again no CORS iframe is needed.

tla-sirdata avatar Feb 06 '20 11:02 tla-sirdata

Talked to @jeffjose offline. We agreed that AMP can provide such CONSENT_TYPE information. TCF v1, v2 and US privacy string will be the three formats we support for now. In the future we are open to add other format to the list upon requests. The team is currently focus on adding us-ca detection capability to amp-geo, and doesn't have bandwidth to this API this sprint. We'll update the thread once we pick up the work. Thanks.

zhouyx avatar Feb 14 '20 03:02 zhouyx

As a reasonable solution, CMPs could add an attribute in the check endpoint's response to indicate to AMP that we want to display the UI while keeping the existing consent string. On AMP side, a capping could be managed to prevent CMPs from displaying the UI too often. This solution doesn't require a CORS iframe.

The only concern is user experience. @micajuine-ho @jeffjose and @lannka would like to get your thoughts on the tradeoff here.

The main idea is to provide CMPs a way to transmit more information (at page load and after user submit), the challenge being to give enough flexibility to CMPs while keeping a standardized AMP structure. As a workaround to standard APIs, CMPs could then use that feature to expose decoded data to vendors. Once again no CORS iframe is needed.

We could provide an API for CMP to pass consent data object to vendors. AMP won't store the data object or enforce the object format. My concern is that without standard structure, such type of object cannot be parsed by vendors.

zhouyx avatar Feb 14 '20 03:02 zhouyx

The only concern is user experience. @micajuine-ho @jeffjose and @lannka would like to get your thoughts on the tradeoff here.

Sorry @zhouyx, are you asking me to give my thoughts about the tradeoff here ?

tla-sirdata avatar Feb 20 '20 10:02 tla-sirdata

@zhouyx wanted to see where the AMP support for TCF version 2 stands. i'm having trouble understanding it's progress from this thread.

cmaurersp avatar Apr 14 '20 15:04 cmaurersp

@zhouyx Having worked with many vendors in the last months on TCFv1 integration with AMP, the main piece of feedback we have is that most vendors are still unclear on how they can get access to the consent string from their AMP tags.

In particular, they are struggling with two elements:

  • What tags can get access to the consent string and how (macros, usually)
  • How the different parameters on ad tags affect the availability of the consent string or the loading of tags

We have tried to summarize all common cases on https://developers.didomi.io/cmp/amp/consent-status-for-vendors and https://developers.didomi.io/cmp/amp/blocking-behaviors but I'd recommend improving the AMP docs for vendors on that front for the V2. Happy to help if there is a way for us to contribute to the docs.

jawadst avatar Apr 17 '20 00:04 jawadst

Thank you @jawadst This is very helpful! I've added you as reviewer to #27855

zhouyx avatar Apr 18 '20 01:04 zhouyx

@cmaurersp any specific detail you need?

AMP attempts to support TCF v2 as a generic TC framework as best as we can. AMP will collect and store raw consent string from CMP and pass the raw string value to vendors. As described above AMP decided not to support the TCF v2 APIs though, and expect vendors to parse the string on the server side.

zhouyx avatar Apr 18 '20 01:04 zhouyx

@cmaurersp any specific detail you need?

AMP attempts to support TCF v2 as a generic TC framework as best as we can. AMP will collect and store raw consent string from CMP and pass the raw string value to vendors. As described above AMP decided not to support the TCF v2 APIs though, and expect vendors to parse the string on the server side.

What do 3rd party CMPs need to do in order to support TCF v2 at this point in time?

cmaurersp avatar Apr 23 '20 20:04 cmaurersp

If you want to integrate your CMP solution with AMP. For example

<amp-consent type='myCMP'></amp-consent>

Please follow the CMP integration guideline here. https://github.com/ampproject/amphtml/blob/master/extensions/amp-consent/integrating-consent.md Let me know if there's any question.

zhouyx avatar Apr 23 '20 23:04 zhouyx

We are creating a CMP for our publishers and would like to do an integration test locally before we actually create a pull request. How can we create a full working demo?

Our demo looks like the following so far:

<amp-consent id="myUserConsent" layout="nodisplay">
    <script type="application/json">{
        "consentInstanceId": "consent-id",
        "consentRequired": true,
        "promptUIaaa": "consentDialog",
        "postPromptUI": "post-consent-ui",
        "checkConsentHref": "https://open-cmp-local-api.de:5003/consent/check",
        "onUpdateHref": "https://open-cmp-local-api.de:5003/consent/update",
        "promptUISrc": "https://open-cmp-local-iframe.de:5003/demo/amp/cmp-frame.html",
        "storageKey": "cmp_foo_bar"
    }</script>
    <div id="post-consent-ui">
        <button on="tap:myUserConsent.prompt()">Update Consent</button>
    </div>
</amp-consent>

In Dev tools I can see a iframe being created loading promptUISrc, which is the standalone CMP. No errors reported. But the iframe is hidden and only a spinner is displayed. It's probably something I missed, could someone give me a hint?

saraneus avatar Apr 24 '20 06:04 saraneus