You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `shiny.telemetry` R package tracks events occurring on a user session, such as input changes and session duration, and stores them in a local or remote database.
11
+
The `shiny.telemetry` R package tracks events occurring on a user session,
12
+
such as input changes and session duration, and stores them in a local or remote database.
12
13
13
-
It provides developers with the tools to help understand how users interact with Shiny dashboards and answer questions such as: which tabs/pages are more often visited, which inputs users are changing, what is the average length of a session, etc.
14
+
It provides developers with the tools to help understand how users interact with Shiny dashboards
15
+
and answer questions such as: which tabs/pages are more often visited,
16
+
which inputs users are changing, what is the average length of a session, etc.
14
17
15
18
## Install
16
19
17
20
The `shiny.telemetry` package can be installed from GitHub by using the remotes package:
With `dependencies = TRUE` the suggested packages (required to run some examples)
27
+
will be installed in addition to mandatory dependencies.
28
+
23
29
## How to use in a Shiny Dashboard?
24
30
25
-
`shiny.telemetry` allows for a minimal setup with only 3 commands that can track some information about the session:
31
+
`shiny.telemetry` allows for a minimal setup with only 3 commands
32
+
that can track some information about the session:
26
33
27
34
* When session starts and ends
28
35
* The browser version used by the client
29
36
* Changes in the inputs _(doesn't track values by default)_
30
37
31
-
The code below runs a minimal example of a shiny application that uses `shiny.telemetry`.
32
-
In this example, this package will keep the session information and all changes to the `numericInput`.
38
+
The code below runs a minimal example of a Shiny application that uses `shiny.telemetry`.
39
+
The package will keep track of the session information and all changes to the `numericInput`.
33
40
34
-
ℹ️ _note_: When using the dashboard nothing is happening from the user's perspective as all operation run in the background _(either in the server or in Javascript)_.
41
+
_Note_: When using the dashboard nothing is happening from the user's perspective
42
+
as all operation run in the background _(either in the server or in Javascript)_.
35
43
36
-
```R
44
+
```r
37
45
library(shiny)
38
46
library(shiny.telemetry)
47
+
39
48
telemetry<-Telemetry$new() # 1. Initialize telemetry with default options
49
+
40
50
shinyApp(
41
51
ui= fluidPage(
42
52
use_telemetry(), # 2. Add necessary Javascript to Shiny
@@ -53,45 +63,57 @@ shinyApp(
53
63
When inspecting the code above, we can breakdown the 3 lines of code by:
54
64
55
65
1. Global `Telemetry` object that is used across the different sessions
56
-
2. Add necessary Javascript to the UI by calling `use_telemetry()`. It is used to track browser version.
57
-
3. Initialize the session-specific tracking by calling method `start_session()` of the `Telemetry` object
66
+
2. Add necessary Javascript to the UI by calling `use_telemetry()`.
67
+
It is used to track browser version.
68
+
3. Initialize the session-specific tracking
69
+
by calling method `start_session()` of the `Telemetry` object.
58
70
59
71
## How to access the data?
60
72
61
73
The 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.
The package has an analytics sample dashboard to help access the data. It is located at `inst/examples/app/analytics` and it should be modified so that it references the correct `DataStorage` provider and configuration.
83
+
The package includes an analytics dashboard to view the data.
84
+
It is located at `inst/examples/app/analytics` and it should be modified
85
+
so that it references the correct `DataStorage` provider and configuration.
72
86
73
87
## Data providers
74
88
75
-
There are 3 different types of data providers that can range from local filesystem storage to a remote plumber REST API instance.
89
+
There are 3 different types of data providers
90
+
that can range from local filesystem storage to a remote Plumber REST API instance.
76
91
77
-
* SQLite using `DataStorageSQLite` class
78
-
* Logfile using `DataStorageLogFile` class
79
-
* MariaDB using `DataStorageMariaDB` class
80
-
* PostgreSQL using `DataStoragePostgreSQL` class
92
+
* Local file:
93
+
* SQLite using `DataStorageSQLite` class
94
+
* Logfile using `DataStorageLogFile` class
95
+
* Remote SQL database:
96
+
* MariaDB using `DataStorageMariaDB` class
97
+
* PostgreSQL using `DataStoragePostgreSQL` class
81
98
* Plumber REST API using `DataStoragePlumber` class
82
-
* In turn, the Plumber data provider will use one of the other classes above as the method of data storage.
99
+
* In turn, the Plumber data provider will use one of the other classes above
100
+
as the method of data storage.
83
101
84
-
The setup for plumber requires a valid Plumber instance running on the network and the communication can be protected. See Plumber deployment documentation for more information.
102
+
The setup for plumber requires a valid Plumber instance running on the network
103
+
and the communication can be protected.
104
+
See Plumber deployment documentation for more information.
85
105
86
106
## Debugging the Telemetry calls
87
107
88
-
The package uses the `logger` package internally with the `shiny.telemetry` namespace. To debug the `shiny.telemetry` calls in the dashboard, change the threshold of this namespace to `DEBUG`.
108
+
The package uses the `logger` package internally with the `shiny.telemetry` namespace.
109
+
To debug the `shiny.telemetry` calls in the dashboard,
110
+
change the threshold of this namespace to `DEBUG`:
0 commit comments