-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
Description
Using google JWT.
i.e. in node js googleapis it works like that:
var google = require('googleapis');
var analytics = google.analytics({
version: 'v3'
});
var jwtClient = new google.auth.JWT(
config.ga.client_email,
null,
config.ga.private_key, ['https://www.googleapis.com/auth/analytics.readonly'],
null)
Then you can access your data as follow:
analytics.get({
'ids': 'ga:123456789',
'start-date': timestamp_start,
'end-date': timestamp_start,
'metrics': 'ga:sessions',
'dimensions': 'ga:socialActivityContentUrl',
'sort': '-ga:sessions',
'max-results': 10000,
auth: jwtClient
})
Therefore, you only need an email and private key and it does the rest for you (no need to auth via a webpage).