amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Feature: tracking opt-out toggle, after amp-user-notification.dismiss

Open p2er opened this issue 9 years ago • 14 comments

What's the issue?

It should be possible for users to opt-out from accepted cookies handled on client side after initially dismissing the amp-user-notification. User selecting to disable cookies should result in:

  1. amp-user-notification not showing up after reload
  2. elements with related data-consent-notification-id handling content as if amp-user-notification has not been dismissed before

How do we reproduce the issue?

  1. Create amp-user-notification, e.g.:
<amp-user-notification
      layout=nodisplay
      id="amp-user-notification">
   Cookies required.
   <a href="#learn-more">Learn more.</a>
   <button on="tap:amp-user-notification.dismiss">Dismiss</button>
</amp-user-notification>
  1. Create Tracking configuration related to amp-user-notification:
<amp-analytics data-consent-notification-id="amp-user-notification">
  <script type="application/json">
    {
      "requests": {
        "event": "https://amp-publisher-samples-staging.herokuapp.com/amp-analytics/ping?user=amp-4zvBgo-_T5A2ZD3VwuOFPHhnNdKiHCzhWdzFsaxIjNlC0KO8jX6dCyV2AqK-fmqX&account=ampbyexample&event=${eventId}"
      },
      "triggers": {
        "trackPageview": {
          "on": "visible",
          "request": "event",
          "vars": {
            "eventId": "pageview"
          }
        }
      }
    }
  </script>
</amp-analytics>
  1. Create toggle to display current opt-out state and allow user to change the state. Decline should initially be disabled, accept should selectable
<amp-selector layout="container"
    data-consent-notification-id="amp-user-notification"
    name="tracking-toggle">
    <ul>
      <li option="accept">Accept cookies</li>
      <li option="decline">Decline cookies</li>
    </ul>
  </amp-selector>
  1. Dismiss notification to allow tracking
  2. Tracking should initialize afterwards
  3. Accept should be disabled, decline should be selectable
  4. Disable tracking with opt-out-state toggle
  5. Reload
  6. Accept should be selectable, decline should be disabled. Tracking should not initialize and notification should not show up

p2er avatar Jul 27 '17 09:07 p2er

/to @avimehta

jridgewell avatar Jul 27 '17 21:07 jridgewell

As an alternative you could simply add an accept and discard button to the notification. To allow users to alter their decision would therefor only require this implementation on the cookie page:

<amp-user-notification
      layout=nodisplay
      data-show-if-href="https://foo.com/showNotificationTrue.json"
      id="amp-user-notification">
   Cookies required.
   <a href="#learn-more">Learn more.</a>
   <button on="tap:amp-user-notification.discard">Discard</button>
   <button on="tap:amp-user-notification.accept">Accept</button>
</amp-user-notification>

The user-notification would just pop up again and allow the user to change their decision. Both accept and discard would cause

p2er avatar Aug 04 '17 15:08 p2er

@avimehta What would you recommend?

p2er avatar Aug 04 '17 15:08 p2er

This actually goes beyond just analytics. There have been conversations of doing something like this so the concept sounds good. Actual implementation might have to differ and needs to support some upcoming regulations.

@rudygalfi Can we put this in the list of things to do around clientIds?

/cc @cramforce

avimehta avatar Aug 07 '17 21:08 avimehta

@aghassemi just build something like this, I believe.

cramforce avatar Aug 07 '17 21:08 cramforce

sort of, @p2er we have optoutOfCid as an action on amp-user-notification but it opts out the user from tracking on that origin for all possible places that use CID, not just the ones tied to that user-notification. There is also no optin option or reporting of the status.

https://github.com/ampproject/amphtml/issues/9694 is similar to your request here

aghassemi avatar Aug 07 '17 21:08 aghassemi

@aghassemi Would solve the problem if i could call dismiss after optoutOfCid to opt in again. Maybe a simple optinToCid would be an alternative if dismiss does not work after optoutOfCid. That would allow to buttons to act as toggle for opt out.

p2er avatar Aug 15 '17 15:08 p2er

This is a high priority issue but it hasn't been updated in awhile. @avimehta Do you have any updates?

ampprojectbot avatar Oct 19 '17 21:10 ampprojectbot

@aghassemi optoutOfCid does no longer stop amp-analytics or prevent amp-analytics initialization after reload. I've build a simple demo to elaborate:

  1. open: https://p2er.github.io/amp-articleslider/amp-analytics-optout.html#development=1
  2. Clear previous analytics optin: localStorage.setItem('amp-store:'+location.origin, '');
  3. Reload
  4. Click "I accept" button in amp-user-notification overlay
  5. See google analytics tracking requests in network panal
  6. Click "Optout of CID and tracking." button
  7. Navigate in amp-carousel to trigger tracking events
  8. See new google analytics tracking requests in network panel (should no longer happen, since user used optout)
  9. Reload
  10. Does not show amp-user-notification overlay
  11. Shows pageview tracking requests (shouldn't be able to initialize amp-analytics after optout)

The optout is even written into the local storage data, but does not seem to have any effect on amp-analytics anymore. atob(localStorage.getItem('amp-store:'+location.origin)); shows "{"vv":{"amp-user-notification:amp-user-notification":{"v":true,"t":1511102520471},"amp-cid-optout":{"v":true,"t":1511102520470}}}"

p2er avatar Nov 19 '17 14:11 p2er

Hey @p2er Thanks for filing the issue. We tested your page, and it's working as expected. Please note that opt-out of cid and opt-out of tracking are two very different concepts. And your "Optout of CID and tracking" button can only support opt-out CID. AMP do set 'cid' to empty after optout, which is the correct behavior.

Right now there's no opt-out of tracking feature. Only opt-in feature is supported. If you want that feature you can always file a feature request.
Please let us know if there is any question. thanks.

zhouyx avatar Nov 20 '17 18:11 zhouyx

Hey @zhouyx this is the feature request :) As we tested optoutOfCid tied to amp-user-notification it seemed to previously also disable the tracking after execution on given notification layer, if amp-analytics was bound to it's ID. Even if this use was not intended it did solve this issue for me until recently.

p2er avatar Nov 20 '17 20:11 p2er

This issue hasn't been updated in awhile. @rudygalfi Do you have any updates?

ampprojectbot avatar Feb 26 '18 21:02 ampprojectbot

Have there been any changes? IANAL, but I'm concerned this is might be necessary to comply with the new European regulation (GDPR)

nbonnotte avatar Apr 03 '18 10:04 nbonnotte

Work is happening over here #13716 See also https://amphtml.wordpress.com/2018/04/02/enabling-publishers-to-implement-user-controls-on-amp-pages/ this very relevant post.

I'll close this issue, since the linked issue is where all the work is being done.

cramforce avatar Apr 03 '18 15:04 cramforce