startAzureAppInsights {AzureAppInsights} | R Documentation |
Include and run Azure Application Insights for web pages
Description
Include the JS snippet in your ui
-function with includeAzureAppInsights
and start the tracking with startAzureAppInsights
in your server
-function.
Usage
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"))
Arguments
session |
The |
cfg |
List-object from |
instance.name |
Global JavaScript Instance name defaults to "appInsights" when not supplied. NOT the app's name. Used for accessing the instance from other JavaScript routines. |
ld |
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, |
useXhr |
Logical, use XHR instead of fetch to report failures (if available). |
crossOrigin |
When supplied this will add the provided value as the cross origin attribute on the script tag. |
onInit |
Once the application insights instance has loaded and initialized this callback function will be called with 1 argument – the sdk instance |
heartbeat |
Integer, how often should the heartbeat beat – or set to |
extras |
(Named) list of values to add to any tracking. |
include.ip |
Logical, adds |
cookie.user |
Logical, when |
debug |
Logical, JS loader uses |
version |
Version of the Application Insights JavaScript SDK to load. |
Value
Methods sends data to client's browser; returns the sent list, invisibly.
Tracking users' ip-address
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.
References
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