As a developer I would like to have a simple way to trigger an event, so that all the data requires is set just once and I am able to avoid duplication.
## AC:
- [] Create a new action in the store to handle Event
- [] Make sure each event includes all data defined in the schema (see T321069)
- [] Make sure the action logs to the correct stream & schema (likely 'mediawiki.searchpreview' & '/analytics/mediawiki/searchpreview/1.0.0')
Below is a rough example of what said action will end up doing & what data it will have to include.
This should probably be abstracted a bit more.
```
function log( action, position ) {
mw.loader.using( [ 'ext.eventLogging', 'ext.wikimediaEvents' ] ).then( function () {
mw.eventLog.submit(
'mediawiki.searchpreview',
{
$schema: '/analytics/mediawiki/searchpreview/1.0.0',
action: action,
result_position: position,
wiki_id: mw.config.get( 'wgDBname' ),
platform: mw.config.get( 'skin' ) === 'minerva' ? 'mobile' : 'desktop',
session_id: mw.storage.get( 'wmE-sS--sessionId' )
}
);
} );
}
```
NOTE:
- The SessionId required from Search Satisfaction is not currently available. Follow T321388 for how to retrieve that piece of data.