1 telemetry.api.php hook_telemetry_data($telemetry_key)

Populates the telemetry data from this module.

Data collected in this hook should be entirely anonymous. Returning data such as IP Addresses, personal information, the site name, or other values is not allowed. Contributed modules that return such information may be subject to removal from the Backdrop Contributed module repository.

Only one piece of Telemetry data is requested at a time, with $telemetry_key specifying which value should be returned. If a module provides a lot of Telemetry data, this function may be called many times with different keys to collect all of the current information.

Parameters

string $telemetry_key: Unique identifier of the data to be collected.

Return value

string: The value for the requested data.

Related topics

File

core/modules/telemetry/telemetry.api.php, line 81
Hooks provided by the Telemetry module.

Code

function hook_telemetry_data($telemetry_key) {
  switch ($telemetry_key) {
    case 'php_version':
      return PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
    case 'my_module_setting_1':
      return config_get('my_module.settings', 'setting_1');
  }
}