Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4129746
index.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
index.js
View Options
(
function
()
{
'use strict'
;
const
streamName
=
'mediawiki.product_metrics.translate_extension'
;
const
schemaId
=
'/analytics/product_metrics/web/translation/1.0.0'
;
const
config
=
require
(
'./config.json'
);
const
eventLoggingHelpers
=
{
isEventLoggingEnabled
:
function
()
{
return
config
.
TranslateEnableEventLogging
;
},
/**
* @param {string|null} actionSubtype
* @param {string|null} actionSource
* @param {Object|null} translation
*/
logClickEvent
:
function
(
actionSubtype
,
actionSource
,
translation
)
{
if
(
!
this
.
isEventLoggingEnabled
()
)
{
return
;
}
const
interactionData
=
{
translation
:
translation
||
{}
};
if
(
actionSubtype
)
{
// eslint-disable-next-line camelcase
interactionData
.
action_subtype
=
actionSubtype
;
}
if
(
actionSource
)
{
// eslint-disable-next-line camelcase
interactionData
.
action_source
=
actionSource
;
}
mw
.
eventLog
.
submitInteraction
(
streamName
,
schemaId
,
'click'
,
interactionData
);
},
/**
* @param {string} action
* @param {string|null} actionSubtype
* @param {string|null} actionSource
* @param {Object|null} translation
*/
logEvent
:
function
(
action
,
actionSubtype
,
actionSource
,
translation
)
{
if
(
!
config
.
TranslateEnableEventLogging
)
{
return
;
}
const
interactionData
=
{
translation
:
translation
||
{}
};
if
(
actionSubtype
)
{
// eslint-disable-next-line camelcase
interactionData
.
action_subtype
=
actionSubtype
;
}
if
(
actionSource
)
{
// eslint-disable-next-line camelcase
interactionData
.
action_source
=
actionSource
;
}
mw
.
eventLog
.
submitInteraction
(
streamName
,
schemaId
,
action
,
interactionData
);
}
};
module
.
exports
=
eventLoggingHelpers
;
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 10:04 (2 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d3/80/0e3a5e8f464f8b37ad04e7913ccf
Default Alt Text
index.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment