public function addEvent(array $data)
    {
        if ($this->countOnly) {
            // BC support for old format
            if ($this->groupUnit && $this->chartQuery) {
                $countData = [
                    [
                        'date'  => $data['timestamp'],
                        'count' => 1,
                    ],
                ];

                $count = $this->chartQuery->completeTimeData($countData);
                $this->addToCounter($data['event'], $count);
            } else {
                if (!isset($this->totalEvents[$data['event']])) {
                    $this->totalEvents[$data['event']] = 0;
                }
                ++$this->totalEvents[$data['event']];
            }
        } else {
            if (!isset($this->events[$data['event']])) {
                $this->events[$data['event']] = [];
            }

            if (!$this->isForTimeline()) {
                // standardize the payload
                $keepThese = [
                    'event'              => true,
                    'eventId'            => true,
                    'eventLabel'         => true,
                    'eventType'          => true,
                    'timestamp'          => true,
                    'message'            => true,
                    'integratonEntityId' => true,
                    'contactId'          => true,
                    'extra'              => true,
                ];

                $data = array_intersect_key($data, $keepThese);

                // Rename extra to details
                if (isset($data['extra'])) {
                    $data['details'] = $data['extra'];
                    $data['details'] = $this->prepareDetailsForAPI($data['details']);
                    unset($data['extra']);
                }

                // Ensure a full URL
                if ($this->siteDomain && isset($data['eventLabel']) && is_array(
                        $data['eventLabel']
                    ) && isset($data['eventLabel']['href'])) {
                    // If this does not have a http, then assume a Mautic URL
                    if (false === strpos($data['eventLabel']['href'], '://')) {
                        $data['eventLabel']['href'] = $this->siteDomain.$data['eventLabel']['href'];
                    }
                }
            }

            if (empty($data['eventId'])) {
                // Every entry should have an eventId so generate one if the listener itself didn't handle this
                $data['eventId'] = $this->generateEventId($data);
            }

            $this->events[$data['event']][] = $data;
        }
    }