Google Analytics API Authentication

I want to get some data from Google Analytics using API to display on our site using javascript.

My question is:

Can statistics be displayed without user authentication? That is, I would like to make traffic statistics available to anonymous users.

Thank you, Chris.

+3


source to share


1 answer


This is definitely possible, but you will need to get the access token yourself (server-side, using whatever OAuth 2.0 flow you want).

Once you have a valid access token, you can pass it to the component gapi.analytics.auth

and use the insert API as usual.

Here are some docs on this:
https://developers.google.com/analytics/devguides/reporting/embed/v1/component-reference#auth



UPDATE: (07/27/2015)

The Server Side Authentication API demo is now displayed on Demo & Google Analytics Tools . You should look there to see a working example.

+5


source







All Articles