Back to Strapi

Telemetry Service

docs/docs/api/telemetry.mdx

5.47.12.8 KB
Original Source

import Type from '@site/docs/api/components/type';

Telemetry

:::info

Current state: Stable

:::

The telemetry service is responsible for collecting and sending anonymous usage data to Strapi. This service is disabled by default, but can be enabled or disabled via configuration.

Usage Information

The collected usage data is used to help Strapi improve the product by identifying areas of improvement, tracking feature adoption, and measuring performance. You can learn more about the usage data that is collected by visiting the following link:

https://docs.strapi.io/developer-docs/latest/getting-started/usage-information.html

Module: Telemetry Service

createTelemetryInstance()

The createTelemetryInstance() function returns an instance of the Telemetry service.

Examples

javascript
const createTelemetryInstance = require('path/to/telemetry');

const telemetry = createTelemetryInstance(strapi);

Methods

telemetry.register()

Registers the telemetry instance.

Examples

javascript
telemetry.register();

telemetry.bootstrap()

Bootstraps the telemetry instance.

Examples

javascript
telemetry.bootstrap();

telemetry.destroy()

Destroys the telemetry instance.

Examples

javascript
telemetry.destroy();

telemetry.send(event, payload)

  • event: <Type>String</Type> - The event to be sent.
  • payload: <Type>TelemetryPayload</Type> - The payload to be sent with the event.
  • Returns: Promise

Sends telemetry event with the given payload.

Examples

javascript
telemetry.send('event_name', { key: 'value' });

Types

TelemetryPayload

  • <Type>Object</Type>

    • eventProperties: <Type>Object</Type> An object that contains additional information about the event.
    • userProperties: <Type>Object</Type> An object that defines the identity of the user who triggered the event.
    • groupProperties: <Type>Object</Type> An object that defines properties of the application or environment in which the event occurred.

Examples of event properties in Strapi include model, containsRelationalFields, displayedFields, kind. These properties are specific to the event and are used to provide additional context about what happened.

User properties can include information such as the user's operating system, node version, and hostname. These properties are typically used to group events by user or to filter events based on certain user characteristics.

Group properties can include information such as the language(s) used in the application, the database being used, and the number of locales. These properties are typically used to group events by application version, environment, or other characteristics.