/** * Returns HTTP request to events url * * @return \Magento\Framework\HTTP\ZendClient */ protected function getRequest() { if (!isset($this->request)) { $this->request = $this->clientFactory->create(); $this->request->setUri($this->getEventsUrl()); $insertKey = $this->config->getInsightsInsertKey(); $this->request->setMethod(ZendClient::POST); $this->request->setHeaders(['X-Insert-Key' => $insertKey, 'Content-Type' => 'application/json']); } return $this->request; }