1
$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返回insufficient permissions error
。插入新Google分析视图时权限不足错误
当我试图获取数据,如果我输入了错误$VIEW_ID
然后打印相同的错误。
我在insert方法
现有VIEW_ID输入这些PARMS - 如果不输入任何存在VIEW_ID发生同样的错误。
第二参数已存在APP_ID。
你在这里看到一些错误吗?我仔细检查GA仪表板上的权限,一切似乎都没有问题。