3
votes

I have spent days looking for proper comprehensive documentation for the JavaScript client library for the Google Analytics API. The only bits I could find was this page: https://developers.google.com/analytics/devguides/reporting/core/v4/rest/ which has all of ~20 completely uninformative words on the page, and https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/web-js, which does have some actual JavaScript, but nothing like documentation. It just illustrates two or three functions using the client API.

Is there nowhere that they actually list the full API? How are we supposed to know what functionality is available?!

Then there are the pages in this section: https://developers.google.com/analytics/devguides/reporting/core/v4/basics#request_body which list a lot of query samples, but don't explain how to use any of this in a client library. Is there any practical information on how to get started with accessing the Analytics API anywhere?

Thanks

1
If this is a bad question then by all means say so but at least tell me why. - Aron
People will not like this question because it misinterprets how the API works. And SO only really like's simple how do I do X questions. Google's API's are language agnostic, Google makes available reference docs and the client libraries help you compose requests to those particular endpoints See my answer below. - Matt

1 Answers

1
votes

The Analytics API is language agnostic, the google js client library docs apply to all of Google's APIs. Every client libarary is built around the discovery service API which describes the entirety of whats is available.

How to use a client library is centrally documented and applies to every Google API.

Analytics Specific

There are lots of languages and client libraries and the Analytics API team cannot support every language. Instead they make available comprehensive reference docs which describe what endpoints are available. Once you learn how to use a particular client library calling the individual API endpoints happen in the same why.

That being said every endpoint they have is documented in JS.

The Analytics Mangement API is well documented in JavaScript. the Open source Google deomos and tools is built with it.

The Analytics Reporting API Samples page has documentated examples in JavaScript. You even linked to a Quickstart guide which should help you understand how to use the client library.

Can you expound more on what you'd expect in terms of documentation?

Final tip

If you load the analytics client library

 gapi.client.load('analytics', 'v3').then(...)

In the chrome console you can then just start playing with it dynamically:

gapi.client.analytics.managment.[hit tab]

will list all the management API methods available.