Jump to content

Metrics Platform/Web schema

From Wikitech

This page documents Metrics Platform's base schema for web. The schema includes three types of properties:

  • core properties: fields describing the event itself
  • interaction data: fields with custom values set by the instrument code to fit the needs of the experiment
  • contextual attributes: fields describing the performer and environment of the event

This page helps you understand which properties of each type are available, so you can plan your instrumentation specification. For property descriptions and types, see the web base schema definition.

Example event

Core properties

These properties are added automatically to every event.

  • $schema
  • dt
  • meta.stream
  • meta.domain
  • meta.id
  • meta.dt
  • meta.request_id

Instrument and experiment management

In addition, some core properties are added to events by the client to aid in instrument and experiment management. These properties are set automatically and cannot be customized. They include:

JavaScript:

  • experiments
    • assigned
    • enrolled
  • instrument_name

PHP: Unsupported

Interaction data

Metrics Platform supports interaction data that you can customize to fit the needs of your instrument. You can set these properties to any meaningful value to provide the data required for your event. See the API docs for information about how to set these properties when submitting events.

  • action (required)
  • action_context
  • action_source
  • action_subtype
  • element_friendly_name
  • element_id
  • funnel_entry_token
  • funnel_event_sequence_position
  • funnel_name

Contextual attributes

Contextual attributes provide information about the performer who triggered the event and the wiki where the event occurred. The values of contextual attributes are populated automatically by Metrics Platform when the event is generated.

While each client includes a few contextual attributes automatically, most attributes must be enabled in the instrument's event stream configuration. For more information, see Contextual attributes.

Code references

  1. gitlab:repos/data-engineering/metrics-platform/-/blob/main/js/src/ContextUtils.js
  2. gitlab:repos/data-engineering/metrics-platform/-/blob/main/js/src/ContextController.js
  3. gitlab:repos/data-engineering/metrics-platform/-/blob/main/php/src/StreamConfig/StreamConfig.php
  4. gitlab:repos/data-engineering/metrics-platform/-/blob/main/php/src/ContextController.php