/** * @before _secure * @after setDate */ public function campaign($id = null) { $this->seo(["title" => "Campaign Insights"]); $view = $this->getActionView(); $org = $this->org; $ad = Ad::first(['_id' => $id, 'org_id' => $org->_id]); if (!$ad) { $this->_404(); } $data = Shared\Services\Campaign::performance($id, ['start' => $this->start, 'end' => $this->end, 'pid' => $this->user_id, 'meta' => true]); $view->set('stats', $data['stats'])->set('total', $data['total']); }
protected function widgets() { $meta = $this->org->meta; if (isset($meta['widget']) && isset($meta['widget']['top10pubs']) && count($meta['widget']['top10pubs']) > 0) { $widgets = $meta['widget']; return ['publishers' => $widgets['top10pubs'] ?? [], 'ads' => Shared\Services\Campaign::displayData($widgets['top10ads'] ?? [])]; } else { // fallback case return ['publishers' => [], 'ads' => []]; } }
protected function _minutely() { Shared\Services\Campaign::minutely(); Click::minutely(); }