/**
* Execute the query by merging arrays to current ones.
*
* @param array $parameters
*
* @return $this
*/
public function execute($parameters = [], $parseResult = true)
{
$this->validateViewId();
$this->mergeParams($parameters);
/*
* A query can't run without any metrics.
*/
if (!$this->metricsAreSet()) {
throw new UndefinedMetricsException();
}
$result = $this->service->data_ga->get($this->viewId, $this->period->getStartDate()->format('Y-m-d'), $this->period->getEndDate()->format('Y-m-d'), $this->getMetricsAsString(), $this->getOptions());
if ($parseResult) {
return $this->parseResult($result);
}
return $result;
}