Search code examples
javascriptgoogle-analyticsgoogle-analytics-firebase

How do I view Custom Dimension reports in GA using Javascript Library?


I have all rights of Admin Account Though I am not Able Fetch Data of My custom dimensions

I need this data of My Account . https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/customDimensions/list

But it gives me below error : Note: i have all right of this account ..

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "insufficientPermissions",
    "message": "User does not have sufficient permissions for this account."
   }
  ],
  "code": 403,
  "message": "User does not have sufficient permissions for this account."
 }
}

if Anyone face this issue please suggest me


Solution

  • You need to provide the correct Analytics Account Id and Property Id. An easy way to get all available Ids is by calling accountSummaries.list:

    function listAccountSummaries() {
      var request = gapi.client.analytics.management.accountSummaries.list();
      request.execute(handleResponse);
    }
    

    The insufficientPermissions error tells me that you requested the data from an account and property that does not belong to you. IE you provided an account and property Id which was not in the list from the API call above.

    Perhaps you authenticated the application with your personal account and not the admin account.