public function pageviews()
 {
     $stats = LaravelAnalyticsFacade::getVisitorsAndPageViews(30);
     $colours = RandomColor::many(4, ['hue' => 'green']);
     return response()->json(['labels' => $stats->map(function ($day) {
         return $day['date']->format('m-d');
     })->toArray(), 'datasets' => [["fillColor" => $colours[0], "highlightFill" => $colours[1], "data" => $stats->pluck('pageViews')], ["fillColor" => $colours[2], "highlightFill" => $colours[3], "data" => $stats->pluck('visitors')]]]);
 }
 public function todayAndYesterday()
 {
     try {
         return LaravelAnalytics::getVisitorsAndPageViews(1);
     } catch (\Exception $e) {
         return false;
     }
 }
Esempio n. 3
0
 public function dashboard()
 {
     $totalVisitors = LaravelAnalyticsFacade::getVisitorsAndPageViews(30)->reduce(function ($carry, $day) {
         return $day['visitors'] + $carry;
     }, 0);
     $categories = PostCategory::with(['posts' => function ($query) {
         $query->where('published', 1);
     }])->get();
     return view('admin.pages.dashboard')->with(compact('categories', 'totalVisitors'));
 }
Esempio n. 4
0
 public function main()
 {
     if (is_null(env('ANALYTICS_SITE_ID'))) {
         return view('quarx::dashboard.empty');
     }
     foreach (LaravelAnalytics::getVisitorsAndPageViews(7) as $view) {
         $visitStats['date'][] = $view['date']->format('Y-m-d');
         $visitStats['visitors'][] = $view['visitors'];
         $visitStats['pageViews'][] = $view['pageViews'];
     }
     return view('quarx::dashboard.analytics', compact('visitStats', 'oneYear'));
 }
Esempio n. 5
0
 public function index()
 {
     try {
         $active_user = $this->getActiveUser();
         $today_visited_pages = LaravelAnalytics::getMostVisitedPages(1, 1000);
         $all_visited_pages = LaravelAnalytics::getMostVisitedPages();
         $referrers = LaravelAnalytics::getTopReferrers();
         $browsers = LaravelAnalytics::getTopBrowsers();
         $keywords = LaravelAnalytics::getTopKeywords();
         $today_and_yesterday = LaravelAnalytics::getVisitorsAndPageViews(1);
         $last_week = LaravelAnalytics::getVisitorsAndPageViewsForPeriod(Carbon::today()->subWeeks(2)->addDays(1), Carbon::today()->subWeeks(1));
         $this_week = LaravelAnalytics::getVisitorsAndPageViewsForPeriod(Carbon::today()->subWeeks(1)->addDays(1), Carbon::today());
         return view('backend::analytics.index', compact('this_week', 'last_week', 'today_and_yesterday', 'active_user', 'today_visited_pages', 'all_visited_pages', 'referrers', 'browsers', 'keywords'))->with('response', true);
     } catch (\Exception $e) {
         Logs::add('errors', trans("whole::http/controllers.analytics_log_errors_1"));
         return view('backend::analytics.index')->with('response', false);
     }
 }
 public function index()
 {
     try {
         $active_user = $this->getActiveUser();
         $today_visited_pages = LaravelAnalytics::getMostVisitedPages(1, 1000);
         $all_visited_pages = LaravelAnalytics::getMostVisitedPages();
         $referrers = LaravelAnalytics::getTopReferrers();
         $browsers = LaravelAnalytics::getTopBrowsers();
         $keywords = LaravelAnalytics::getTopKeywords();
         $today_and_yesterday = LaravelAnalytics::getVisitorsAndPageViews(1);
         $last_week = LaravelAnalytics::getVisitorsAndPageViewsForPeriod(Carbon::today()->subWeeks(2)->addDays(1), Carbon::today()->subWeeks(1));
         $this_week = LaravelAnalytics::getVisitorsAndPageViewsForPeriod(Carbon::today()->subWeeks(1)->addDays(1), Carbon::today());
         return view('backend::analytics.index', compact('this_week', 'last_week', 'today_and_yesterday', 'active_user', 'today_visited_pages', 'all_visited_pages', 'referrers', 'browsers', 'keywords'))->with('response', true);
     } catch (\Exception $e) {
         Logs::add('errors', "İstatistiklerde Beklenmeyen Hata! \nBir Veri Çekilememiş Olabilir \nAnalytics Yapılandırılmasının Doğru Olduğuna Emin Olun.");
         return view('backend::analytics.index')->with('response', false);
     }
 }