The goals of eliminating schema creation during the creation of an analytics instrument and having a data contract between a data producer through to a Data Scientist are irreconcilable.
The first attempt at eliminating schema creation was to create the `analytics/mediawiki/metrics_platform` schema (AKA the monoschema). The monoschema contains many optional "Core Fields" – properties that are used relatively frequently in analytics instruments – and a `custom_data` property, which can contain arbitrary amounts of data that don't fit into those Core Fields. Using the monoschema in your instrument means that you don't have to create a new schema but also that there's no data contract between your instrument (the data producer) and the Data Scientist.
We can, however, //minimise// schema creation by providing a set of schemas and/or schema fragments that represent "Core Interactions" – interactions that are frequently instrumented, e.g.
1. The user entering/exiting a funnel
1. The user seeing a UI element
1. The user tapping/clicking a UI element
1. …
Further, for each Core Interaction schema that we provide, we can create a corresponding API and protocol for submitting an event that can be validated with that schema, e.g.
```lang=typescript
type Token = string;
interface ScopedEventSubmitter {
readonly funnelEntryToken: Token;
submitClick( elementID: string, elementFriendlyName?: string ): void;
}
interface MetricsPlatform {
/**
// 1 * Creates an event submitter that submits events to the stream. All
* submitFunnelEnterEted event( streamName: string, s will have the `funnelID: string ): string;_entry_token` property set.
submitFunnelExitEvent( streamName: string, funnelID: string }: void;
// 2 *
submitImpressionE * Before the event( streamName: string submitter is returned, friendlyName: string ): void;
// 3a `funnel_enter` event
submitElementClickedEvent * representing the user entering the funnel is submitted.
*/
enterFunnel( streamName: string, elementFriendlyName: string ): void;funnelEntryToken?: Token ): ScopedEventSubmitter;
getEnteredFunnels(): string[];
}
namespace mw {
export metricsPlatform: MetricsPlatform;
}
// ---
const PAGEVIEW_TOKEN: Token = mw.user.getPageviewToken();
const submitter = mw.metricsPlatform.enterFunnel( 'mediawiki.ui.clicks', PAGEVIEW_TOKEN );
// Later...
```submitter.submitClick( 'pt-notifications-alert', 'notifications' );
```