<commit_before>( function ( mw ) {
	'use strict';

	mw.echo = {

		clickThroughEnabled: mw.config.get( 'wgEchoConfig' ).eventlogging.EchoInteraction.enabled,

		/**
		 * Set up event logging for individual notification
		 * @param {JQuery} notification JQuery representing a single notification
		 * @param {string} context 'flyout'/'archive'
		 */
		setupNotificationLogging: function ( notification, context ) {
			var eventId = +notification.attr( 'data-notification-event' ),
				eventType = notification.attr( 'data-notification-type' );

			// Check if Schema:EchoInteraction is enabled
			if ( !mw.echo.clickThroughEnabled ) {
				return;
			}
			// Log the impression
			mw.echo.logInteraction( 'notification-impression', context, eventId, eventType );
			// Set up logging for clickthrough
			notification.find( 'a' ).click( function () {
				mw.echo.logInteraction( 'notification-link-click', context, eventId, eventType );
			} );
		},

		/**
		 * Log all Echo interaction related events
		 * @param {string} clickAction The interaction
		 * @param {string} context 'flyout'/'archive' or undefined for the badge
		 * @param {int} eventId Notification event id
		 * @param {string} eventType notification type
		 */
		logInteraction: function ( action, context, eventId, eventType ) {
			// Check if Schema:EchoInteraction is enabled
			if ( !mw.echo.clickThroughEnabled ) {
				return;
			}

			var myEvt = {
				action: action
			};

			// All the three fields below are optional
			if ( context ) {
				myEvt.context = context;
			}
			if ( eventId ) {
				myEvt.eventId = eventId;
			}
			if ( eventType ) {
				myEvt.notificationType = eventType;
			}
			mw.loader.using( 'ext.eventLogging', function() {
				mw.eventLog.logEvent( 'EchoInteraction', myEvt );
			} );
		}

	};

	if ( mw.echo.clickThroughEnabled ) {
		mw.loader.using( 'ext.eventLogging', function() {
			mw.eventLog.setDefaults( 'EchoInteraction', {
				version: mw.config.get( 'wgEchoConfig' ).version,
				userId: +mw.config.get( 'wgUserId' ),
				editCount: +mw.config.get( 'wgUserEditCount' )
			} );
		} );
	}
} )( mediaWiki );
<commit_msg>Add logging support for mobile boolean flag in EchoInteraction<commit_after>( function ( mw ) {
	'use strict';

	mw.echo = {

		clickThroughEnabled: mw.config.get( 'wgEchoConfig' ).eventlogging.EchoInteraction.enabled,

		/**
		 * Set up event logging for individual notification
		 * @param {JQuery} notification JQuery representing a single notification
		 * @param {string} context 'flyout'/'archive'
		 * @param {boolean} mobile True if interaction was on a mobile device
		 */
		setupNotificationLogging: function ( notification, context, mobile ) {
			var eventId = +notification.attr( 'data-notification-event' ),
				eventType = notification.attr( 'data-notification-type' );

			// Check if Schema:EchoInteraction is enabled
			if ( !mw.echo.clickThroughEnabled ) {
				return;
			}
			// Log the impression
			mw.echo.logInteraction( 'notification-impression', context, eventId, eventType, mobile );
			// Set up logging for clickthrough
			notification.find( 'a' ).click( function () {
				mw.echo.logInteraction( 'notification-link-click', context, eventId, eventType, mobile );
			} );
		},

		/**
		 * Log all Echo interaction related events
		 * @param {string} clickAction The interaction
		 * @param {string} context 'flyout'/'archive' or undefined for the badge
		 * @param {int} eventId Notification event id
		 * @param {string} eventType notification type
		 * @param {boolean} mobile True if interaction was on a mobile device
		 */
		logInteraction: function ( action, context, eventId, eventType, mobile ) {
			// Check if Schema:EchoInteraction is enabled
			if ( !mw.echo.clickThroughEnabled ) {
				return;
			}

			var myEvt = {
				action: action
			};

			// All the fields below are optional
			if ( context ) {
				myEvt.context = context;
			}
			if ( eventId ) {
				myEvt.eventId = eventId;
			}
			if ( eventType ) {
				myEvt.notificationType = eventType;
			}
			if ( mobile ) {
				myEvt.mobile = mobile;
			}
			mw.loader.using( 'ext.eventLogging', function() {
				mw.eventLog.logEvent( 'EchoInteraction', myEvt );
			} );
		}

	};

	if ( mw.echo.clickThroughEnabled ) {
		mw.loader.using( 'ext.eventLogging', function() {
			mw.eventLog.setDefaults( 'EchoInteraction', {
				version: mw.config.get( 'wgEchoConfig' ).version,
				userId: +mw.config.get( 'wgUserId' ),
				editCount: +mw.config.get( 'wgUserEditCount' )
			} );
		} );
	}
} )( mediaWiki );

{'fraction_non_alphanumeric': 0.12671384343210967, 'fraction_numerical': 0.0, 'mean_word_length': 3.291271347248577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4486273', 'n_tokens_mistral': 1686, 'n_tokens_neox': 1383, 'n_words': 361}