Brion VIBBER has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/84135


Change subject: [Bug 37278] Set X-Analytics header on XHR reqs
......................................................................

[Bug 37278] Set X-Analytics header on XHR reqs

This patch sets a default 'X-Analytics' header on all XHR requests that
declare the request as having been generated by the WikipediaMetroTest
app. The header format is as follows:

   X-Analytics: app=WikipediaMetroTest; ver=1.2.3

(Where '1.2.3' is the app version.)

The X-Analytics header was implemented by the Zero team as a generic means of
annotating requests with analytics information. The header is included in the
log format that the Varnishes broadcast at the analytics cluster.

Change-Id: Icd74f658ad2199d767a2a25d003cfb5410e03c70
---
M WikipediaMetro/WikipediaMetroTest/js/default.js
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/win8/wikipedia 
refs/changes/35/84135/1

diff --git a/WikipediaMetro/WikipediaMetroTest/js/default.js 
b/WikipediaMetro/WikipediaMetroTest/js/default.js
index 7a605cb..6244612 100644
--- a/WikipediaMetro/WikipediaMetroTest/js/default.js
+++ b/WikipediaMetro/WikipediaMetroTest/js/default.js
@@ -102,6 +102,11 @@
         return navigator.userLanguage.replace(/-.*$/, '');
     }
 
+    function getVersion() {
+        var ver = Windows.ApplicationModel.Package.current.id.version;
+        return [ ver.major, ver.minor, ver.build, ver.revision ].join('.');
+    }
+
     var beenInitialized = false;
     function setupApp() {
         return new WinJS.Promise(function (complete, error, prog) {
@@ -110,6 +115,10 @@
                 return;
             }
 
+            $.ajaxSetup({
+                headers: { 'X-Analytics': 'app=WikipediaMetroTest; ver=' + 
getVersion() }
+            });
+
             $(document).bind('mw-messages-ready', function () {
                 WinJS.UI.processAll().done(doStuff);
             });

-- 
To view, visit https://gerrit.wikimedia.org/r/84135
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd74f658ad2199d767a2a25d003cfb5410e03c70
Gerrit-PatchSet: 1
Gerrit-Project: apps/win8/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to