$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 App 上插入 View ,但 API 返回
insufficient permissions error
.当我输入错误
$VIEW_ID
尝试获取数据时然后打印相同的错误。我已经在插入方法中输入了这些参数
你看到这里有什么错误吗?我仔细检查了 GA 仪表板上的权限,一切似乎都很好。
最佳答案
Views (Profiles): insert
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.
关于php - 插入新的 Google 分析 View 时出现权限不足错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44500224/