Skip to content

Commit

Permalink
Expand consent string size limit to 1024 (#28400)
Browse files Browse the repository at this point in the history
* expand consent string size limit to 1024

* update doc
  • Loading branch information
zhouyx authored May 14, 2020
1 parent 5363160 commit b6b0fde
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions extensions/amp-consent/0.1/consent-state-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const TAG = 'CONSENT-STATE-MANAGER';
const CID_SCOPE = 'AMP-CONSENT';

/** @visibleForTesting */
export const CONSENT_STRING_MAX_LENGTH = 200;
export const CONSENT_STRING_MAX_LENGTH = 1024;

export class ConsentStateManager {
/**
Expand Down Expand Up @@ -377,8 +377,7 @@ export class ConsentInstance {
const consentStr = consentInfo['consentString'];
if (consentStr && consentStr.length > CONSENT_STRING_MAX_LENGTH) {
// Verify the length of consentString.
// 200 * 2 (utf8Encode) * 4/3 (base64) = 533 bytes.
// TODO: Need utf8Encode if necessary.
// 1024 * 4/3 (base64) = 1336 bytes.
user().error(
TAG,
'Cannot store consentString which length exceeds %s. ' +
Expand Down
2 changes: 1 addition & 1 deletion extensions/amp-consent/integrating-consent.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To add your consent management service to AMP runtime, it is expected that you:
- Meet the restrictions that the AMP runtime applies to ensure a good user experience. These includes
- Enforce the size of the consent prompt. The only two allowed sizes are the initial size (`width: 100vw`, `height: 30vh`), and the full screen size (`width: 100vw`, `height: 100%`) after user interactions.
- A default placeholder will be displayed before the consent prompt iframe is ready.
- Enforce the size of the stored consent information. 200 character length is the current limit. Please [file an issue](https://github.com/ampproject/amphtml/issues/new) if you find that not sufficient.
- Enforce the size of the stored consent information. 1024 character length is the limit. Please [file an issue](https://github.com/ampproject/amphtml/issues/new) if you find that not sufficient.
- Understand that including `<amp-consent type='yourName'></amp-consent>` on the page won't block any components by default. **Please make sure to inform your service users to block AMP components either by the `<meta name="amp-consent-blocking">` metaTag, or the `data-block-on-consent` attribute.**
- Understand that AMP Consent doesn't attempt to interpret the consent info string from the CMP. Vendors can access the consent info string from CMPs via [provided APIs](https://github.com/ampproject/amphtml/blob/master/ads/README.md#amp-consent-integration). It's up to the CMP and service provider vendors to agree on the format of the consent info string.
- Create an [Intent-To-Implement issue](../../CONTRIBUTING.md#contributing-features) stating that you'll be adding support to your CMP service to AMP. A great start point is to follow the `_ping_` CMP service implementation that the AMP team creates for testing purpose.
Expand Down

0 comments on commit b6b0fde

Please sign in to comment.