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 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
- 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.
- Assess privacy implications
- Add key-value pair to X-Analytics header when the user has enabled AMC
- Document the key-value pair
- 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:Production (arwiki)