R: Query the Google Analytics API for the specified dimensions,...
GetReportData
R Documentation
Query the Google Analytics API for the specified dimensions, metrics and other query parameters
Description
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
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
Value
dataframe containing the response from the Google Analytics API
## 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)