Background
In principle, the view-based metrics planned for AMC (see T210660: [EPIC] AMC Metrics ) can be determined from the data that's collected in the [[https://wikitech.wikimedia.org/wiki/Analytics/Data_Lake/Traffic/Webrequest | wmf.webrequest Hive table ]] provided that we can distinguish between regular users and those users who've enabled AMC.
We already achieve the same for users who have enabled Wikipedia's mobile beta mode by adding a well-known key-value pair to the X-Analytics header: https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/3231dee54e6abc08080627f64157848542dd323d/includes/MobileContext.php#L1022-L1034
QA
- Login and visit https://en.m.wikipedia.beta.wmflabs.org/w/index.php?title=Special:MobileOptions&returnto=Dog
- Check the X-Analytics header in DevTools for index.php. Note: this header may not show up when using DevTools' search feature!
- Try the four different modes: AMC on / beta on, AMC off / beta on, AMC on / beta off, AMC off / beta off.
- Verify each mode matches the documented output.
Acceptance Criteria
- Assess privacy implications
- Add key-value pair to X-Analytics header when the user has enabled AMC
- Document the key-value pair
Notes
- MobileFrontend's server-side manipulation of the X-Analytics header is already under test (see MobileContext::addAnalyticsLogItem).
- The value of the X-Analytics response header is logged and processed by WMF's analytics pipeline automatically, i.e. if a key-value pair is added to the header, it'll be reflected in the wmf.webrequest Hive table once it's been processed.
- MobileContext::logMobileMode exists and seems like the appropriate place to add this change.
- As @Tbayer notes in T212961#4861533, it might be easiest to add a new value to the mf-m X-Analytics key, e.g. when the user has enabled both the mobile beta mode and AMC, we set the value to mf-m=b,amc (the other possible values being =b, =amc).
QA Results
Status | Details |
✅ Passed | T212961#5020949 |
QA Results:Production (arwiki)
Status | Details |
✅ Passed | T212961#5064944 |