diff --git a/.gitignore b/.gitignore index b6285d6..ce12fd3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ composer.lock docs vendor .phpunit.result.cache +/.idea/ diff --git a/README.md b/README.md index 734e8b9..fcf95e2 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,8 @@ Here's some extra info on the arguments you can pass: `array $offset`: Defaults to 0, you can use this in combination with the $limit param to have pagination. +`bool $keepEmptyRows`: If false or unspecified, each row with all metrics equal to 0 will not be returned. If true, these rows will be returned if they are not separately removed by a filter. + For example: ```php $orderBy = [ diff --git a/src/Analytics.php b/src/Analytics.php index e0ce836..5ca970a 100644 --- a/src/Analytics.php +++ b/src/Analytics.php @@ -180,6 +180,7 @@ public function get( array $orderBy = [], int $offset = 0, FilterExpression $dimensionFilter = null, + bool $keepEmptyRows = false, ): Collection { return $this->client->get( $this->propertyId, @@ -190,6 +191,7 @@ public function get( $orderBy, $offset, $dimensionFilter, + $keepEmptyRows ); } } diff --git a/src/AnalyticsClient.php b/src/AnalyticsClient.php index 1e86e44..66f648c 100644 --- a/src/AnalyticsClient.php +++ b/src/AnalyticsClient.php @@ -36,6 +36,7 @@ public function get( array $orderBy = [], int $offset = 0, FilterExpression $dimensionFilter = null, + bool $keepEmptyRows = false, ): Collection { $typeCaster = resolve(TypeCaster::class); @@ -50,6 +51,7 @@ public function get( 'offset' => $offset, 'orderBys' => $orderBy, 'dimensionFilter' => $dimensionFilter, + 'keepEmptyRows' => $keepEmptyRows, ]); $result = collect(); diff --git a/tests/AnalyticsTest.php b/tests/AnalyticsTest.php index 551958d..774d486 100644 --- a/tests/AnalyticsTest.php +++ b/tests/AnalyticsTest.php @@ -33,6 +33,7 @@ [], 0, null, + false, ]; $this @@ -72,6 +73,7 @@ ], 0, null, + false, ]; $this @@ -113,6 +115,7 @@ ], 0, null, + false, ]; $this @@ -155,6 +158,7 @@ ], 0, null, + false, ]; $this @@ -198,6 +202,7 @@ ], 0, null, + false, ]; $this @@ -237,6 +242,7 @@ ], 0, null, + false, ]; $this