GoogleAnalytics

class googleanalytics.GoogleAnalytics(access_token=None)

Create a Google Analytics service.

Variables:access_token

Management

GoogleAnalytics.management()

Return the resource corresponding to the management API

Account

Management.account(account_id)

Return the resource corresponding to a single account

WebProperties

Account.webproperties()

Return the resource corresponding to all web properties

WebProperties.get(max_results=None, start_index=None, userIp=None, quotaUser=None)

List resource

Variables:
  • max-results (int) – The maximum number of rows to include in the response
  • start-index (int) – The first row of data to retrieve, starting at 1. Use this parameter as a pagination mechanism along with the max-results parameter.
  • userIp (str) – Specifies IP address of the end user for whom the API call is being made. Used to cap usage per IP.
  • quotaUser (str) – Alternative to userIp in cases when the user’s IP address is unknown.

WebProperty

Account.webproperty(webproperty_id)

Return the resource corresponding to a single property

View

WebProperty.view(profile_id)

Return the resource corresponding to a single view

Goal

View.goal(goal_id)

Return the resource corresponding to a single goal

Goal.get(userIp=None, quotaUser=None)

Get resource

Variables:
  • userIp (str) – Specifies IP address of the end user for whom the API call is being made. Used to cap usage per IP.
  • quotaUser (str) – Alternative to userIp in cases when the user’s IP address is unknown.

Goals

View.goals()

Return the resource corresponding to all goals

Goals.get(max_results=None, start_index=None, userIp=None, quotaUser=None)

List resource

Variables:
  • max-results (int) – The maximum number of rows to include in the response
  • start-index (int) – The first row of data to retrieve, starting at 1. Use this parameter as a pagination mechanism along with the max-results parameter.
  • userIp (str) – Specifies IP address of the end user for whom the API call is being made. Used to cap usage per IP.
  • quotaUser (str) – Alternative to userIp in cases when the user’s IP address is unknown.
View.get(userIp=None, quotaUser=None)

Get resource

Variables:
  • userIp (str) – Specifies IP address of the end user for whom the API call is being made. Used to cap usage per IP.
  • quotaUser (str) – Alternative to userIp in cases when the user’s IP address is unknown.

Views

WebProperty.views()

Return the resource corresponding to all views

Views.get(max_results=None, start_index=None, userIp=None, quotaUser=None)

List resource

Variables:
  • max-results (int) – The maximum number of rows to include in the response
  • start-index (int) – The first row of data to retrieve, starting at 1. Use this parameter as a pagination mechanism along with the max-results parameter.
  • userIp (str) – Specifies IP address of the end user for whom the API call is being made. Used to cap usage per IP.
  • quotaUser (str) – Alternative to userIp in cases when the user’s IP address is unknown.
WebProperty.get(userIp=None, quotaUser=None)

Get resource

Variables:
  • userIp (str) – Specifies IP address of the end user for whom the API call is being made. Used to cap usage per IP.
  • quotaUser (str) – Alternative to userIp in cases when the user’s IP address is unknown.
Account.get(userIp=None, quotaUser=None)

Get resource

Variables:
  • userIp (str) – Specifies IP address of the end user for whom the API call is being made. Used to cap usage per IP.
  • quotaUser (str) – Alternative to userIp in cases when the user’s IP address is unknown.

Accounts

Management.accounts()

Return the resource corresponding to all accounts

Accounts.get(max_results=None, start_index=None, userIp=None, quotaUser=None)

List resource

Variables:
  • max-results (int) – The maximum number of rows to include in the response
  • start-index (int) – The first row of data to retrieve, starting at 1. Use this parameter as a pagination mechanism along with the max-results parameter.
  • userIp (str) – Specifies IP address of the end user for whom the API call is being made. Used to cap usage per IP.
  • quotaUser (str) – Alternative to userIp in cases when the user’s IP address is unknown.

Segments

Management.segments()

Return the resource corresponding to all segments

Segments.get(max_results=None, start_index=None, userIp=None, quotaUser=None)

List resource

Variables:
  • max-results (int) – The maximum number of rows to include in the response
  • start-index (int) – The first row of data to retrieve, starting at 1. Use this parameter as a pagination mechanism along with the max-results parameter.
  • userIp (str) – Specifies IP address of the end user for whom the API call is being made. Used to cap usage per IP.
  • quotaUser (str) – Alternative to userIp in cases when the user’s IP address is unknown.

Reporting

GoogleAnalytics.reporting()

Return the resource corresponding to the reporting API

Reporting.core(ids, start_date, end_date, metrics, dimensions=None, sort=None, filters=None, segment=None, start_index=None, max_results=None, fields=None, prettyPrint=None, userIp=None, quotaUser=None, access_token=None, key=None)

Query the Core Reporting API for Google Analytics report data.

Variables:
  • ids (str) – The unique table ID of the form ga:XXXX, where XXXX is the Analytics view (profile) ID for which the query will retrieve the data.
  • start-date (str) – The first date of the date range for which you are requesting the data.
  • end-date (str) – The first last of the date range for which you are requesting the data.
  • metrics (str) – A list of comma-separated metrics, such as ga:visits,ga:bounces.
  • dimensions (str) – A list of comma-separated dimensions for your Analytics data, such as ga:browser,ga:city.
:var sort A list of comma-separated dimensions and metrics indicating
the sorting order and sorting direction for the returned data.
Variables:
  • filters (str) – Dimension or metric filters that restrict the data returned for your request.
  • segment (str) – Segments the data returned for your request.
  • start-index (int) – The first row of data to retrieve, starting at 1. Use this parameter as a pagination mechanism along with the max-results parameter.
  • max-results (int) – The maximum number of rows to include in the response
  • fields – Selector specifying a subset of fields to include in the response.
  • prettyPrint (bool) – Returns response with indentations and line breaks. Default false.
  • userIp (str) – Specifies IP address of the end user for whom the API call is being made. Used to cap usage per IP.
  • quotaUser (str) – Alternative to userIp in cases when the user’s IP address is unknown.
  • access_token (str) – One possible way to provide an OAuth 2.0 token.
  • key (str) – Used for OAuth 1.0a authorization to specify your application to get quota. For example: key=AldefliuhSFADSfasdfasdfASdf.
Reporting.realtime(ids, metrics, dimensions=None, sort=None, filters=None, max_results=None, fields=None, prettyPrint=None, userIp=None, quotaUser=None, access_token=None, key=None)

Returns real-time data for a view (profile)

Variables:
  • ids (str) – The unique table ID of the form ga:XXXX, where XXXX is the Analytics view (profile) ID for which the query will retrieve the data.
  • metrics (str) – A list of comma-separated metrics, such as ga:visits,ga:bounces.
  • dimensions (str) – A list of comma-separated dimensions for your Analytics data, such as ga:browser,ga:city.
:var sort A list of comma-separated dimensions and metrics indicating
the sorting order and sorting direction for the returned data.
Variables:
  • filters (str) – Dimension or metric filters that restrict the data returned for your request.
  • max-results (int) – The maximum number of rows to include in the response
  • fields – Selector specifying a subset of fields to include in the response.
  • prettyPrint (bool) – Returns response with indentations and line breaks. Default false.
  • userIp (str) – Specifies IP address of the end user for whom the API call is being made. Used to cap usage per IP.
  • quotaUser (str) – Alternative to userIp in cases when the user’s IP address is unknown.