/** * Returns the number of views for the given dimension on a day basis for the given page. * * @param string $url * @param string $dimensionName * @param null|string $dimensionValue * * @return bool * @throws WebsiteAnalyticsException */ public function urlDimensionByDay($url, $dimensionName, $dimensionValue = null) { if (empty($url)) { throw new WebsiteAnalyticsException('You must specify a url for in order to use Webiny\\WebsiteAnalytics\\Query::urlDimensionByDay() method.'); } $result = $this->analyticsDb->query(WebsiteAnalytics::STAT_URL_VIEW, $url, $this->dateRange)->dimension($dimensionName, $dimensionValue)->groupByTimestamp()->getResult(); if ($result) { return $result; } return false; }
/** * Save the analytics data. */ private function saveLog() { $this->analyticsDb->save(); }
public function testQuery() { $query = $this->instance->query('browser', 10, DateHelper::today()); $this->assertInstanceOf('Webiny\\AnalyticsDb\\Query', $query); }