Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #507

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,39 +163,39 @@ Period::create($startDate, $endDate);
### Visitors and page views

```php
public function fetchVisitorsAndPageViews(Period $period): Collection
public function fetchVisitorsAndPageViews(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
```

The function returns a `Collection` in which each item is an array that holds keys `activeUsers`, `screenPageViews` and `pageTitle`.

### Visitors and page views by date

```php
public function fetchVisitorsAndPageViewsByDate(Period $period): Collection
public function fetchVisitorsAndPageViewsByDate(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
```

The function returns a `Collection` in which each item is an array that holds keys `date`, `activeUsers`, `screenPageViews` and `pageTitle`.

### Total visitors and pageviews

```php
public function fetchTotalVisitorsAndPageViews(Period $period): Collection
public function fetchTotalVisitorsAndPageViews(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
```

The function returns a `Collection` in which each item is an array that holds keys `date`, `date`, `visitors`, and `pageViews`.

### Most visited pages

```php
public function fetchMostVisitedPages(Period $period, int $maxResults = 20): Collection
public function fetchMostVisitedPages(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
```

The function returns a `Collection` in which each item is an array that holds keys `fullPageUrl`, `pageTitle` and `screenPageViews`.

### Top referrers

```php
public function fetchTopReferrers(Period $period, int $maxResults = 20): Collection
public function fetchTopReferrers(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
```

The function returns a `Collection` in which each item is an array that holds keys `screenPageViews` and `pageReferrer`.
Expand All @@ -211,23 +211,23 @@ The function returns a `Collection` in which each item is an array that holds ke
### Top browsers

```php
public function fetchTopBrowsers(Period $period, int $maxResults = 10): Collection
public function fetchTopBrowsers(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
```

The function returns a `Collection` in which each item is an array that holds keys `screenPageViews` and `browser`.

### Top countries

```php
public function fetchTopCountries(Period $period, int $maxResults = 10): Collection
public function fetchTopCountries(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
```

The function returns a `Collection` in which each item is an array that holds keys `screenPageViews` and `country`.

### Top operating systems

```php
public function fetchTopOperatingSystems(Period $period, int $maxResults = 10): Collection
public function fetchTopOperatingSystems(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
```

The function returns a `Collection` in which each item is an array that holds keys `screenPageViews` and `operatingSystem`.
Expand Down
32 changes: 24 additions & 8 deletions src/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,16 @@ public function getPropertyId(): string
* screenPageViews: int
* }>
*/
public function fetchVisitorsAndPageViews(Period $period, int $maxResults = 10, int $offset = 0): Collection
public function fetchVisitorsAndPageViews(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
{
return $this->get(
period: $period,
metrics: ['activeUsers', 'screenPageViews'],
dimensions: ['pageTitle'],
maxResults: $maxResults,
offset: $offset,
dimensionFilter: null,
keepEmptyRows: $keepEmptyRows,
);
}

Expand All @@ -54,7 +56,7 @@ public function fetchVisitorsAndPageViews(Period $period, int $maxResults = 10,
* screenPageViews: int
* }>
*/
public function fetchVisitorsAndPageViewsByDate(Period $period, int $maxResults = 10, $offset = 0): Collection
public function fetchVisitorsAndPageViewsByDate(Period $period, int $maxResults = 10, $offset = 0, bool $keepEmptyRows = false): Collection
{
return $this->get(
period: $period,
Expand All @@ -65,6 +67,8 @@ public function fetchVisitorsAndPageViewsByDate(Period $period, int $maxResults
OrderBy::dimension('date', true),
],
offset: $offset,
dimensionFilter: null,
keepEmptyRows: $keepEmptyRows,
);
}

Expand All @@ -75,7 +79,7 @@ public function fetchVisitorsAndPageViewsByDate(Period $period, int $maxResults
* screenPageViews: int
* }>
*/
public function fetchTotalVisitorsAndPageViews(Period $period, int $maxResults = 20, int $offset = 0): Collection
public function fetchTotalVisitorsAndPageViews(Period $period, int $maxResults = 20, int $offset = 0, bool $keepEmptyRows = false): Collection
{
return $this->get(
period: $period,
Expand All @@ -86,6 +90,8 @@ public function fetchTotalVisitorsAndPageViews(Period $period, int $maxResults =
OrderBy::dimension('date', true),
],
offset: $offset,
dimensionFilter: null,
keepEmptyRows: $keepEmptyRows,
);
}

Expand All @@ -96,7 +102,7 @@ public function fetchTotalVisitorsAndPageViews(Period $period, int $maxResults =
* screenPageViews: int
* }>
*/
public function fetchMostVisitedPages(Period $period, int $maxResults = 20, int $offset = 0): Collection
public function fetchMostVisitedPages(Period $period, int $maxResults = 20, int $offset = 0, bool $keepEmptyRows = false): Collection
{
return $this->get(
period: $period,
Expand All @@ -107,6 +113,8 @@ public function fetchMostVisitedPages(Period $period, int $maxResults = 20, int
OrderBy::metric('screenPageViews', true),
],
offset: $offset,
dimensionFilter: null,
keepEmptyRows: $keepEmptyRows,
);
}

Expand All @@ -116,7 +124,7 @@ public function fetchMostVisitedPages(Period $period, int $maxResults = 20, int
* screenPageViews: int
* }>
*/
public function fetchTopReferrers(Period $period, int $maxResults = 20, int $offset = 0): Collection
public function fetchTopReferrers(Period $period, int $maxResults = 20, int $offset = 0, bool $keepEmptyRows = false): Collection
{
return $this->get(
period: $period,
Expand All @@ -127,6 +135,8 @@ public function fetchTopReferrers(Period $period, int $maxResults = 20, int $off
OrderBy::metric('screenPageViews', true),
],
offset: $offset,
dimensionFilter: null,
keepEmptyRows: $keepEmptyRows,
);
}

Expand All @@ -151,7 +161,7 @@ public function fetchUserTypes(Period $period): Collection
* screenPageViews: int
* }>
*/
public function fetchTopBrowsers(Period $period, int $maxResults = 10, int $offset = 0): Collection
public function fetchTopBrowsers(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
{
return $this->get(
period: $period,
Expand All @@ -162,6 +172,8 @@ public function fetchTopBrowsers(Period $period, int $maxResults = 10, int $offs
OrderBy::metric('screenPageViews', true),
],
offset: $offset,
dimensionFilter: null,
keepEmptyRows: $keepEmptyRows,
);
}

Expand All @@ -171,7 +183,7 @@ public function fetchTopBrowsers(Period $period, int $maxResults = 10, int $offs
* screenPageViews: int
* }>
*/
public function fetchTopCountries(Period $period, int $maxResults = 10, int $offset = 0): Collection
public function fetchTopCountries(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
{
return $this->get(
period: $period,
Expand All @@ -182,6 +194,8 @@ public function fetchTopCountries(Period $period, int $maxResults = 10, int $off
OrderBy::metric('screenPageViews', true),
],
offset: $offset,
dimensionFilter: null,
keepEmptyRows: $keepEmptyRows,
);
}

Expand All @@ -191,7 +205,7 @@ public function fetchTopCountries(Period $period, int $maxResults = 10, int $off
* screenPageViews: int
* }>
*/
public function fetchTopOperatingSystems(Period $period, int $maxResults = 10, int $offset = 0): Collection
public function fetchTopOperatingSystems(Period $period, int $maxResults = 10, int $offset = 0, bool $keepEmptyRows = false): Collection
{
return $this->get(
period: $period,
Expand All @@ -202,6 +216,8 @@ public function fetchTopOperatingSystems(Period $period, int $maxResults = 10, i
OrderBy::metric('screenPageViews', true),
],
offset: $offset,
dimensionFilter: null,
keepEmptyRows: $keepEmptyRows,
);
}

Expand Down