From 476f0c0609d92376c74b0161023190c983e5235c Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Mon, 13 Jan 2025 08:44:08 -0800 Subject: [PATCH] docs: update analytics samples in README --- AnalyticsAdmin/README.md | 6 ++++-- AnalyticsData/README.md | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/AnalyticsAdmin/README.md b/AnalyticsAdmin/README.md index 0715aaca04b..cceef761d40 100644 --- a/AnalyticsAdmin/README.md +++ b/AnalyticsAdmin/README.md @@ -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; diff --git a/AnalyticsData/README.md b/AnalyticsData/README.md index cb584c43a2b..54a7c37b680 100644 --- a/AnalyticsData/README.md +++ b/AnalyticsData/README.md @@ -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) {