Created
January 27, 2014 19:49
-
-
Save clkao/8655960 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jwt = new googleapis.auth.JWT do | |
SERVICE_ACCOUNT_EMAIL | |
KEYFILE_PEM | |
null | |
['https://www.googleapis.com/auth/analytics.readonly'] | |
err, client <- googleapis.discover 'analytics', 'v3' .execute | |
err, result <- jwt.authorize | |
console.log result | |
err, result <- client.analytics.data.ga.get do | |
'ids': 'ga:XXXXXX' | |
'start-date': '2014-01-21' | |
'end-date': '2014-01-30' | |
'metrics': 'ga:visits' | |
'dimensions': 'ga:pagePathLevel2' | |
'sort': '-ga:visits' | |
'filters': 'ga:pagePathLevel1==/bills/' | |
'max-results': 25 | |
.with-auth-client jwt | |
.execute | |
if err | |
console.log 'Error', err | |
console.log result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment