# NOT RUN {
# }
# NOT RUN {
# ui.R
metricDimensionSelect("mets1")
metricDimensionSelect("dims1")
#server.R
metrics <- metricDimensionSelect("mets1", "metric")
dims <- metricDimensionSelect("dims1", "dimension")
# use in app with custom fields
#' ui <- fluidPage(title = "Shiny App",
accountPickerUI("auth_menu", inColumns = TRUE),
metricDimensionSelectUI("mets1"),
metricDimensionSelectUI("dims_custom")
)
server <- function(input, output, session){
token <- gar_shiny_auth(session)
accs <- reactive({
req(token)
ga_account_list("ga4")
})
# no custom data
metrics <- metricDimensionSelect("mets1")
# module for authentication
property_id <- accountPicker("auth_menu", ga_table = accs, id_only = TRUE)
meta <- reactive({
req(property_id())
ga_meta("data", propertyId = property_id())
})
# custom data
dims_custom <- metricDimensionSelect("dims_custom",
type = "dimension",
custom_meta = meta())
}
shinyApp(gar_shiny_ui(ui, login_ui = silent_auth), server)
# }
Run the code above in your browser using DataLab