Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve vendor facing doc to collect consent related information. #27855

Merged
merged 2 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extensions/amp-consent/amp-consent.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ As a publisher, you can use the `<amp-consent>` component to implement user cont
- Capture the user’s consent decision.
- Makes the user’s setting available to elements on the AMP page to modify the page’s behavior.

If you are a vendor that wants to customize your component's behavior based on amp-consent, you can read more [here](https://github.com/ampproject/amphtml/blob/master/extensions/amp-consent/customizing-extension-behaviors-on-consent.md).
If you are a vendor that wants to customize your component's behavior based on amp-consent, or need to collect more advanced consent information you can read more [here](https://github.com/ampproject/amphtml/blob/master/extensions/amp-consent/customizing-extension-behaviors-on-consent.md).

## Usage

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,41 @@ getConsentPolicy() {

## Advanced blocking behaviors

If the vendor wants to customize an AMP extension behaviors based on user control, use the `getConsentPolicyState` API.
### On Consent State

`getConsentPolicyState` returns a promise with one of the following values:
AMP provides the consent state information for vendors to customize their behavior based on user control.

The state has the following valid values.

- `null` : no `<amp-consent>` is included
- `CONSENT_POLICY_STATE.UNKNOWN` : The consent state is unknown
- `CONSENT_POLICY_STATE.SUFFICIENT` : The consent is accepted
- `CONSENT_POLICY_STATE.INSUFFICIENT` : The consent is rejected
- `CONSENT_POLICY_STATE.UNKNOWN_NOT_REQUIRED` : The consent state is unknown, and `<amp-consent>` is informed to not prompt UI.

In addition to the consent state, the vendor can also use the
#### If you integrate with AMP as a first party AMP extension
Use the `getConsentPolicyState` API. It returns a promise with one of the `CONSENT_POLICY_STATE` value.

#### If you integrate with AMP as a third party ad vendor
Access the value within the ad iframe using `window.context.initialConsentState`. Check [this](https://github.com/ampproject/amphtml/blob/master/ads/README.md#amp-consent-integration) for more details.

#### If you integrate with AMP as an analytics vendor
Get the value using `CONSENT_STATE` macro, or `${consentState}`. A request with the varaible will only be sent out after the state has resolved to one of the above state.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here : varaible


### On Consent String ###

AMP collects raw consent string value from `checkConsentHref` endpoint or from the CMP. The it passes the raw consent string to vendors without modification.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here : The it passes

It is then up to the vendor to intepret the string and customize behavior accordingly. AMP recommends handle the string on the server side.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/handle/handling

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here : intepret


AMP will always pass the local stored consent string if there's one. Update to the string will only be reflected the next page load.

#### If you integrate with AMP as a first party AMP extension
Use the `getConsentPolicyInfo` API. `getConsentPolicyInfo` returns a promise with the raw consent string value.

Ways to get the consent string for ad/analytics vendors coming soon.

### On Related Information

In addition to the consent state and consent string, AMP extensions can also use the
`getConsentPolicySharedData` API to receive additional consent related information about
the user from the page owner. See [this](https://github.com/ampproject/amphtml/blob/master/extensions/amp-consent/amp-consent.md#response) for details about the `shareData`.