- Print
- DarkLight
- PDF
End period
Use the end_period parameter to specify the ending day of a date range. You must also supply the start_period.
end_period = ending day of date range
Example: specifying January 1, 2024 to January 30, 2024
start_period=2024m01d01&end_period=2024m01d30
Example: specifying the past 7 days (from yesterday)
start_period=current_day-7&end_period=current_day-1
Note: Several time period macros are available: CURRENT_DAY, CURRENT_MONTH and CURRENT_YEAR. Instead of a specific start and end date, you can identify relative time periods.
Format
format = return data format
Data format | Parameter and value |
---|---|
JSON | format=json |
XML | format=xml |
XML2 ("XPath-friendly" XML for dynamic applications) | format=xml2 |
HTML | format=html (use this when importing data into Excel) |
CSV | format=csv (returned as a download) |
RSS | format=rss (use to specify an RSS 2.0 syndication feed) |
ATOM | format=atom (use to specify an ATOM 1.0 syndication feed) |
For report data requests, all formats are supported. For "list" requests, only XML and JSON formats are supported.
HTTP Status Codes
Status codes returned by the service.
401 Authorization was refused for that user/account and password.
403 Forbidden. The request was valid, but the server is refusing to respond, possibly because a rate limit has been exceeded.
404 The resource you requested was not found.
408 The request timed out.
503 Service unavailable.
Language
Use the language parameter with a language ID, such as en or locale ID, such as en-GB to specify language and locale preferences for translating and formatting dates and numbers in report data. (See ISO 639-1 and ISO-3166 for codes.)
The languages available are those that appear in the Analytics user interface as preferences.
language = language code[-dialect designator]
Strictly speaking, language=en_GB is a locale identifier for English-language speakers in Great Britain. (A hyphen is used to designate a dialect of a language, so the dialect for a resident of Great Britain is en-GB). In practice, however, due to the widespread lack of understanding of this distinction, "-" and "_" are treated as equivalent.
Measures
Use the measures parameter to specify the measures to return. If you do not use this parameter, all measures are returned.
measures = measure1 * measure2 * ...
Example: returning only visits and visitors
measures=visits*visitors
Period
Use the period parameter to specify the time period of interest and a trend length for report data. You can specify a relative time span or a specific time span (see here). Supplying only period is the same as supplying start_period and end_period with the same value.
period = time period * trend length
Example: getting data for a relative time period (current_day, current_month, current_year)
Time span | Parameter and value |
---|---|
Yesterday | period=current_day-1 |
Two months ago | period=current_month-2 |
Trending backward from February 28 | period=2024m02d28*28 |
Rolling 7-days-to-date trend | period=current_day-1*7 |
Year trend with holidays and annual cyclical data | period=current_month-1*12 |
Range
Use the range parameter to specify the start and end rows of the range of rows to return. If you specify only end row, start row defaults to 1. If you do not use this parameter, all rows are returned.
Note: The range parameter cannot be used in drill-down reports, since they contain a hierarchy of ranges.
range = start row * end row
Example: specifying ranges
Range | Parameter and value |
---|---|
First 100 rows | range=100 |
Rows 101 to 200 | range=101*200 |
Search
Use the search parameter for reports to return only records containing the search string in their dimension value.
search = search string
Example: creating a report with only the rows whose dimension value contains "DVD": search=DVD
Start period
Use the start_period parameter to specify the beginning day of a date range. You must also supply the end_period.
start_period = first day of date range
Example: specifying January 1, 2024 to January 30, 2024
start_period=2024m01d01&end_period=2024m01d30
Example: specifying the past 7 days (from yesterday)
start_period=current_day-7&end_period=current_day-1
Suppress error codes
Set the suppress_error_codes parameter to true if you do not want to be notified of error conditions for a request (the default is false).
suppress_error_codes = {true|false}
Example: Suppress errors for a request
suppress_error_codes=true
Totals
The totals parameter specifies whether, or how, totals for measures are returned: all (default), only or none.
totals = {all | only | none}
Note: If you use the range or search parameter to return a subset of data, the totals returned are the subtotals for the entire period, rollup dimension, etc. For subsets of data, specify totals=none and use Excel to compute the totals.
What to return | Parameter and value |
---|---|
No totals | totals=none |
All totals (the default) | totals=all |
Only totals | totals=only |