Skip to main content

Painless Google Analytics

Project description

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](https://code.google.com/apis/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 (Download JSON in API Access list).

Then just create a gapy client and start querying. Ids, metrics and dimensions are provided without the ga: prefix. They can be provided as lists or single values.

import gapy

# For a service account
client = gapy.client_from_private_key(
    "your account name",
    private_key="your private key",
    storage_path="path/to/storage.db")

# For a web or installed application
client = gapy.client_from_secrets_file(
    "/path/to/client_secrets.json",
    storage_path="/path/to/storage.db")
)


reach_data = client.query.get("12345",
            datetime(2012, 1, 1),
            datetime(2012, 2, 2),
            ["visits", "visitors"],
            "date")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gapy-0.0.3.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file gapy-0.0.3.tar.gz.

File metadata

  • Download URL: gapy-0.0.3.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gapy-0.0.3.tar.gz
Algorithm Hash digest
SHA256 efc14e31606d38677516bad400c42e0ca6e69fd983c0ed78646147237e8e1629
MD5 ce0c41d0e238afc5e088841b70837f7c
BLAKE2b-256 d7a50b6cb9b08185b34c353cce93e66810c7ece5f59d838e03e8b2a9e0e4d225

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page