{"id":13952019,"url":"https://github.com/Appsilon/shiny.telemetry","last_synced_at":"2025-07-20T15:31:33.675Z","repository":{"id":41832943,"uuid":"193537130","full_name":"Appsilon/shiny.telemetry","owner":"Appsilon","description":"Easy logging of users activity and session events of your Shiny App","archived":false,"fork":false,"pushed_at":"2024-10-17T10:48:03.000Z","size":4634,"stargazers_count":66,"open_issues_count":17,"forks_count":13,"subscribers_count":25,"default_branch":"main","last_synced_at":"2024-11-20T04:26:16.956Z","etag":null,"topics":["analytics","r","r-package","rhinoverse","shiny"],"latest_commit_sha":null,"homepage":"https://appsilon.github.io/shiny.telemetry/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Appsilon.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-24T16:02:38.000Z","updated_at":"2024-10-17T10:43:16.000Z","dependencies_parsed_at":"2022-08-11T18:50:49.127Z","dependency_job_id":"25256794-5eb1-44e9-adf5-6da204b0f8e0","html_url":"https://github.com/Appsilon/shiny.telemetry","commit_stats":{"total_commits":486,"total_committers":15,"mean_commits":32.4,"dds":"0.43621399176954734","last_synced_commit":"2838e135ea17e8c472560f13f05e8fe1431a46d1"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Appsilon%2Fshiny.telemetry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Appsilon%2Fshiny.telemetry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Appsilon%2Fshiny.telemetry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Appsilon%2Fshiny.telemetry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Appsilon","download_url":"https://codeload.github.com/Appsilon/shiny.telemetry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226809055,"owners_count":17685498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","r","r-package","rhinoverse","shiny"],"created_at":"2024-08-08T07:00:50.349Z","updated_at":"2024-11-27T19:30:47.358Z","avatar_url":"https://github.com/Appsilon.png","language":"R","readme":"# shiny.telemetry \u003ca href=\"https://appsilon.github.io/shiny.telemetry/\"\u003e\u003cimg src=\"man/figures/shiny-telemetry.png\" alt=\"shiny.telemetry logo\" style=\"float: right; height: 140px;\"\u003e\u003c/a\u003e\n\n\u003e Easy logging of users activity and session events of your Shiny App\n\n[![CRAN](https://www.r-pkg.org/badges/version/shiny.telemetry)](https://cran.r-project.org/package=shiny.telemetry)\n[![R CMD check](https://github.com/Appsilon/shiny.telemetry/actions/workflows/main.yml/badge.svg)](https://github.com/Appsilon/shiny.telemetry/actions/workflows/main.yml)\n[![downloads monthly](https://cranlogs.r-pkg.org/badges/shiny.telemetry)](https://CRAN.R-project.org/package=shiny.telemetry)\n[![downloads total](https://cranlogs.r-pkg.org/badges/grand-total/shiny.telemetry)](https://CRAN.R-project.org/package=shiny.telemetry)\n[![License: LGPL-3.0](https://img.shields.io/badge/License-LGPL--3.0-blue.svg)](https://opensource.org/license/lgpl-3-0)\n\nThe `shiny.telemetry` R package tracks events occurring on a user session,\nsuch as input changes and session duration, and stores them in a local or remote database.\n\nIt provides developers with the tools to help understand how users interact with Shiny dashboards\nand answer questions such as: which tabs/pages are more often visited,\nwhich inputs users are changing, what is the average length of a session, etc.\n\n## Install\n\nThe `shiny.telemetry` package can be installed from GitHub by using the remotes package:\n\n```R\nremotes::install_github(\"Appsilon/shiny.telemetry\", dependencies = TRUE)\n```\n\nWith `dependencies = TRUE` the suggested packages (required to run some examples)\nwill be installed in addition to mandatory dependencies.\n\n## How to use in a Shiny Dashboard?\n\n`shiny.telemetry` allows for a minimal setup with only 3 commands\nthat can track some information about the session:\n\n* When session starts and ends\n* The browser version used by the client\n* Changes in the inputs _(doesn't track values by default)_\n\nThe code below runs a minimal example of a Shiny application that uses `shiny.telemetry`.\nThe package will keep track of the session information and all changes to the `numericInput`.\n\n_Note_: When using the dashboard nothing is happening from the user's perspective\nas all operation run in the background _(either in the server or in Javascript)_.\n\n```r\nlibrary(shiny)\nlibrary(shiny.telemetry)\n\ntelemetry \u003c- Telemetry$new() # 1. Initialize telemetry with default options\n\nshinyApp(\n  ui = fluidPage(\n    use_telemetry(), # 2. Add necessary javascript to Shiny\n    numericInput(\"n\", \"n\", 1),\n    plotOutput('plot')\n  ),\n  server = function(input, output) {\n    telemetry$start_session() # 3. Minimal setup to track events\n    output$plot \u003c- renderPlot({ hist(runif(input$n)) })\n  }\n)\n```\n\nWhen inspecting the code above, we can breakdown the 3 lines of code by:\n\n1. Global `Telemetry` object that is used across the different sessions\n2. Add necessary Javascript to the UI by calling `use_telemetry()`.\nIt is used to track browser version.\n3. Initialize the session-specific tracking\nby calling method `start_session()` of the `Telemetry` object.\n\n## How to access the data?\n\nThe developers and administrators of the dashboard can access the data that is gathered by `shiny.telemetry` via a Telemetry object or directly from `DataStorage` via the appropriate provider.\n\n```R\n# After running the instrumented app\nshiny.telemetry::Telemetry$new()$data_storage$read_event_data(\"2020-01-01\", \"2050-01-01\")\n\n# Default provider and path for Telemetry$new()\nshiny.telemetry::DataStorageSQLite$new(db_path = \"telemetry.sqlite\")$read_event_data(\"2020-01-01\", \"2050-01-01\")\n```\n\nThe package includes an analytics dashboard to view the data.\nIt is located at `inst/examples/app/analytics` and it should be modified\nso that it references the correct `DataStorage` provider and configuration.\n\n## Data providers\n\nThere are 3 different types of data providers\nthat can range from local filesystem storage to a remote Plumber REST API instance.\n\n* Local file:\n  * SQLite using `DataStorageSQLite` class\n  * Plain text file using `DataStorageLogFile` class\n* Remote SQL database:\n  * MariaDB using `DataStorageMariaDB` class\n  * PostgreSQL using `DataStoragePostgreSQL` class\n  * MS SQL Server using `DataStorageMSSQLServer` class\n* Plumber REST API using `DataStoragePlumber` class\n  * In turn, the Plumber data provider will use one of the other classes above\n  as the method of data storage.\n\nThe setup for plumber requires a valid Plumber instance running on the network\nand the communication can be protected.\nSee Plumber deployment documentation for more information.\n\n## Debugging the Telemetry calls\n\nThe package uses the `logger` package internally with the `shiny.telemetry` namespace.\nTo debug the `shiny.telemetry` calls in the dashboard,\nchange the threshold of this namespace to `DEBUG`:\n\n```r\nlogger::log_threshold(\"DEBUG\", namespace = \"shiny.telemetry\")\n```\n\n_note_: This command can be run before the Shiny call or by adding it to the `.Rprofile`.\n\n## Contributing\n\nSee [CONTRIBUTING](https://appsilon.github.io/shiny.telemetry/CONTRIBUTING.html).\n\n## Appsilon\n\n\u003cimg src=\"https://avatars0.githubusercontent.com/u/6096772\" align=\"right\" alt=\"\" width=\"6%\" /\u003e\n\nAppsilon is a **Posit (formerly RStudio) Full Service Certified Partner**.\u003cbr/\u003e\nLearn more at [appsilon.com](https://www.appsilon.com).\n\nGet in touch [opensource@appsilon.com](mailto:opensource@appsilon.com)\n\nExplore the [Rhinoverse](https://www.appsilon.com/rhinoverse) - a family of R packages built around [Rhino](https://appsilon.github.io/rhino/)!\n\n\u003ca href = \"https://www.appsilon.com/careers\" target=\"_blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/Appsilon/website-cdn/gh-pages/WeAreHiring1.png\" alt=\"We are hiring!\"/\u003e\u003c/a\u003e\n","funding_links":[],"categories":["R","Developer Tools"],"sub_categories":["Monitoring and Analytics"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAppsilon%2Fshiny.telemetry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAppsilon%2Fshiny.telemetry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAppsilon%2Fshiny.telemetry/lists"}