Skip to content

Instantly share code, notes, and snippets.

@charliejhadley
Created August 22, 2025 13:22
Show Gist options
  • Select an option

  • Save charliejhadley/88452cae463c7837308d57918cc95979 to your computer and use it in GitHub Desktop.

Select an option

Save charliejhadley/88452cae463c7837308d57918cc95979 to your computer and use it in GitHub Desktop.
shiny.telemetry instructions
library(shiny)
library(shinyWidgets)
library(shiny.telemetry)
library(highcharter)
telemetry <- Telemetry$new()
ui <- fluidPage(selectInput("things", "things", choices = letters))
shinyApp(
ui = fluidPage(
use_telemetry(), # 2. Add necessary javascript to Shiny
numericInput("n", "n", 1),
plotOutput('plot'),
actionButton("do_thing", "do_thing"),
highchartOutput("bar_chart")
),
server = function(input, output, session) {
output$bar_chart <- renderHighchart({
highchart() %>%
hc_add_series(
data = count(gss_cat, marital),
type = "bar",
hcaes(y = n,
x = marital))
})
observeEvent(input$do_thing,
{
telemetry$log_custom_event(
"input",
details = list(
id = "iona",
value = input$n
)
)
})
telemetry$start_session(track_values = TRUE,
track_inputs = TRUE)
# Do not track inputs that contain "tbl_" while still tracking "tbl_row_selected"
telemetry$log_all_inputs(
excluded_inputs_regex = "tbl_"
)
output$plot <- renderPlot({ hist(runif(input$n)) })
}
)
library(tidyverse)
# This reads the data into a tibble
telemetry_data <- shiny.telemetry::Telemetry$new()$data_storage$read_event_data("2020-01-01", "2050-01-01")
# This gives the dashboard
analytics_app(shiny.telemetry::DataStorageSQLite$new(db_path = "telemetry.sqlite"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment