Asher has submitted this change and it was merged.

Change subject: Add 'pageId', 'revisionId', 'action' and 'isAnon'
......................................................................


Add 'pageId', 'revisionId', 'action' and 'isAnon'

We'd like to be able to attribute page performance to user action and
page content, so log them when available. Also log whether or not the
user was logged in, since caching behavior is contingent on it.

Change-Id: I087f2647e5aa1aa0a9535bf3dc0bfcfca646d72f
---
M NavigationTiming.php
M modules/ext.navigationTiming.js
2 files changed, 17 insertions(+), 5 deletions(-)

Approvals:
  Asher: Verified; Looks good to me, approved



diff --git a/NavigationTiming.php b/NavigationTiming.php
index 1bd9cf7..39b09aa 100644
--- a/NavigationTiming.php
+++ b/NavigationTiming.php
@@ -21,7 +21,7 @@
        'author' => array(
                'Asher Feldman',
                'Ori Livneh',
-               'Patrick Reilly'
+               'Patrick Reilly',
        ),
        'descriptionmsg' => 'navigationtiming-desc',
 );
@@ -35,7 +35,7 @@
        'schema.NavigationTiming' => array(
                'class'    => 'ResourceLoaderSchemaModule',
                'schema'   => 'NavigationTiming',
-               'revision' => 5321444,
+               'revision' => 5323808,
        ),
        'ext.navigationTiming' => array(
                'scripts'       => 'ext.navigationTiming.js',
diff --git a/modules/ext.navigationTiming.js b/modules/ext.navigationTiming.js
index 540fe05..7aff935 100644
--- a/modules/ext.navigationTiming.js
+++ b/modules/ext.navigationTiming.js
@@ -24,9 +24,15 @@
 
        function emitTiming() {
                var event = {
-                       userAgent : navigator.userAgent,
-                       isHttps   : location.protocol === 'https:'
-               };
+                               userAgent : navigator.userAgent,
+                               isHttps   : location.protocol === 'https:',
+                               isAnon    : mw.user.isAnon()
+                       },
+                       page = {
+                               pageId : mw.config.get( 'wgArticleId' ),
+                               revId  : mw.config.get( 'wgCurRevisionId' ),
+                               action : mw.config.get( 'wgAction' )  // view, 
submit, etc.
+                       };
 
                if ( $.isPlainObject( window.Geo ) && typeof Geo.country === 
'string' ) {
                        event.originCountry = Geo.country;
@@ -50,6 +56,12 @@
                        event.redirecting = timing.redirectEnd - 
timing.redirectStart;
                }
 
+               // Omit page information for special pages: they don't have 
real page
+               // IDs or revisions. (They appear as 0 to client-side code.)
+               if ( page.revId ) {
+                       $.extend( event, page );
+               }
+
                mw.eventLog.logEvent( 'NavigationTiming', event );
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I087f2647e5aa1aa0a9535bf3dc0bfcfca646d72f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/NavigationTiming
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Asher <[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