Last data update: 2014.03.03

R: Query the Google Analytics API for the specified dimensions,...
GetReportDataR 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

Usage

GetReportData(query.builder, token, split_daywise = FALSE,
  paginate_query = FALSE)

Arguments

query.builder

Name of the object created using QueryBuilder

token

Name of the token object created using Auth

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

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

Value

dataframe containing the response from the Google Analytics API

See Also

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/

Examples

## 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)

Results