User does not have a Google Analytics account

My boss signed up for a Google Analytics account and shared his Google Analytics account with me.

I now have the authority to see all the data about the website. I want to use the Google Analytics API to query data from Google Analytics using my php script.

Authorization is done without any problem until the script tries to access the data. The return code is 403 and the error message is:

The user does not have a Google Analytics account.

+3


source to share


1 answer


This will depend on which authentication method you are using.

oauth2:

When your PHP script pops up and asks the user to authenticate a Google account, the user must authenticate to be able to access the Google Analytics account. In this case, this is not the case. Note: The user will only be able to see Google Analytics data that is not listed on your website, unless your boss goes and gives them access.



service account:

If you are using a service account for authentication. The default service account does not have access to any of the Google Analytics accounts that you need to grant access, just like your boss gave you access. Take the email address of the service account from Google Developer Console and add it at the ACCOUNT level, this should be the ACCOUNT level on the Google Analytics website. then the service account will have access to the data for that account.

+1


source







All Articles