Skip to content
Stijn Debrouwere edited this page May 23, 2015 · 3 revisions
class Account()

An account is usually but not always associated with a single website. It will often contain multiple web properties (different parts of your website that you've configured Google Analytics to analyze separately, or simply the default web property that every website has in Google Analytics), which in turn will have one or more profiles.

You should navigate to a profile to run queries.

import googleanalytics as ga
accounts = ga.authenticate()
profile = accounts['debrouwere.org'].webproperties['UA-12933299-1'].profiles['debrouwere.org']
report = profile.core.query('pageviews').range('2014-10-01', '2014-10-31').get()
print(report['pageviews'])

class Column()

class ColumnList(columns, **options)
ColumnList#

L.append(object) -- append object to end

ColumnList#

L.count(value) -> integer -- return number of occurrences of value

ColumnList#

L.extend(iterable) -- extend list by appending elements from the iterable

ColumnList#

L.insert(index, object) -- insert object before index

ColumnList#

L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.

ColumnList#

L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.

ColumnList#

L.reverse() -- reverse IN PLACE

ColumnList#serialize(values, *vargs, **kwargs)

Greedy serialization requires the value to either be a column or convertible to a column, whereas non-greedy serialization will pass through any string as-is and will only serialize Column objects.

Non-greedy serialization is useful when preparing queries with custom filters or segments.

ColumnList#

L.sort(cmp=None, key=None, reverse=False) -- stable sort IN PLACE; cmp(x, y) -> -1, 0, 1


class CoreReportingAPI(profile)

class Profile()

A profile is a particular analytics configuration of a web property. Each profile belongs to a web property and an account. As all queries using the Google Analytics API run against a particular profile, queries can only be created from a Profile object.

profile.query('pageviews').range('2014-01-01', days=7).get()

class RealTimeReportingAPI(profile)

class ReportingAPI(endpoint, profile)

class Segment()

class SegmentList(columns, **options)
SegmentList#

L.append(object) -- append object to end

SegmentList#

L.count(value) -> integer -- return number of occurrences of value

SegmentList#

L.extend(iterable) -- extend list by appending elements from the iterable

SegmentList#

L.insert(index, object) -- insert object before index

SegmentList#

L.pop([index]) -> item -- remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.

SegmentList#

L.remove(value) -- remove first occurrence of value. Raises ValueError if the value is not present.

SegmentList#

L.reverse() -- reverse IN PLACE

SegmentList#serialize(values, *vargs, **kwargs)

Greedy serialization requires the value to either be a column or convertible to a column, whereas non-greedy serialization will pass through any string as-is and will only serialize Column objects.

Non-greedy serialization is useful when preparing queries with custom filters or segments.

SegmentList#

L.sort(cmp=None, key=None, reverse=False) -- stable sort IN PLACE; cmp(x, y) -> -1, 0, 1


class WebProperty()

A web property is a particular website you're tracking in Google Analytics. It has one or more profiles, and you will need to pick one from which to launch your queries.

WebProperty#query(*vargs, **kwargs)

A shortcut to the first profile of this webproperty.