@@ 42-53 (lines=12) @@ | ||
39 | return $service->query($statistics); |
|
40 | }, 'analytics'); |
|
41 | ||
42 | $browsers = Cache::remember('browsers', function () use ($service) { |
|
43 | $browsers = new Query(Configure::read('Analytics.profile_id')); |
|
44 | $browsers |
|
45 | ->setStartDate(new \DateTime(Configure::read('Analytics.start_date'))) |
|
46 | ->setEndDate(new \DateTime()) |
|
47 | ->setDimensions(['ga:browser']) |
|
48 | ->setMetrics(['ga:pageviews']) |
|
49 | ->setSorts(['ga:pageviews']) |
|
50 | ->setFilters(['ga:browser==Chrome,ga:browser==Firefox,ga:browser==Internet Explorer,ga:browser==Safari,ga:browser==Opera']); |
|
51 | ||
52 | return $service->query($browsers); |
|
53 | }, 'analytics'); |
|
54 | ||
55 | $continents = Cache::remember('continents', function () use ($service) { |
|
56 | $continentsRows = new Query(Configure::read('Analytics.profile_id')); |
|
@@ 85-95 (lines=11) @@ | ||
82 | return $continents; |
|
83 | }, 'analytics'); |
|
84 | ||
85 | $graphVisitors = Cache::remember('graphVisitors', function () use ($service) { |
|
86 | $graphVisitors = new Query(Configure::read('Analytics.profile_id')); |
|
87 | $graphVisitors |
|
88 | ->setStartDate(new \DateTime('-7 days')) |
|
89 | ->setEndDate(new \DateTime()) |
|
90 | ->setDimensions(['ga:date']) |
|
91 | ->setMetrics(['ga:visits', 'ga:pageviews']) |
|
92 | ->setSorts(['ga:date']); |
|
93 | ||
94 | return $service->query($graphVisitors); |
|
95 | }, 'analytics'); |
|
96 | ||
97 | $this->set(compact('statistics', 'browsers', 'continents', 'graphVisitors')); |
|
98 | } |