2015-06-23 383 views
1

我正在实施谷歌分析Api。

授权是不problems.After做成功授权我得到403return code,看到消息:User does not have sufficient permissions for this profile谷歌分析API

我的帐户有谷歌分析数据,跟踪多个网站,我可以从网络浏览器访问它没有问题。我已通过谷歌apis控制台允许Google Analytics(分析)API。

这里是响应全成授权之后,我得到:

array(2) { 
    ["http_code"]=> 
    int(403) 
    ["error"]=> 
    array(3) { 
    ["errors"]=> 
    array(1) { 
     [0]=> 
     array(3) { 
     ["domain"]=> 
     string(6) "global" 
     ["reason"]=> 
     string(23) "insufficientPermissions" 
     ["message"]=> 
     string(59) "User does not have sufficient permissions for this profile." 
     } 
    } 
    ["code"]=> 
    int(403) 
    ["message"]=> 
    string(59) "User does not have sufficient permissions for this profile." 
    } 
} 

任何直接的帮助将是非常可观的。谢谢

+0

为什么浪费论坛成员的时间,而不是搜索谷歌?数百人已经有这个完全相同的问题,并[已在论坛上发帖](https://encrypted.google.com/search?q=google+analytics+api+403+User+does+not+have+sufficient+权限&即= UTF-8&OE = UTF-8&水溶液= T&RLS = org.mozilla:EN-GB:官方&客户= Firefox和信道= SB)。 做搜索需要几秒钟,而且您不必等待某人回答您的问题。答案已经在那里。 –

回答

3

The Google帐户您正在使用进行身份验证,无法访问Google Analytics profile/view您正在尝试查看访问权限。

Optioions:

  1. 登录与访问该配置文件的账户。
  2. 给你的登录电子在访问该文件的用户
  3. 仔细检查你有合适的配置文件ID :)

在事件中,你使用的是服务帐户需要服务帐户的电子邮件地址并将其作为帐户级别的用户添加到Google Analytics帐户,就像您对任何用户一样。

+0

感谢好友:) –

+0

如何从Google AnalyticsAPI中读取自定义事件? –

+0

https://developers.google.com/analytics/devguides/reporting/core/dimsmets#view=detail&group=event_tracking – DaImTo

0

当您未授予访问权限或令牌已过期时,该错误很常见,请尝试检查这些参数。要做到这一点,你必须攻击以下范围。

https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=xxxxxxxxxxxx

(记得更换X为你的令牌)用正确的令牌

如果

{ 
     "azp": "1044214436568-xxxxxxxxxxx.apps.googleusercontent.com", 
     "aud": "1044214436568-xxxxxxxxxxxxxx.apps.googleusercontent.com", 
     "scope": "https://www.googleapis.com/auth/analytics.readonly", 
     "exp": "1467026930", 
     "expires_in": "3287", 
     "access_type": "offline" 
} 

尝试打正确的范围参数(在这种情况下, “https://www.googleapis.com/auth/analytics.readonly”)需要更多的帮助,添加此信息,看看你在哪里错误