public function Telemetry::sendTelemetry in Lightning Core 8.3
Same name and namespace in other branches
- 8.4 modules/acquia_telemetry/src/Telemetry.php \Drupal\acquia_telemetry\Telemetry::sendTelemetry()
Creates and sends an event to Amplitude.
Parameters
string $event_type: The event type. This accepts any string that is not reserved. Reserved event types include: "[Amplitude] Start Session", "[Amplitude] End Session", "[Amplitude] Revenue", "[Amplitude] Revenue (Verified)", "[Amplitude] Revenue (Unverified)", and "[Amplitude] Merged User".
array $event_properties: (optional) Event properties.
Return value
bool TRUE if event was successfully sent, otherwise FALSE.
Throws
\Exception Thrown if state key acquia_telemetry.loud is TRUE and request fails.
See also
https://amplitude.zendesk.com/hc/en-us/articles/204771828#keys-for-the-e...
File
- modules/
acquia_telemetry/ src/ Telemetry.php, line 136
Class
- Telemetry
- Telemetry service.
Namespace
Drupal\acquia_telemetryCode
public function sendTelemetry($event_type, array $event_properties = []) {
$event = $this
->createEvent($event_type, $event_properties);
// Failure to send Telemetry should never cause a user facing error or
// interrupt a process. Telemetry failure should be graceful and quiet.
try {
return $this
->sendEvent($event);
} catch (\Exception $e) {
if ($this->state
->get('acquia_telemetry.loud')) {
throw new \Exception($e
->getMessage(), $e
->getCode(), $e);
}
return FALSE;
}
}