Pmiazga has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403181 )

Change subject: Send events when user taps download icon
......................................................................

Send events when user taps download icon

To track "download" button interactions we have to notify
EventLogging that button was clicked. The easiest approach is
to use mw.track() and then in WikimediaEvents subscribe to the
`minerva.downloadAsPdf` events and track page impressions.

Bug: T181297
Change-Id: Iecbebe37c165dda3f26af47906662f6e5a81321d
---
M resources/skins.minerva.scripts/DownloadIcon.js
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/MinervaNeue 
refs/changes/81/403181/1

diff --git a/resources/skins.minerva.scripts/DownloadIcon.js 
b/resources/skins.minerva.scripts/DownloadIcon.js
index 5f9e3d2..989589b 100644
--- a/resources/skins.minerva.scripts/DownloadIcon.js
+++ b/resources/skins.minerva.scripts/DownloadIcon.js
@@ -1,4 +1,4 @@
-( function ( M ) {
+( function ( M, track) {
 
        var msg = mw.msg,
                MAX_PRINT_TIMEOUT = 3000,
@@ -46,13 +46,18 @@
 
                        function doPrint() {
                                self.timeout = clearTimeout( self.timeout );
+                               track( 'minerva.downloadAsPDF', {
+                                       'state': 'callPrint'
+                               } );
                                window.print();
                                hideSpinner();
                        }
-
                        // The click handler may be invoked multiple times so 
if a pending print is occurring
                        // do nothing.
                        if ( !this.timeout ) {
+                               track( 'minerva.downloadAsPDF', {
+                                       'state': 'fetchImages'
+                               } );
                                this.showSpinner();
                                // If all image downloads are taking longer to 
load then the MAX_PRINT_TIMEOUT
                                // abort the spinner and print regardless.
@@ -70,4 +75,4 @@
        } );
 
        M.define( 'skins.minerva.scripts/DownloadIcon', DownloadIcon );
-}( mw.mobileFrontend ) );
+}( mw.mobileFrontend, mw.track ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iecbebe37c165dda3f26af47906662f6e5a81321d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/MinervaNeue
Gerrit-Branch: master
Gerrit-Owner: Pmiazga <pmia...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to