google-analyticsgoogle-analytics-apiservice-accountsgoogle-analytics-4google-analytics-data-api

User does not have sufficient permissions for this property


I use sample code

cd cloudshell_open/nodejs-analytics-data/samples/
node quickstart_json_credentials.js propertyId MY.json

Response is error.

7 PERMISSION_DENIED: User does not have sufficient permissions for this property. To learn more about Property ID, see https://developers.google.com/analytics/devguides/reporting/data/v1/property-id.


Solution

  • User does not have sufficient permissions for this property. To learn more about Property ID,

    Is an access issue, the user you are authenticating as does not have permissions to access the Google Analytics Account that you are trying to access.

    The tutorial you are using tells you to create a service account, you have not granted the service account permissions to access your Google Analytics account.

    Open the service account json file or go to Google developer console and find the service account email address it has an @ in it. Then go to Google analytics web application under the admin section and add the Service account as a user.

    As you are using the data api you only need to grant it read access.

    If it helps i have a video which shows you exactly how to do it. User doesn't have any google analytics accounts easy solution

    I have posted an issue on the issue form to get the sample fix. It does not tell you how to grant the service account access. 93