Include the JS snippet in your ui
-function with includeAzureAppInsights
and start the tracking with startAzureAppInsights
in your server
-function.
startAzureAppInsights(
session,
cfg,
instance.name = "appInsights",
ld = 0,
useXhr = TRUE,
crossOrigin = "anonymous",
onInit = NULL,
heartbeat = 3e+05,
extras = list(),
include.ip = FALSE,
cookie.user = FALSE,
debug = FALSE
)includeAzureAppInsights(version = c("2.8.14", "2.7.0"))
Methods sends data to client's browser; returns the sent list, invisibly.
The session
object passed to function given to shinyServer
.
List-object from config
.
Global JavaScript Instance name defaults to "appInsights" when not supplied. NOT the app's name. Used for accessing the instance from other JavaScript routines.
Defines the load delay (in ms) before attempting to load the sdk. -1 = block page load and add to head. (default) = 0ms load after timeout,
Logical, use XHR instead of fetch to report failures (if available).
When supplied this will add the provided value as the cross origin attribute on the script tag.
Once the application insights instance has loaded and initialized this callback function will be called with 1 argument -- the sdk instance
Integer, how often should the heartbeat beat -- or set to FALSE
to disable.
(Named) list of values to add to any tracking.
Logical, adds ip
to all tracking's customDimension
. See note.
Logical, when TRUE
sets a cookie with a random string and submits this
along with any tracking with the key userid
.
Logical, JS loader uses console.log
.
Version of the Application Insights JavaScript SDK to load.
Generally, Azure's Application Insight does not collect the users' ip-address, due to it being somewhat sensitive data (link).
startAzureAppInsights
however has the argument `include.ip` which,
when set to TRUE
, will add the entry ip
to all trackings.
The tracked ip-address is taken from session$request$REMOTE_ADDR
,
which is an un-documented feature and may or may not be the users ip-address.
https://docs.microsoft.com/en-us/azure/azure-monitor/app/javascript and https://github.com/microsoft/ApplicationInsights-JS and https://learn.microsoft.com/en-us/azure/azure-monitor/app/ip-collection?tabs=net