Php 插入新的Google analytics视图时出现权限不足错误
我试图在GA应用程序上插入视图,但API返回Php 插入新的Google analytics视图时出现权限不足错误,php,google-analytics,google-api,google-analytics-api,google-api-php-client,Php,Google Analytics,Google Api,Google Analytics Api,Google Api Php Client,我试图在GA应用程序上插入视图,但API返回权限不足错误 当我试图获取数据时,如果输入错误的$VIEW\u ID,则会打印相同的错误 我必须在insert方法中输入这些参数 现有视图ID-如果输入“无现有视图ID”,则会发生相同的错误 第二个参数是存在的APP_ID 你看到这里有错误吗?我仔细检查了GA仪表板上的权限,一切似乎都正常 您正在验证的用户对Google Analytics帐户没有管理员权限 您尚未收到对管理API上写入方法的测试版访问权限 Web属性、视图(概要文件)和目标资源的管
权限不足错误
当我试图获取数据时,如果输入错误的$VIEW\u ID
,则会打印相同的错误
我必须在insert方法中输入这些参数
$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);