amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Update Consent is not working in Granular Consent

Open abhiz10 opened this issue 5 years ago • 14 comments

Description

Hi... With Reference to https://blog.amp.dev/2021/04/29/preserving-user-privacy-with-granular-consent-in-amp/ I have implemented this Granular consent feature on my website https://humor.visualstories.com, I am saving the analytics consent by default and not allowing the user to change it. I have added only analytics in the "purposeConsentRequired". "purposeConsentRequired":["purpose-analytics" ]

Please help me with the Implementation @morsssss

Reproduction Steps

If you click Ok, then only analytics data will get saved, Or But if you go to Setting and tick the other two check box and click save the all the 3 data get saved.

Now if you click on Update Consent and then untick one of the checkboxes and click save then, in that case, the Value is not getting changed in Dev Tool>Application>Storage>Local Storage

https://humor.visualstories.com/

Relevant Logs

No response

Browser(s) Affected

Chrome

AMP Version Affected

Latest

abhiz10 avatar May 25 '21 11:05 abhiz10

Hi @abhiz10 it looks like your config is incorrect.

                {
                   "consentInstanceId":"world-wide-consent",
                   "consentRequired":false,
                   "promptUI":"gCnst-dialog",
                   "promptIfUnknownForGeoGroup": "mylist",
                   "postPromptUI":"repromptDialog",
                      "uiConfig":{
                         "overlay":true
                      },
                      "purposeConsentRequired":[
                         "purpose-analytics"
                      ]
                }

1.) promptIfUnknownForGeoGroup is deprecated 2.) purposeConsentRequired needs to be a top level key, not within postPromptUI 3.) consentRequired still needs to be true

This and more information can be found on our documentation (amp.dev or in our *.md files).

Please refer to this example: https://github.com/ampproject/amphtml/blob/main/test/manual/amp-consent/amp-consent-granular-consent.html and the documentation here: https://github.com/ampproject/amphtml/blob/main/extensions/amp-consent/amp-consent.md#granular-and-global-consent

micajuine-ho avatar May 25 '21 15:05 micajuine-ho

@micajuine-ho Thank you so much. I have updated the config locally, can please check once it will be a great help. amp-geo: [For testing I have added "in" in "usca" group] { "ISOCountryGroups": { "eea": ["preset-eea"], "usca":["preset-us-ca","in"] } }

amp-consent: { "consentInstanceId":"world-wide-consent", "consentRequired":false, "purposeConsentRequired":[ "purpose-analytics" ], "geoOverride":{ "eea":{ "promptUI":"gCnst-dialog", "consentRequired":true, "postPromptUI":"repromptDialog", "uiConfig":{ "overlay":true } }, "usca":{ "consentRequired":true, "promptUI":"gCnst-dialog", "postPromptUI":"repromptDialog", "uiConfig":{ "overlay":true } } } }

Consent_Issue.zip I have attached a demo file above

Such type of Config I'm already using in my other website ~ https://travel.visualstories.com

abhiz10 avatar May 25 '21 18:05 abhiz10

You can further simplify:

{
  "consentInstanceId": "world-wide-consent",
  "consentRequired": false,
  "purposeConsentRequired": [
    "purpose-analytics"
  ],
  "promptUI": "gCnst-dialog",
  "postPromptUI": "repromptDialog",
  "uiConfig": {
    "overlay": true
  },
  "geoOverride": {
    "eea": {
      "consentRequired": true
    },
    "usca": {
      "consentRequired": true
    }
  }
}

Additionaly if both geo overrides are just changing consentRequired to true, maybe you want to squash them in your ISOCountryGroups

micajuine-ho avatar May 25 '21 18:05 micajuine-ho

@micajuine-ho Great, Thank you so much. w.r.t ~ "Additionaly if both geo overrides are just changing consentRequired to true, maybe you want to squash them in your ISOCountryGroups". Do you mean like this

"geoOverride": { "ISOCountryGroups": { "consentRequired": true }

abhiz10 avatar May 25 '21 18:05 abhiz10

i.e.

amp-geo:

"ISOCountryGroups": {
 "eeaAndUsca": ["preset-eea","preset-us-ca","in"]
}


amp-consent:

geoOverride: {
  eeaAndUsca: {...}
}

micajuine-ho avatar May 25 '21 21:05 micajuine-ho

@micajuine-ho Ok great, I got it now, Thank you so much.

abhiz10 avatar May 25 '21 21:05 abhiz10

@micajuine-ho Can I implement granular consent in amp-story format ???

abhiz10 avatar May 26 '21 05:05 abhiz10

Granular consent for stories is not currently supported. What is the use case?

micajuine-ho avatar May 26 '21 13:05 micajuine-ho

@micajuine-ho I haven't updated the code and config in amp-story. I will update it in the upcoming release. https://travel.visualstories.com/quizzes/is-your-knowledge-of-greenland-evergreen

abhiz10 avatar May 26 '21 15:05 abhiz10

@micajuine-ho As you asked for the "What is the use case?" I have only changed the config locally ~ https://vs-subdomain-appsites.azurewebsites.net/travel.visualstories.com/quizzes/is-your-knowledge-of-greenland-evergreen

Is the config correctly implemented?

abhiz10 avatar May 27 '21 18:05 abhiz10

It looks to be right. Have you tested it on your own?

micajuine-ho avatar May 28 '21 15:05 micajuine-ho

@micajuine-ho Thank you so much for your help. The latest config currently working at my end properly. I will update the code once Granular consent will be supported for stories.

abhiz10 avatar May 28 '21 15:05 abhiz10

Could you explain why you need granular consent for stories? Would an example be letting a user block certain amp-analytics vendors?

micajuine-ho avatar May 28 '21 19:05 micajuine-ho

@micajuine-ho Hi... Actually, I was thinking of uniformity of amp-consent throughout my website which includes [AMP Home Page/AMP Articles Page/ AMP-Story].

I have a question regarding ~

Would an example be letting a user block certain amp-analytics vendors?

When we implement granular consent can't we disable the checkbox of amp-analytics option that the user can't edit the setting, with a message that analytics** is mandatory?

abhiz10 avatar May 31 '21 08:05 abhiz10