Use the browser.telemetry API to send telemetry data to the Mozilla Telemetry service. Restricted to Mozilla privileged webextensions.

Permissions: telemetry

Not allowed in: Content scripts, Devtools pages

_SubmitEncryptedPingOptions
_SubmitPingOptions
EventData
ScalarData
ScalarType
canUpload
keyedScalarAdd
keyedScalarSet
keyedScalarSetMaximum
recordEvent
registerEvents
registerScalars
scalarAdd
scalarSet
scalarSetMaximum
setEventRecordingEnabled
submitEncryptedPing
submitPing
ScalarType: "count" | "string" | "boolean"

Type of scalar: 'count' for numeric values, 'string' for string values, 'boolean' for boolean values. Maps to nsITelemetry.SCALAR_TYPE_*.

  • Checks if Telemetry upload is enabled.

    Returns Promise<any>

  • Adds the value to the given keyed scalar.

    Parameters

    • name: string

      The scalar name

    • key: string

      The key name

    • value: number

      The numeric value to add to the scalar. Only unsigned integers supported.

    Returns Promise<any>

  • Sets the keyed scalar to the given value. Throws if the value type doesn't match the scalar type.

    Parameters

    • name: string

      The scalar name.

    • key: string

      The key name.

    • value: string | number | boolean | { [key: string]: any }

      The value to set the scalar to.

    Returns Promise<any>

  • Sets the keyed scalar to the maximum of the current and the passed value

    Parameters

    • name: string

      The scalar name.

    • key: string

      The key name.

    • value: number

      The numeric value to set the scalar to. Only unsigned integers supported.

    Returns Promise<any>

  • Record an event in Telemetry. Throws when trying to record an unknown event.

    Parameters

    • category: string

      The category name.

    • method: string

      The method name.

    • object: string

      The object name.

    • Optionalvalue: string

      An optional string value to record.

    • Optionalextra: { [key: string]: string }

      An optional object of the form (string -> string). It should only contain registered extra keys.

    Returns Promise<any>

  • Register new events to record them from addons. See nsITelemetry.idl for more details.

    Parameters

    • category: string

      The unique category the events are registered in.

    • data: { [key: string]: EventData }

      An object that contains registration data for 1+ events. Each property name is the category name, and the corresponding property value is an object of EventData type.

    Returns Promise<any>

  • Register new scalars to record them from addons. See nsITelemetry.idl for more details.

    Parameters

    • category: string

      The unique category the scalars are registered in.

    • data: { [key: string]: ScalarData }

      An object that contains registration data for multiple scalars. Each property name is the scalar name, and the corresponding property value is an object of ScalarData type.

    Returns Promise<any>

  • Adds the value to the given scalar.

    Parameters

    • name: string

      The scalar name.

    • value: number

      The numeric value to add to the scalar. Only unsigned integers supported.

    Returns Promise<any>

  • Sets the named scalar to the given value. Throws if the value type doesn't match the scalar type.

    Parameters

    • name: string

      The scalar name

    • value: string | number | boolean | { [key: string]: any }

      The value to set the scalar to

    Returns Promise<any>

  • Sets the scalar to the maximum of the current and the passed value

    Parameters

    • name: string

      The scalar name.

    • value: number

      The numeric value to set the scalar to. Only unsigned integers supported.

    Returns Promise<any>

  • Enable recording of events in a category. Events default to recording disabled. This allows to toggle recording for all events in the specified category.

    Parameters

    • category: string

      The category name.

    • enabled: boolean

      Whether recording is enabled for events in that category.

    Returns Promise<any>

  • Submits a custom ping to the Telemetry back-end, with an encrypted payload. Requires a telemetry entry in the manifest to be used.

    Parameters

    • message: { [key: string]: any }

      The data payload for the ping, which will be encrypted.

    • options: _SubmitEncryptedPingOptions

      Options object.

    Returns Promise<any>

  • Submits a custom ping to the Telemetry back-end. See submitExternalPing inside TelemetryController.sys.mjs for more details.

    Parameters

    • type: string

      The type of the ping.

    • message: { [key: string]: any }

      The data payload for the ping.

    • options: _SubmitPingOptions

      Options object.

    Returns Promise<any>