File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -95,16 +95,14 @@ public function getRealtime(
9595
9696 $ response = $ this ->runRealtimeReport ([
9797 'property ' => "properties/ {$ propertyId }" ,
98- 'date_ranges ' => [
99- $ period ->toDateRange (),
98+ 'minute_ranges ' => [
99+ $ period ->toMinuteRange (),
100100 ],
101101 'metrics ' => $ this ->getFormattedMetrics ($ metrics ),
102102 'dimensions ' => $ this ->getFormattedDimensions ($ dimensions ),
103103 'limit ' => $ maxResults ,
104- 'offset ' => $ offset ,
105104 'order_bys ' => $ orderBy ,
106105 'dimension_filter ' => $ dimensionFilter ,
107- 'keep_empty_rows ' => $ keepEmptyRows ,
108106 'metric_filter ' => $ metricFilter ,
109107 ]);
110108
Original file line number Diff line number Diff line change 55use Carbon \Carbon ;
66use DateTimeInterface ;
77use Google \Analytics \Data \V1beta \DateRange ;
8+ use Google \Analytics \Data \V1beta \MinuteRange ;
89use Illuminate \Support \Traits \Macroable ;
910use Spatie \Analytics \Exceptions \InvalidPeriod ;
1011
@@ -65,4 +66,11 @@ public function toDateRange(): DateRange
6566 ->setStartDate ($ this ->startDate ->format ('Y-m-d ' ))
6667 ->setEndDate ($ this ->endDate ->format ('Y-m-d ' ));
6768 }
69+
70+ public function toMinuteRange (): MinuteRange
71+ {
72+ return (new MinuteRange )
73+ ->setStartMinutesAgo ($ this ->endDate ->diff ($ this ->startDate )->i )
74+ ->setEndMinutesAgo ($ this ->endDate ->format ('i ' ));
75+ }
6876}
You can’t perform that action at this time.
0 commit comments