Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5972235
index.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
index.js
View Options
(
function
()
{
'use strict'
;
const
streamName
=
'/analytics/product_metrics/web/base/1.2.0'
;
const
schemaId
=
'mediawiki.product_metrics.translate_extension'
;
const
config
=
require
(
'./config.json'
);
const
eventLoggingHelpers
=
{
/**
* @param {string|null} actionSubtype
* @param {string|null} actionSource
* @param {Object|null} actionContext
*/
// eslint-disable-next-line no-unused-vars
logClickEvent
:
function
(
actionSubtype
,
actionSource
,
actionContext
)
{
if
(
!
config
.
TranslateEnableEventLogging
)
{
return
;
}
const
interactionData
=
{};
if
(
actionSubtype
)
{
// eslint-disable-next-line camelcase
interactionData
.
action_subtype
=
actionSubtype
;
}
if
(
actionSource
)
{
// eslint-disable-next-line camelcase
interactionData
.
action_source
=
actionSource
;
}
/*
Implementation can be revisited after T369687 is resolved.
if (actionContext) {
// action_context is defined as a string under
// https://gitlab.wikimedia.org/repos/data-engineering/metrics-platform/-/blob/fcdc361d04792930e5b10f0fd6bd1f3150f34737/js/src/EventData.d.ts#L104
interactionData.action_context = JSON.stringify( actionContext );
}
*/
mw
.
eventLog
.
submitClick
(
streamName
,
interactionData
);
},
/**
* @param {string} action
* @param {string|null} actionSubtype
* @param {string|null} actionSource
* @param {Object|null} actionContext
*/
// eslint-disable-next-line no-unused-vars
logEvent
:
function
(
action
,
actionSubtype
,
actionSource
,
actionContext
)
{
if
(
!
config
.
TranslateEnableEventLogging
)
{
return
;
}
const
interactionData
=
{};
if
(
actionSubtype
)
{
// eslint-disable-next-line camelcase
interactionData
.
action_subtype
=
actionSubtype
;
}
if
(
actionSource
)
{
// eslint-disable-next-line camelcase
interactionData
.
action_source
=
actionSource
;
}
/*
Implementation can be revisited after T369687 is resolved.
if ( actionContext ) {
// action_context is defined as a string under
// https://gitlab.wikimedia.org/repos/data-engineering/metrics-platform/-/blob/fcdc361d04792930e5b10f0fd6bd1f3150f34737/js/src/EventData.d.ts#L104
// eg interactionData.action_context = JSON.stringify( actionContext );
// eslint-disable-next-line camelcase
interactionData.action_context = null;
}
*/
mw
.
eventLog
.
submitInteraction
(
streamName
,
schemaId
,
action
,
null
);
}
};
module
.
exports
=
eventLoggingHelpers
;
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 3, 15:41 (1 d, 8 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
85/83/b84bcb0e18d0a5c911f6b34cbc80
Default Alt Text
index.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment