Skip to content

Commit

Permalink
docs: update analytics samples in README
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Jan 13, 2025
1 parent 8664206 commit 476f0c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions AnalyticsAdmin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ on authenticating your client. Once authenticated, you'll be ready to start maki
```php
require 'vendor/autoload.php';

use Google\Analytics\Admin\V1beta\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1beta\Client\AnalyticsAdminServiceClient;
use Google\Analytics\Admin\V1beta\ListAccountsRequest;

$client = new AnalyticsAdminServiceClient();

$accounts = $client->listAccounts();
$request = new ListAccountsRequest();
$accounts = $client->listAccounts($request);

foreach ($accounts as $account) {
print 'Found account: ' . $account->getName() . PHP_EOL;
Expand Down
6 changes: 4 additions & 2 deletions AnalyticsData/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ on authenticating your client. Once authenticated, you'll be ready to start maki
```php
require 'vendor/autoload.php';

use Google\Analytics\Data\V1beta\BetaAnalyticsDataClient;
use Google\Analytics\Data\V1beta\Client\BetaAnalyticsDataClient;
use Google\Analytics\Data\V1beta\RunReportRequest;

$client = new BetaAnalyticsDataClient();

$response = $client->runReport([
$request = new RunReportRequest([
'property' => 'properties/[YOUR_PROPERTY_ID]'
]);
$response = $client->runReport($request);

foreach ($response->getRows() as $row) {
foreach ($row->getDimensionValues() as $dimensionValue) {
Expand Down

0 comments on commit 476f0c0

Please sign in to comment.