自从我尝试实现需要通过 php api 插入 View (配置文件)但没有成功的服务器应用程序以来已经有很长时间了。
我已在帐户和属性中授予对我的开发者帐户服务计数电子邮件的所有访问权限,并查看用户管理。我已经制作了正确的客户端对象 $client
使用所有正确的键,然后这是我的代码:
$analytics = new Google_Service_Analytics($client);
$profile = new Google_Service_Analytics_Profile($client);
$profile->setName('websiteView_0.1');
$profile->setECommerceTracking(True);
try {
$analytics->management_profiles->insert('my_account_id', 'my_property_id', $profile);
} catch (apiServiceException $e) {
print 'There was an Analytics API service error '
. $e->getCode() . ':' . $e->getMessage();
} catch (apiException $e) {
print 'There was a general API error '
. $e->getCode() . ':' . $e->getMessage();
}
这是我的错误的屏幕截图。如果我得到适当的指导,那就太好了。
最佳答案
您似乎没有此功能的测试版访问权限。
Account Management Write operations in the Management API (e.g. create, update, delete, patch) for Web Property, View (Profile), and Goal resources is currently available as a developer preview in limited beta. If you're interested in using these features, request access to the beta.
如果您已经申请,则需要等到您从 Google 获悉您已获得访问权限。上次我请求访问时,它花了一个多月的时间,如果您获得访问权限,您将收到谷歌的消息。
关于php - (403) 当我调用 Google_Service_Analytics_Profile 对象的插入时,您的项目无权访问此功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34678720/