A Google Analytics and Google Tag Manager API client for R
GOOGLE_APIS_USER GOOGLE_APIS_CONSUMER_ID GOOGLE_APIS_CONSUMER_SECRET
Classes and methods for interactive use of the Google Analytics core reporting, real-time reporting, multi-channel funnel reporting, metadata, configuration management and Google Tag Manager APIs.
To use this package with these APIs, it is necessary to provide OAuth credentials for a Google APIs project with the necessary APIs enabled.
Features:
Auto-pagination to return up to 1 million rows per query.
Ability to query more than 10 metrics at once.
Minimise the effect of sampling by splitting the date range of
queries using the SplitDateRange
function.
When sampling has occurred, the output data.frame
includes
the sample and total sizes as attributes.
To report bugs, please run the following command:
utils::bug.report(package = "ganalytics")
When posting a bug, please try rerun any API queries wrapped within a call to
httr::with_verbose
and include the output in the bug report (taking
care not to include any private data). For example:
httr::with_verbose(GetGaData(my_query))
For a step-by-step guide with examples, run this command:
browseVignettes(package = "ganalytics")
Important functions to be familiar with in this package are:
GaQuery
This function is used to define a Google Analytics query object that can be interactively manipulated and executed to aid exploratory querying and analysis of Google Analytics data.
GetGaData
This function will execute the supplied query object.
Expr
This is used to define expressions involving Google Analytics dimensions and/or metrics used for use in segments and filters.
Sequence
This function takes one or more expressions to construct a sequence-based segment.
Google Analytics core reporting API dimensions and metrics reference: https://developers.google.com/analytics/devguides/reporting/core/dimsmets
Google Analytics Table Filter expressions: https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters
Google Analytics Custom Segmentation expressions: https://developers.google.com/analytics/devguides/reporting/core/v3/segments-feature-reference
Google Analytics Real-time Reporting API dimensions and metrics: https://developers.google.com/analytics/devguides/reporting/realtime/dimsmets/
Google Analytics Multi-Channel Funnel conversions Reporting API dimensions and metrics: https://developers.google.com/analytics/devguides/reporting/mcf/dimsmets/
Google Analytics Management API collections and resources https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/
Google Tag Manager API collection and resources https://developers.google.com/tag-manager/api/v1/reference/
Useful links: