Topic on Extension talk:MobileFrontend

X-Analytics/mobile tracking?

2
Kchurch05 (talkcontribs)

We're using Piwik and Google Analytics, and currently the only way we can determine whether a visitor used our wiki on a mobile device is via the browser model, since we don't have a mobile URL -- and even then it's not 100% accurate, since some people prefer to use the desktop version of the site instead of the mobile version.

I did a search and saw this article on X-Analytics. I'm not a MW expert so I'm not 100% clear on what X-A does, and from the code linked it seems to only track whether a user is in alpha or beta mode.

We're currently running MW 1.21 so the X-Analytics doesn't seem to be included in that MobileFrontend version. Hopefully we'll upgrade ASAP, but I wanted to see if this was a way to get better data on mobile usage of our wiki.

Thanks all!

Awjrichards (talkcontribs)

The X-Analytics header was introduced to unify some WMF-specific analytics-related data that we've been passing around in HTTP headers. You can read a little more about it on wikitech (https://wikitech.wikimedia.org/wiki/X-Analytics), but I dont know how much that info will help for your situation. For WMF purposes, this header can get set by Varnish, MobileFrontend, and/or ZeroRatedMobileAccess (for Wikipedia Zero). This was introduced in 1.21wmf11. You could conceivably use this header for your own purposes, although it would require some hacking. MobileFrontend/includes/MobileContext.php has some methods that would allow you to manipulate the contents of that header.

Are you trying to determine the numbers of users accessing your site on a mobile device, the number of users of the mobile version of your site, or the number of requests for mobile versions of your site? If you feel confident with PHP, it would be fairly straightforward to whip up a custom Mediawiki extension to either overload the X-Analytics header or return some other custom header when a request was made for the mobile version of your site. If you want to track number of unique users, that gets a little trickier but should be doable as well.

Reply to "X-Analytics/mobile tracking?"