On any given day, if an opted-in user use the app at least once, the app will send an event to [MobileWikiAppDailyStats](https://meta.wikimedia.org/wiki/Schema:MobileWikiAppDailyStats) with an `appInstallID` generated by `WMFDailyStatsLoggingFunnel`. [MobileWikiAppDailyStats](https://meta.wikimedia.org/wiki/Schema:MobileWikiAppDailyStats) is 100% sampling.
Also, the app will send at least one API call to fetch the feed/article with an `wmfuuid` in [X-Analytics header](https://wikitech.wikimedia.org/wiki/X-Analytics) generated by `ReadingActionFunnel` (through [L15 in `AFHTTPRequestSerializer+WMFRequestHeaders.m`](https://github.com/wikimedia/wikipedia-ios/blob/1d2548e869086a279b90c2302feeb4cbadd31b59/Wikipedia/Code/AFHTTPRequestSerializer%2BWMFRequestHeaders.m#L15)). For example, when I tap to read an article "Mount Potalaka" on the app, our server will receive a request like:
`en.wikipedia.org/w/api.php?action=mobileview&format=json&noheadings=true&page=Mount%20Potalaka&pilicense=any&prop=sections%7Ctext%7Clastmodified%7Clastmodifiedby%7Clanguagecount%7Cid%7Cprotection%7Ceditable%7Cdisplaytitle%7Cthumb%7Cdescription%7Cimage%7Crevision%7Cnamespace§ionprop=toclevel%7Cline%7Canchor%7Clevel%7Cnumber%7Cfromtitle%7Cindex§ions=all&thumbwidth=640`
Along with this API call, the [X-Analytics header](https://wikitech.wikimedia.org/wiki/X-Analytics) which contains an `wmfuuid` will be sent, like:
`ns=0;page_id=25807626;loggedIn=1;WMF-Last-Access=05-Mar-2018;WMF-Last-Access-Global=05-Mar-2018;https=1;wmfuuid=3A5FC461-5F94-4B85-9857-64A552DF7D98`
(See T189359#4179759 for steps to reproduce)
The API call, X-Analytics header and other information are stored in the [`webrequest`](https://wikitech.wikimedia.org/wiki/Analytics/Data_Lake/Traffic/Webrequest) table in our hadoop cluster. We count the number of unique `wmfuuid` in `webrequest` table to get the number of unique devices, which is stored in the [`mobile_apps_uniques`](https://wikitech.wikimedia.org/wiki/Analytics/Data_Lake/Traffic/mobile_apps_uniques) table (see the [query](https://github.com/wikimedia/analytics-refinery/blob/master/oozie/mobile_apps/uniques/daily/generate_uniques_daily.hql)).
Although these two IDs are different, we should have similar (if not the same) counts of unique IDs in [MobileWikiAppDailyStats](https://meta.wikimedia.org/wiki/Schema:MobileWikiAppDailyStats) and [`mobile_apps_uniques`](https://wikitech.wikimedia.org/wiki/Analytics/Data_Lake/Traffic/mobile_apps_uniques) tables. However, we have only ~65k distinct iOS appInstallIDs daily in MobileWikiAppDailyStats, while there are ~140k distinct iOS appInstallIDs daily in mobile_apps_uniques. See the following queries:
```lang=sql
-- Get the daily number of unique IDs from mobile_apps_uniques
SELECT *
FROM wmf.mobile_apps_uniques_daily
WHERE platform = 'iOS'
AND year=2018 AND month=4
```
```lang=sql
-- Get the daily number of unique IDs from MobileWikiAppDailyStats
SELECT year, month, day, COUNT(DISTINCT event.appinstallid)
FROM event.mobilewikiappdailystats
WHERE useragent.os_family = 'iOS'
AND year=2018 AND month=4
GROUP BY year, month, day
ORDER BY day
LIMIT 30
```
This issue may be related to T189359 and T189356. We will check again after these two bugs are fixed.