插入新的 Google 分析视图时出现权限不足错误
Insufficient permissions error when inserting a new Google analytics view
$KEY_FILE_LOCATION = __DIR__ . '/service-account-credentials.json';
// Create and configure a new client object.
$client = new \Google_Client();
$client->setApplicationName("Hello Analytics Reporting");
$client->setAuthConfig($KEY_FILE_LOCATION);
$client->setScopes(['https://www.googleapis.com/auth/analytics']);
$analytics = new \Google_Service_Analytics($client);
// Construct the body of the request and set its properties.
$profile = new \Google_Service_Analytics_Profile();
$profile->setName('View name');
$analytics->management_profiles->insert('123425914', 'UA-2344718-15', $profile);
我尝试在 GA 应用程序上插入视图,但 API return insufficient permissions error
。
当我尝试获取数据时,如果输入错误 $VIEW_ID
,则会打印相同的错误。
我在插入方法中输入了那些参数
existing VIEW_ID - 如果输入 none existing VIEW_ID,则会发生相同的错误。
第二个参数存在APP_ID.
你看到这里有什么错误吗?我仔细检查了 GA 仪表板上的权限,一切似乎都正常。
- 您进行身份验证的用户没有 Google Analytics 帐户的管理员权限。
- 您尚未获得对管理 API 上写入方法的测试访问权。
Write operations in the Management API (e.g. create, update, delete, patch) for Web Property, View (Profile), and Goal resources are currently available as a developer preview in limited beta. If you're interested in using these features, request access to the beta.
$KEY_FILE_LOCATION = __DIR__ . '/service-account-credentials.json';
// Create and configure a new client object.
$client = new \Google_Client();
$client->setApplicationName("Hello Analytics Reporting");
$client->setAuthConfig($KEY_FILE_LOCATION);
$client->setScopes(['https://www.googleapis.com/auth/analytics']);
$analytics = new \Google_Service_Analytics($client);
// Construct the body of the request and set its properties.
$profile = new \Google_Service_Analytics_Profile();
$profile->setName('View name');
$analytics->management_profiles->insert('123425914', 'UA-2344718-15', $profile);
我尝试在 GA 应用程序上插入视图,但 API return insufficient permissions error
。
当我尝试获取数据时,如果输入错误 $VIEW_ID
,则会打印相同的错误。
我在插入方法中输入了那些参数
existing VIEW_ID - 如果输入 none existing VIEW_ID,则会发生相同的错误。
第二个参数存在APP_ID.
你看到这里有什么错误吗?我仔细检查了 GA 仪表板上的权限,一切似乎都正常。
- 您进行身份验证的用户没有 Google Analytics 帐户的管理员权限。
- 您尚未获得对管理 API 上写入方法的测试访问权。
Write operations in the Management API (e.g. create, update, delete, patch) for Web Property, View (Profile), and Goal resources are currently available as a developer preview in limited beta. If you're interested in using these features, request access to the beta.