Get read and analyze permission in Google analytics - google-analytics

I have created my google service account using this tutorial https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/service-py
Now I want to ask for read and analyze permission from a website in order to do some data analytics. How do I do that?

the service account (with an email like quickstart#PROJECT-ID.iam.gserviceaccount.com) must be granted (at least) read permissions in the corresponding Google Analytics settings. Consider checking Analytics permissions docs

Related

Get access to clients data using API

Is it possible to make a platform where client can sign up and log in using their Google accounts, and accept that their Google Analytics data will be used for calculations.
They should accept the use only once, and then the program should download and process the Google Analytics data every day.
Please point me in the correct direction for documentation
Yes, you need to create a project in Google Cloud Platform, then go to : API and Services > Library > Google Analytics API. (This is to get analytics from an user). Then you need to create a project inside Firebase, allowing email authentication and you will be able to do your task.

Is it possible to create Service account and get p12 key programmatically for google accounts?

I need to extract Google Analytics data through it's API. However I do not want to generate any account and key manually (the reason is I do not want to let this technical this to be performed by any non-techie person) and want to dump that data for analysis purpose.
In order to use any of Googles APIs they need to know who you are. You as a developer are identified by the project you create on Google Developer console. Once the project is created you can create a number of different types of credentials including Service account credentials and Oauth2 Credentials.
Answer: No there is no way to programmaticlly create service account credentials. Nor is it possible to use the a Google api without first creating a project on Google developer console.
Note: Google Cloud Resource Manager does exist but is very limited in what it allows you to do.
If someone else is going to be running your application to access their Google analytics Data you should idealy be using Oauth2 in your application and not a service account.
Service accounts are designed as way for the developer to grant others access to data owned by the developer in question. They are not really intended for novice users to be creating their own projects on google developer console and generating credentials.
You are basically asking if you can obtain the credentials necessary to query the API via the API. This does not work.
I am also not sure how this would help you. Before you can do any API operations to a Google Analytics account you need to have an authorized user (e.g. a service account) added to your view or property. If you are in a situation where you can add a user programmatically to an account you might as well just read the data you need.

Google Analytics: updating multiple accounts

I have account that has 100 accounts, I've added a Google Service account (I can't use anything else because of 3rd party app limitation) and now I need to allow it to access all of these accounts. Seems there's no way at Google Analytics UI to do that and I will have to manually edit 100 accounts.
Is there any better way to do it? Maybe something like AdWords Editor just for Analytics?
If you have a Google User Account that has access to all the Google Analytics Accounts (which is how I interpret your first sentence) you can bulk edit them via the Google Analytics Management API, and that includes adding users that might or might not be service accounts. A reasonable easy way would be to use a Google Spreadsheet and some Google Apps Script. The script will run as the user that is currently logged in to Google and will be able to access all Analytics account that user has access to.
However you need to have necessary permissions to edit the GA accounts, so if you do not already have an authorized account you will (unsurprisingly) not be able to add one

How to retrieve Google Analytics account owner email address using API

I'm accessing the Google Analytics API v3.0 with the .NET client adapter.
This is all working very good, but I'd like to get the account owner e-mail address for a given account that I have access to.
The resource description only has Id, Name, create- and update date.
Is there a way to get more detailed data for this account? Ideally the owner e-mail address or user data would be great. I couldn't find anything in the Analytics API docs, also nothing declaring that this information is NOT possible to get...
Google Analytics account doesn't really have an "owner" per se. Each account can have multiple users with different permissions.
Recently, Google Analytics launched a new permissions model (see this blogpost for more info), and it'll be rolled out to all the users in the coming weeks. Currently, this information is not available though the Analytics API, but feel free to file a feature request here.

It is possible to create a script for generating new sites on a google analytics account?

I need to create a script (php for example) to generate new sites on a google analytics account.
I need to obtain the ID of the generated site.
¿It is possible to do it? How can i achieve it?
Thanks
No. All of the Google Analytics APIs are read-only. The only way to create new accounts is manually.
As #jk added below, from the Google Analytics Management API docs:
Google Analytics provides developer access to the configuration data
through the Management API, which is a read-only API for account and
configuration data.

Resources