blob: 6ebc7c356b07579be8e566c91958909e40c5179d [file] [log] [blame]
<html><body>
<style>
body, h1, h2, h3, div, span, p, pre, a {
margin: 0;
padding: 0;
border: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
body {
font-size: 13px;
padding: 1em;
}
h1 {
font-size: 26px;
margin-bottom: 1em;
}
h2 {
font-size: 24px;
margin-bottom: 1em;
}
h3 {
font-size: 20px;
margin-bottom: 1em;
margin-top: 1em;
}
pre, code {
line-height: 1.5;
font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
}
pre {
margin-top: 0.5em;
}
h1, h2, h3, p {
font-family: Arial, sans serif;
}
h1, h2, h3 {
border-bottom: solid #CCC 1px;
}
.toc_element {
margin-top: 0.5em;
}
.firstline {
margin-left: 2 em;
}
.method {
margin-top: 1em;
border: solid 1px #CCC;
padding: 1em;
background: #EEE;
}
.details {
font-weight: bold;
font-size: 14px;
}
</style>
<h1><a href="analytics_v3.html">Google Analytics API</a> . <a href="analytics_v3.data.html">data</a> . <a href="analytics_v3.data.ga.html">ga</a></h1>
<h2>Instance Methods</h2>
<p class="toc_element">
<code><a href="#get">get(ids, start_date, end_date, metrics, sort=None, filters=None, samplingLevel=None, dimensions=None, max_results=None, output=None, segment=None, start_index=None, include_empty_rows=None)</a></code></p>
<p class="firstline">Returns Analytics data for a view (profile).</p>
<h3>Method Details</h3>
<div class="method">
<code class="details" id="get">get(ids, start_date, end_date, metrics, sort=None, filters=None, samplingLevel=None, dimensions=None, max_results=None, output=None, segment=None, start_index=None, include_empty_rows=None)</code>
<pre>Returns Analytics data for a view (profile).
Args:
ids: string, Unique table ID for retrieving Analytics data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID. (required)
start_date: string, Start date for fetching Analytics data. Requests can specify a start date formatted as YYYY-MM-DD, or as a relative date (e.g., today, yesterday, or 7daysAgo). The default value is 7daysAgo. (required)
end_date: string, End date for fetching Analytics data. Request can should specify an end date formatted as YYYY-MM-DD, or as a relative date (e.g., today, yesterday, or 7daysAgo). The default value is yesterday. (required)
metrics: string, A comma-separated list of Analytics metrics. E.g., &#x27;ga:sessions,ga:pageviews&#x27;. At least one metric must be specified. (required)
sort: string, A comma-separated list of dimensions or metrics that determine the sort order for Analytics data.
filters: string, A comma-separated list of dimension or metric filters to be applied to Analytics data.
samplingLevel: string, The desired sampling level.
Allowed values
DEFAULT - Returns response with a sample size that balances speed and accuracy.
FASTER - Returns a fast response with a smaller sample size.
HIGHER_PRECISION - Returns a more accurate response using a large sample size, but this may result in the response being slower.
dimensions: string, A comma-separated list of Analytics dimensions. E.g., &#x27;ga:browser,ga:city&#x27;.
max_results: integer, The maximum number of entries to include in this feed.
output: string, The selected format for the response. Default format is JSON.
Allowed values
dataTable - Returns the response in Google Charts Data Table format. This is useful in creating visualization using Google Charts.
json - Returns the response in standard JSON format.
segment: string, An Analytics segment to be applied to data.
start_index: integer, An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
include_empty_rows: boolean, The response will include empty rows if this parameter is set to true, the default is true
Returns:
An object of the form:
{ # Analytics data for a given view (profile).
&quot;sampleSize&quot;: &quot;A String&quot;, # The number of samples used to calculate the result.
&quot;itemsPerPage&quot;: 42, # The maximum number of rows the response can contain, regardless of the actual number of rows returned. Its value ranges from 1 to 10,000 with a value of 1000 by default, or otherwise specified by the max-results query parameter.
&quot;query&quot;: { # Analytics data request query parameters.
&quot;filters&quot;: &quot;A String&quot;, # Comma-separated list of dimension or metric filters.
&quot;ids&quot;: &quot;A String&quot;, # Unique table ID.
&quot;samplingLevel&quot;: &quot;A String&quot;, # Desired sampling level
&quot;dimensions&quot;: &quot;A String&quot;, # List of analytics dimensions.
&quot;max-results&quot;: 42, # Maximum results per page.
&quot;segment&quot;: &quot;A String&quot;, # Analytics advanced segment.
&quot;start-date&quot;: &quot;A String&quot;, # Start date.
&quot;metrics&quot;: [ # List of analytics metrics.
&quot;A String&quot;,
],
&quot;end-date&quot;: &quot;A String&quot;, # End date.
&quot;sort&quot;: [ # List of dimensions or metrics based on which Analytics data is sorted.
&quot;A String&quot;,
],
&quot;start-index&quot;: 42, # Start index.
},
&quot;selfLink&quot;: &quot;A String&quot;, # Link to this page.
&quot;dataLastRefreshed&quot;: &quot;A String&quot;, # The last refreshed time in seconds for Analytics data.
&quot;profileInfo&quot;: { # Information for the view (profile), for which the Analytics data was requested.
&quot;accountId&quot;: &quot;A String&quot;, # Account ID to which this view (profile) belongs.
&quot;webPropertyId&quot;: &quot;A String&quot;, # Web Property ID to which this view (profile) belongs.
&quot;profileName&quot;: &quot;A String&quot;, # View (Profile) name.
&quot;profileId&quot;: &quot;A String&quot;, # View (Profile) ID.
&quot;tableId&quot;: &quot;A String&quot;, # Table ID for view (profile).
&quot;internalWebPropertyId&quot;: &quot;A String&quot;, # Internal ID for the web property to which this view (profile) belongs.
},
&quot;totalResults&quot;: 42, # The total number of rows for the query, regardless of the number of rows in the response.
&quot;id&quot;: &quot;A String&quot;, # Unique ID for this data response.
&quot;nextLink&quot;: &quot;A String&quot;, # Link to next page for this Analytics data query.
&quot;kind&quot;: &quot;analytics#gaData&quot;, # Resource type.
&quot;sampleSpace&quot;: &quot;A String&quot;, # Total size of the sample space from which the samples were selected.
&quot;columnHeaders&quot;: [ # Column headers that list dimension names followed by the metric names. The order of dimensions and metrics is same as specified in the request.
{
&quot;name&quot;: &quot;A String&quot;, # Column name.
&quot;dataType&quot;: &quot;A String&quot;, # Data type. Dimension column headers have only STRING as the data type. Metric column headers have data types for metric values such as INTEGER, DOUBLE, CURRENCY etc.
&quot;columnType&quot;: &quot;A String&quot;, # Column Type. Either DIMENSION or METRIC.
},
],
&quot;dataTable&quot;: {
&quot;rows&quot;: [
{
&quot;c&quot;: [
{
&quot;v&quot;: &quot;A String&quot;,
},
],
},
],
&quot;cols&quot;: [
{
&quot;label&quot;: &quot;A String&quot;,
&quot;type&quot;: &quot;A String&quot;,
&quot;id&quot;: &quot;A String&quot;,
},
],
},
&quot;containsSampledData&quot;: True or False, # Determines if Analytics data contains samples.
&quot;totalsForAllResults&quot;: { # Total values for the requested metrics over all the results, not just the results returned in this response. The order of the metric totals is same as the metric order specified in the request.
&quot;a_key&quot;: &quot;A String&quot;, # Key-value pair for the total value of a metric. Key is the metric name and the value is the total value for that metric.
},
&quot;rows&quot;: [ # Analytics data rows, where each row contains a list of dimension values followed by the metric values. The order of dimensions and metrics is same as specified in the request.
[
&quot;A String&quot;,
],
],
&quot;previousLink&quot;: &quot;A String&quot;, # Link to previous page for this Analytics data query.
}</pre>
</div>
</body></html>