You are here

private function Telemetry::sendEvent in Lightning Core 8.3

Same name and namespace in other branches
  1. 8.4 modules/acquia_telemetry/src/Telemetry.php \Drupal\acquia_telemetry\Telemetry::sendEvent()

Sends an event to Amplitude.

Parameters

array $event: The Amplitude event.

Return value

bool TRUE if the request to Amplitude was successful, FALSE otherwise.

See also

https://developers.amplitude.com/#http-api

1 call to Telemetry::sendEvent()
Telemetry::sendTelemetry in modules/acquia_telemetry/src/Telemetry.php
Creates and sends an event to Amplitude.

File

modules/acquia_telemetry/src/Telemetry.php, line 106

Class

Telemetry
Telemetry service.

Namespace

Drupal\acquia_telemetry

Code

private function sendEvent(array $event) {
  $response = $this->httpClient
    ->request('POST', $this->apiUrl, [
    'form_params' => [
      'api_key' => $this->apiKey,
      'event' => Json::encode($event),
    ],
  ]);
  return $response
    ->getStatusCode() === 200;
}