-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathga_meta_simple.R
More file actions
62 lines (61 loc) · 1.74 KB
/
ga_meta_simple.R
File metadata and controls
62 lines (61 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#' Google analytics metadata dataframe
#'
#' This function retrieves Google Analytics metadata
#' and returns it as a dataframe. The metadata includes
#' information about metrics, dimensions, and other
#' attributes available in Google Analytics.
#'
#' This function is a wrapper around the
#' `googleAnalyticsR::ga_meta()` function. It retrieves
#' metadata for the Google Analytics API version 4.
#'
#' @note This function requires first authenticating to
#' Google Analytics using the `ga_auth()` function.
#'
#' @family Google Analytics
#'
#' @examples
#' \dontrun{
#' res = ga_meta_simple()
#' head(res)
#' dplyr::glimpse(res)
#' }
#'
#' @return A tibble containing Google Analytics metadata.
#'
#' @export
ga_meta_simple <- function() {
tibble::as_tibble(googleAnalyticsR::ga_meta(version = "data"))
}
#' Google Analytics metadata dataframe by property ID
#'
#' This function retrieves Google Analytics metadata by property ID
#' and returns it as a dataframe. The metadata includes
#' information about metrics, dimensions, and other
#' attributes available in Google Analytics.
#'
#' This function is a wrapper around the
#' `googleAnalyticsR::ga_meta()` function. It retrieves
#' metadata for the Google Analytics API version 4.
#'
#' @param property_id The property ID for which to retrieve
#' metadata.
#'
#' @note This function requires first authenticating to
#' Google Analytics using the `ga_auth()` function.
#'
#' @family Google Analytics
#'
#' @examples
#' \dontrun{
#' res = get_ga_meta_by_id("123456789")
#' head(res)
#' dplyr::glimpse(res)
#' }
#'
#' @return A tibble containing Google Analytics metadata.
#'
#' @export
get_ga_meta_by_id <- function(property_id) {
tibble::as_tibble(googleAnalyticsR::ga_meta(version = "data", propertyId = property_id))
}