Google Analytics v4 API + Node.js Starter Example
Google Analytics v4 API + Node.js Starter Example
February 15, 2018
Google has lots of good documentation on starting out with Google APIs (which is used for Google Analytics) for certain languages like Python, Java, and C#, but completely sketchy for Node.js. Googling there are many examples but most are for v3. And the implementations get confusing if you aren’t familiar with oAuth or JSON Web Tokens.
Here is a really simplified chunk of starter code for pulling the number of Goal 2 completions by source/medium, ordered in descending order. The assumption is that you have already set up the service account and downloaded the JSON file with the private key.
|
|