private function createBody($host, $content) {
    $req = "";
    $req.= "POST /v1/import HTTP/1.1\r\n";
    $req.= "Host: " . $host . "\r\n";
    $req.= "Content-Type: application/json\r\n";
    $req.= "Authorization: Basic " . base64_encode($this->secret . ":") . "\r\n";
    $req.= "Accept: application/json\r\n";

    // Send user agent in the form of {library_name}/{library_version} as per RFC 7231.
    $content_json = json_decode($content, true);
    $library = $content_json['batch'][0]['context']['library'];
    $libName = $library['name'];
    $libVersion = $library['version'];
    $req.= "User-Agent: ${libName}/${libVersion}\r\n";

    // Compress content if compress_request is true
    if ($this->compress_request) {
      $content = gzencode($content);

      $req.= "Content-Encoding: gzip\r\n";
    }

    $req.= "Content-length: " . strlen($content) . "\r\n";
    $req.= "\r\n";
    $req.= $content;

    // Verify message size is below than 32KB
    if (strlen($req) >= 32 * 1024) {
      if ($this->debug()) {
        $msg = "Message size is larger than 32KB";
        error_log("[Analytics][" . $this->type . "] " . $msg);
      }

      return false;
    }

    return $req;
  }