2015-06-23 378 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」)需要更多的幫助,添加此信息,看看你在哪裏錯誤