Description Usage Arguments Value See Also Examples
This function will retrieve the data by firing the query to the Core Reporting API. It also displays status messages after the completion of the query. The user also has the option split the query into daywise partitions and paginate the query responses in order to decrease the effect the sampling
1 2 | GetReportData(query.builder, token, split_daywise = FALSE,
paginate_query = FALSE, delay = 0)
|
query.builder |
Name of the object created using |
token |
Name of the token object created using |
split_daywise |
Splits the query by date range into sub queries of single days. Setting this argument to True automatically paginates through each daywise query. Note that if this argument is set to True, queries will take more longer to complete and use more Quota |
paginate_query |
Pages through chunks of results by requesting maximum number of allowed rows at a time. Note that if this argument is set to True, queries will take more longer to complete and use more Quota. For more on Google Analytics API Quota check https://developers.google.com/analytics/devguides/reporting/core/v3/limits-quotas#core_reporting |
delay |
Since Pagination and Query splitting fire sucessive queries, there is a possibility of getting Quota Eror: Rate Limit Exceeded from the Google Analytics API. This parameter can be used to specify a Time delay (in seconds) between successive queries in order to stay within the Google Analytics API Rate Limits |
dataframe containing the response from the Google Analytics API
Prior to executing the query, as a good practice queries can be tested in the Google Analytics Query Feed Explorer at http://ga-dev-tools.appspot.com/explorer/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
# This example assumes that a token object is already created
# Create a list of Query Parameters
query.list <- Init(start.date = "2014-11-28",
end.date = "2014-12-04",
dimensions = "ga:date",
metrics = "ga:sessions,ga:pageviews",
max.results = 1000,
table.id = "ga:33093633")
# Create the query object
ga.query <- QueryBuilder(query.list)
# Fire the query to the Google Analytics API
ga.df <- GetReportData(query, oauth_token)
ga.df <- GetReportData(query, oauth_token, split_daywise=True)
ga.df <- GetReportData(query, oauth_token, paginate_query=True)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.