Currently EventLogging will always honor the user's DNT header (see also T184793#3965300)
In T184793 we want to track virtual page views when a user hovers over a link. It has been suggested that this should ignore DNT but given we are logging these virtual page views using EventLogging and EventLogging enforces the opposite this does not happen.
@Tbayer points out in T184793#3965440 that this makes the virtual pageviews inconsistent with page view traffic (which ignores DNT).
Possible Solutions
EventLogging should provide a way for clients calling mw.track to override the DNT header in exceptional circumstances.
- We exclude DNT users from the pageview data
- We need to measure virtual page views in a different way
Short-term Outcome (Friday, 16th March)
Per T187277#4052896:
- #1 was discarded; and
- Readers Web will opt for #3: we'll use parts of the core EventLogging client-side API in order to construct the correct URL to request and make the request using sendBeacon inside of the Page Previews codebase, e.g.
const eventData = { // ... }; const payload = mw.eventLog.prepare( 'VirtualPageview', eventData); const url = mw.eventLog.makeBeaconUrl( payload ); navigator.sendBeacon( url );
Long-term Outcome
We should revisit our treatment of the user's DNT preference in order to get consensus and apply our conclusions consistently across all of our projects. This may mean opting for #2 or the exact opposite.