Feature: tracking opt-out toggle, after amp-user-notification.dismiss
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:
- amp-user-notification not showing up after reload
- 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?
- 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>
- 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>
- 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>
- Dismiss notification to allow tracking
- Tracking should initialize afterwards
- Accept should be disabled, decline should be selectable
- Disable tracking with opt-out-state toggle
- Reload
- Accept should be selectable, decline should be disabled. Tracking should not initialize and notification should not show up
/to @avimehta
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
@avimehta What would you recommend?
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
@aghassemi just build something like this, I believe.
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 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.
This is a high priority issue but it hasn't been updated in awhile. @avimehta Do you have any updates?
@aghassemi optoutOfCid does no longer stop amp-analytics or prevent amp-analytics initialization after reload. I've build a simple demo to elaborate:
- open: https://p2er.github.io/amp-articleslider/amp-analytics-optout.html#development=1
- Clear previous analytics optin: localStorage.setItem('amp-store:'+location.origin, '');
- Reload
- Click "I accept" button in amp-user-notification overlay
- See google analytics tracking requests in network panal
- Click "Optout of CID and tracking." button
- Navigate in amp-carousel to trigger tracking events
- See new google analytics tracking requests in network panel (should no longer happen, since user used optout)
- Reload
- Does not show amp-user-notification overlay
- 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}}}"
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.
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.
This issue hasn't been updated in awhile. @rudygalfi Do you have any updates?
Have there been any changes? IANAL, but I'm concerned this is might be necessary to comply with the new European regulation (GDPR)
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.