From d75244a49b4acd93d48394e01180a960cac0ce9f Mon Sep 17 00:00:00 2001 From: Patrick Roche Date: Fri, 15 Feb 2019 11:15:31 -0500 Subject: [PATCH 01/10] Fix typo in amp-subscriptions doc --- extensions/amp-subscriptions/amp-subscriptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/amp-subscriptions/amp-subscriptions.md b/extensions/amp-subscriptions/amp-subscriptions.md index daa8c33535de..8c39a3091f75 100644 --- a/extensions/amp-subscriptions/amp-subscriptions.md +++ b/extensions/amp-subscriptions/amp-subscriptions.md @@ -411,7 +411,7 @@ Following are the events and the conditions when the events are triggered. 8. `subscriptions-entitlement-resolved`: - Once the service is registered, the entitlements from it are requested. `subscriptions-entitlement-resolved` event is triggered when the entitlement fetch from the service is completed. - This event is fired with `serviceId` and `action` of the selected service. -9. `subscriptions-started`:service +9. `subscriptions-started`: - This event is triggered when `amp-subscriptions` is initialized. - This event does not contain any data. 10. `subscriptions-action-ActionName-started`: From 28a32731871bdd9d2f5aae21ce1a54a20cf073ab Mon Sep 17 00:00:00 2001 From: Patrick Roche Date: Fri, 15 Feb 2019 11:20:26 -0500 Subject: [PATCH 02/10] Change amp-subscriptions doc intro --- extensions/amp-subscriptions/amp-subscriptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/amp-subscriptions/amp-subscriptions.md b/extensions/amp-subscriptions/amp-subscriptions.md index 8c39a3091f75..e27a710bab33 100644 --- a/extensions/amp-subscriptions/amp-subscriptions.md +++ b/extensions/amp-subscriptions/amp-subscriptions.md @@ -55,7 +55,7 @@ Implements subscription-style access protocol. ## Introduction -The `amp-subscriptions` extensions implements the subscription-style access/paywall rules. +The `amp-subscriptions` extension implements subscription-style access/paywall rules. ## Relationship to `amp-access` From 05e283a09544855fe7970ab2d35af942e750eac9 Mon Sep 17 00:00:00 2001 From: Patrick Roche Date: Fri, 15 Feb 2019 11:30:30 -0500 Subject: [PATCH 03/10] amp-subscriptions doc: update amp-access section --- extensions/amp-subscriptions/amp-subscriptions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/amp-subscriptions/amp-subscriptions.md b/extensions/amp-subscriptions/amp-subscriptions.md index e27a710bab33..e11a4cfa3a3e 100644 --- a/extensions/amp-subscriptions/amp-subscriptions.md +++ b/extensions/amp-subscriptions/amp-subscriptions.md @@ -59,20 +59,20 @@ The `amp-subscriptions` extension implements subscription-style access/paywall r ## Relationship to `amp-access` -The `amp-subscriptions` is similar to [`amp-access`](../amp-access/amp-access.md) +The `amp-subscriptions` extension is similar to [`amp-access`](../amp-access/amp-access.md) and in many features builds on top of `amp-access`. However, it's a much more specialized version of access/paywall protocol. Some of the key differences are: 1. The `amp-subscriptions` entitlements response is similar to the amp-access authorization, but it's striclty defined and standardized. 2. The `amp-subscriptions` extension allows multiple services to be configured -for the page to participate in access/paywall decisions. They are executed +for the page to participate in access/paywall decisions. Services are executed concurrently and prioritized based on which service returns the positive response. 3. AMP viewers are allowed to provide `amp-subscriptions` a signed authorization response based on an independent agreement with publishers as a proof of access. 4. In `amp-subscriptions` content markup is standardized allowing apps and crawlers to easily detect premium content sections. -Because of standardization of markup, multi provider support and improved viewer +Because of standardization of markup, support for multiple providers, and improved viewer support it is recommended that new publisher and paywall provider implementations use `amp-subscriptions`. From 8645b0fed53c23982b9a4ab3524ec359f4334f4d Mon Sep 17 00:00:00 2001 From: Patrick Roche Date: Fri, 15 Feb 2019 13:22:50 -0500 Subject: [PATCH 04/10] amp-subscriptions doc: fix typo --- extensions/amp-subscriptions/amp-subscriptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/amp-subscriptions/amp-subscriptions.md b/extensions/amp-subscriptions/amp-subscriptions.md index e11a4cfa3a3e..d8f85ecedad5 100644 --- a/extensions/amp-subscriptions/amp-subscriptions.md +++ b/extensions/amp-subscriptions/amp-subscriptions.md @@ -424,7 +424,7 @@ Following are the events and the conditions when the events are triggered. - If the event result reports a success, `subscriptions-action-ActionName-success` is triggered. - This event does not contain any data. 13. `subscriptions-action-ActionName-rejected`: - - If the event result reports a success, `subscriptions-action-ActionName-rejected` is triggered. + - If the event result reports a failure, `subscriptions-action-ActionName-rejected` is triggered. - This event does not contain any data. From 5297176a5a41aaad8be43abfed41ce060c1aad3f Mon Sep 17 00:00:00 2001 From: Patrick Roche Date: Fri, 15 Feb 2019 15:13:04 -0500 Subject: [PATCH 05/10] amp-subscriptions doc: fix error in analytics event data subscriptions-entitlement-resolved only returns serviceId --- extensions/amp-subscriptions/amp-subscriptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/amp-subscriptions/amp-subscriptions.md b/extensions/amp-subscriptions/amp-subscriptions.md index d8f85ecedad5..b78817a5681a 100644 --- a/extensions/amp-subscriptions/amp-subscriptions.md +++ b/extensions/amp-subscriptions/amp-subscriptions.md @@ -410,7 +410,7 @@ Following are the events and the conditions when the events are triggered. - This event is fired with `serviceId` and `action` of the selected service. 8. `subscriptions-entitlement-resolved`: - Once the service is registered, the entitlements from it are requested. `subscriptions-entitlement-resolved` event is triggered when the entitlement fetch from the service is completed. - - This event is fired with `serviceId` and `action` of the selected service. + - This event is fired with `serviceId` of the selected service. 9. `subscriptions-started`: - This event is triggered when `amp-subscriptions` is initialized. - This event does not contain any data. From eff0aaf42284de28eb6562fab5aadce7cd833e7b Mon Sep 17 00:00:00 2001 From: Patrick Roche Date: Fri, 15 Feb 2019 15:20:22 -0500 Subject: [PATCH 06/10] amp-subscriptions doc: change section headings --- extensions/amp-subscriptions/amp-subscriptions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extensions/amp-subscriptions/amp-subscriptions.md b/extensions/amp-subscriptions/amp-subscriptions.md index b78817a5681a..bd0dbd125c6a 100644 --- a/extensions/amp-subscriptions/amp-subscriptions.md +++ b/extensions/amp-subscriptions/amp-subscriptions.md @@ -174,7 +174,7 @@ The `services` property contains an array of service configurations. There must If you'd like to test the document's behavior in the context of a particular viewer, you can add `#viewerUrl=` fragment parameter. For instance, `#viewerUrl=https://www.google.com` would emulate a document's behavior inside a Google viewer. -## Selecting a Service +## Selecting a service If no service returns an entitlement that grants access, all services are compared by calculating a score for each and the highest scoring service is selected. Each service has a `"baseScore"` (default 0). A value < 100 in the `baseScore` key in any service configuration represents the initial score for that service. If no `baseScore` is specified it defaults to `0`. The score is calculated by taking the `baseScore` for the service and adding dynamically calculated weights from `score[factorName]` configuration multiplied by the value returned by each service for that `factorName`. Services may return a value between [-1..1] for factors they support. If a service is not aware of a factor or does not support it `0` will be returned. @@ -239,7 +239,7 @@ The vendor service configuration must reference the service ID and can contain a See the vendor service's documentation for details. -## Authorization endpoint and Entitlements +## Authorization endpoint and entitlements Authorization is an endpoint provided by the local service and called by the AMP Runtime. It is a credentialed CORS GET endpoint. This endpoint returns the Entitlements object that can be used by the Content Markup to hide or show different parts of the document. Authorization endpoint is specified using the "authorizationUrl" property in the config. @@ -388,7 +388,7 @@ The `amp-subscriptions` triggers seven types of analytics signals during the dif Following are the events and the conditions when the events are triggered. 1. `subscriptions-service-activated`: - - This event is fired when one of the services configured is selected and activated to be used(see [Selecting a Service](#selecting-a-service)). + - This event is fired when one of the services configured is selected and activated to be used(see [Selecting a service](#selecting-a-service)). - This event is fired with `serviceId` of the selected service. 2. `subscriptions-access-granted`: - This event is fired when one of the configured services is selected and the entitlement from the selected service grants access to the document. From d317fcf1f2e3c064dc7d4f1e92f790cf1010dba2 Mon Sep 17 00:00:00 2001 From: Patrick Roche Date: Fri, 15 Feb 2019 15:53:44 -0500 Subject: [PATCH 07/10] amp-subscriptions doc: revise analytics section --- .../amp-subscriptions/amp-subscriptions.md | 84 +++++++++---------- 1 file changed, 41 insertions(+), 43 deletions(-) diff --git a/extensions/amp-subscriptions/amp-subscriptions.md b/extensions/amp-subscriptions/amp-subscriptions.md index bd0dbd125c6a..1c87c27c6538 100644 --- a/extensions/amp-subscriptions/amp-subscriptions.md +++ b/extensions/amp-subscriptions/amp-subscriptions.md @@ -384,49 +384,47 @@ Values in the `data` object of an Entitlements response can be used to build exp ## Analytics -The `amp-subscriptions` triggers seven types of analytics signals during the different lifecycle of various subscriptions. -Following are the events and the conditions when the events are triggered. - -1. `subscriptions-service-activated`: - - This event is fired when one of the services configured is selected and activated to be used(see [Selecting a service](#selecting-a-service)). - - This event is fired with `serviceId` of the selected service. -2. `subscriptions-access-granted`: - - This event is fired when one of the configured services is selected and the entitlement from the selected service grants access to the document. - - This event is fired with `serviceId` of the selected service. -3. `subscriptions-access-denied`: - - This event is fired when one of the configured services is selected and the entitlement from the selected service denies access to the document. - - This event is fired with `serviceId` of the selected service. -4. `subscriptions-paywall-activated`: - - After selecting a service, if the entitlement of the service does not grant access to the document then `subscriptions-paywall-activated` is triggered. - - This event is fired with `serviceId` of the selected service. -5. `subscriptions-service-registered`: - - Since a service is free to initialize itself at anytime on the page, `subscriptions-service-registered` event is triggered when `amp-subscriptions` is able to resolve the instance of the service. - - This event is fired with `serviceId` of the selected service. -6. `subscriptions-service-re-authorized`: - - A service can request for re-authorizing itself after any action performed e.g. `Login`. Once the re-authorization is complete and new entitlement is fetched for the service ``subscriptions-service-re-authorized` is triggered. - - This event is fired with `serviceId` of the selected service. -7. `subscriptions-action-delegated`: - - A service can request its action to be delegated to another service, in such scenario `subscriptions-action-delegated` is triggered just before handing over the event to the other service. - - This event is fired with `serviceId` and `action` of the selected service. -8. `subscriptions-entitlement-resolved`: - - Once the service is registered, the entitlements from it are requested. `subscriptions-entitlement-resolved` event is triggered when the entitlement fetch from the service is completed. - - This event is fired with `serviceId` of the selected service. -9. `subscriptions-started`: - - This event is triggered when `amp-subscriptions` is initialized. - - This event does not contain any data. -10. `subscriptions-action-ActionName-started`: - - Whenever any action execution starts, the event with `subscriptions-action-ActionName-started` is fired. - - This event does not contain any data. -11. `subscriptions-action-ActionName-failed`: - - If the action execution fails due to any reason, an event with `subscriptions-action-ActionName-failed` is fired. - - This event does not contain any data. -12. `subscriptions-action-ActionName-success`: - - If the event result reports a success, `subscriptions-action-ActionName-success` is triggered. - - This event does not contain any data. -13. `subscriptions-action-ActionName-rejected`: - - If the event result reports a failure, `subscriptions-action-ActionName-rejected` is triggered. - - This event does not contain any data. - +The `amp-subscriptions` extension triggers the following analytics signals: + +1. `subscriptions-service-activated` + - Triggered when a configured service is selected and activated for use. See [Selecting a service](#selecting-a-service). + - Data: `serviceId` of the selected service. +2. `subscriptions-access-granted` + - Triggered when the entitlement from the selected service grants access to the document. + - Data: `serviceId` of the selected service. +3. `subscriptions-access-denied` + - Triggered when the entitlement from the selected service denies access to the document. + - Data: `serviceId` of the selected service. +4. `subscriptions-paywall-activated` + - Triggered when the entitlement from the selected service does not grant access to the document. + - Data: `serviceId` of the selected service. +5. `subscriptions-service-registered` + - Triggered when `amp-subscriptions` is able to resolve the instance of the service. A service is free to initialize itself at anytime on the page. + - Data: `serviceId` of the selected service. +6. `subscriptions-service-re-authorized` + - Triggered when re-authorization of a service is complete. A service can request re-authorization after any action is performed e.g., `login`. A new entitlement is fetched for the service after re-authorization is complete. + - Data: `serviceId` of the selected service. +7. `subscriptions-action-delegated` + - Triggered just before a delegated service action is handed off to the other service. See [Action delegation](##action-delegation). + - Data: `serviceId` and the delegated `action` of the selected service. +8. `subscriptions-entitlement-resolved` + - Triggered when the entitlement fetch for a service is complete. + - Data: `serviceId` and `action` of the selected service. +9. `subscriptions-started` + - Triggered when `amp-subscriptions` is initialized. + - Data: none. +10. `subscriptions-action-ActionName-started` + - Triggered when the execution of action `ActionName` starts. + - Data: none. +11. `subscriptions-action-ActionName-failed` + - Triggered when the execution of action `ActionName` fails due to any reason. + - Data: none. +12. `subscriptions-action-ActionName-success` + - Triggered when the execution result of action `ActionName` is reported as a success. + - Data: none. +13. `subscriptions-action-ActionName-rejected` + - Triggered when the execution result of action `ActionName` is reported as a failure. + - Data: none. ## Available vendor services From faf9e3d60667a21ed4ee7f1c1ae8490526268af6 Mon Sep 17 00:00:00 2001 From: Patrick Roche Date: Fri, 15 Feb 2019 16:25:55 -0500 Subject: [PATCH 08/10] amp-subscriptions doc: reorder analytics --- .../amp-subscriptions/amp-subscriptions.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/extensions/amp-subscriptions/amp-subscriptions.md b/extensions/amp-subscriptions/amp-subscriptions.md index 1c87c27c6538..03602f52c19a 100644 --- a/extensions/amp-subscriptions/amp-subscriptions.md +++ b/extensions/amp-subscriptions/amp-subscriptions.md @@ -386,33 +386,33 @@ Values in the `data` object of an Entitlements response can be used to build exp The `amp-subscriptions` extension triggers the following analytics signals: -1. `subscriptions-service-activated` +1. `subscriptions-started` + - Triggered when `amp-subscriptions` is initialized. + - Data: none. +2. `subscriptions-service-registered` + - Triggered when `amp-subscriptions` is able to resolve the instance of the service. A service is free to initialize itself at anytime on the page. +3. `subscriptions-service-activated` - Triggered when a configured service is selected and activated for use. See [Selecting a service](#selecting-a-service). - Data: `serviceId` of the selected service. -2. `subscriptions-access-granted` - - Triggered when the entitlement from the selected service grants access to the document. +4. `subscriptions-entitlement-resolved` + - Triggered when the entitlement fetch for a service is complete. + - Data: `serviceId` and `action` of the selected service. - Data: `serviceId` of the selected service. -3. `subscriptions-access-denied` - - Triggered when the entitlement from the selected service denies access to the document. +5. `subscriptions-access-granted` + - Triggered when the entitlement from the selected service grants access to the document. - Data: `serviceId` of the selected service. -4. `subscriptions-paywall-activated` +6. `subscriptions-paywall-activated` - Triggered when the entitlement from the selected service does not grant access to the document. - Data: `serviceId` of the selected service. -5. `subscriptions-service-registered` - - Triggered when `amp-subscriptions` is able to resolve the instance of the service. A service is free to initialize itself at anytime on the page. +7. `subscriptions-access-denied` + - Triggered when the entitlement from the selected service denies access to the document. - Data: `serviceId` of the selected service. -6. `subscriptions-service-re-authorized` +8. `subscriptions-service-re-authorized` - Triggered when re-authorization of a service is complete. A service can request re-authorization after any action is performed e.g., `login`. A new entitlement is fetched for the service after re-authorization is complete. - Data: `serviceId` of the selected service. -7. `subscriptions-action-delegated` - - Triggered just before a delegated service action is handed off to the other service. See [Action delegation](##action-delegation). +9. `subscriptions-action-delegated` + - Triggered just before a delegated service action is handed off to the other service. See [Action delegation](#action-delegation). - Data: `serviceId` and the delegated `action` of the selected service. -8. `subscriptions-entitlement-resolved` - - Triggered when the entitlement fetch for a service is complete. - - Data: `serviceId` and `action` of the selected service. -9. `subscriptions-started` - - Triggered when `amp-subscriptions` is initialized. - - Data: none. 10. `subscriptions-action-ActionName-started` - Triggered when the execution of action `ActionName` starts. - Data: none. From 5a0ea7c731df8579293dfe24997b5715267d210f Mon Sep 17 00:00:00 2001 From: Patrick Roche Date: Fri, 15 Feb 2019 16:56:24 -0500 Subject: [PATCH 09/10] amp-subscriptions doc: add subscriptions-link events --- extensions/amp-subscriptions/amp-subscriptions.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extensions/amp-subscriptions/amp-subscriptions.md b/extensions/amp-subscriptions/amp-subscriptions.md index 03602f52c19a..fb914802d071 100644 --- a/extensions/amp-subscriptions/amp-subscriptions.md +++ b/extensions/amp-subscriptions/amp-subscriptions.md @@ -425,6 +425,15 @@ The `amp-subscriptions` extension triggers the following analytics signals: 13. `subscriptions-action-ActionName-rejected` - Triggered when the execution result of action `ActionName` is reported as a failure. - Data: none. +14. `subscriptions-link-requested` + - Triggered when a subscription account linking request is initiated by the selected service. + - Data: `serviceId` of the selected service. +15. `subscriptions-link-complete` + - Triggered when subscription account linking has been completed by the selected service. + - Data: `serviceId` of the selected service. +16. `subscriptions-link-canceled` + - Triggered when a subscription account linking request initiated by the selected service has been cancelled. + - Data: `serviceId` of the selected service. ## Available vendor services From b3bace7e6df993fecf627abfe3634390f7f571ce Mon Sep 17 00:00:00 2001 From: Patrick Roche Date: Tue, 19 Feb 2019 10:51:37 -0500 Subject: [PATCH 10/10] amp-subscriptions doc: fix analytics section typo subscriptions-service-registered data on wrong line --- extensions/amp-subscriptions/amp-subscriptions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/amp-subscriptions/amp-subscriptions.md b/extensions/amp-subscriptions/amp-subscriptions.md index fb914802d071..57f83b42d040 100644 --- a/extensions/amp-subscriptions/amp-subscriptions.md +++ b/extensions/amp-subscriptions/amp-subscriptions.md @@ -391,13 +391,13 @@ The `amp-subscriptions` extension triggers the following analytics signals: - Data: none. 2. `subscriptions-service-registered` - Triggered when `amp-subscriptions` is able to resolve the instance of the service. A service is free to initialize itself at anytime on the page. + - Data: `serviceId` of the selected service. 3. `subscriptions-service-activated` - Triggered when a configured service is selected and activated for use. See [Selecting a service](#selecting-a-service). - Data: `serviceId` of the selected service. 4. `subscriptions-entitlement-resolved` - Triggered when the entitlement fetch for a service is complete. - Data: `serviceId` and `action` of the selected service. - - Data: `serviceId` of the selected service. 5. `subscriptions-access-granted` - Triggered when the entitlement from the selected service grants access to the document. - Data: `serviceId` of the selected service.