Skip to content
This repository has been archived by the owner on Nov 4, 2019. It is now read-only.

alphagov/gapy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gapy

Gapy is a thin service account client for Google Analytics.

Get set up

First you need to create either a service account or client ID in your Google API Console. If you're authenticating as a service account you'll need to download your private key.

If you're authenticating as a web or installed application you'll need to download your client secrets file. Use the Google Developers Console to do this:

  • Create a Project for thte application, and add the Analytics API to the Enabled APIs list.
  • In "Credentials", click "Create new Client ID".
  • Choose "Installed Application" and type should be "Other".
  • Once it's generated your ID, click the new "Download JSON" button and save this file as client_secrets.json.

Then just create a gapy client and start querying.

  • storage_path is the location where you want gapy to keep the storage.db file that it will generate the first time it runs.
  • Ids, metrics and dimensions can be provided as lists or single values.

Google API documentation

This library is a layer over the Google Python API. If you wish to work on it, it may be necessary to consult the Google Analytics API documentation.