# control your tracking choices via a menu if in interactive session
if(interactive()){
mp_trackme()
}
# this only works with a valid opt-in file present
mp_trackme_event("googleAnalyticsR")
# see what data is sent
mp_trackme_event("googleAnalyticsR", debug_call=TRUE)
# add your own message!
mp_trackme_event("googleAnalyticsR",
debug_call = TRUE,
say_hello = "err hello Mark")
# placed in .onAttach with function name
.onAttach <- function(libname, pkgname){
measurementProtocol::mp_trackme_event(pkgname, opt_in_function = "mp_opt_in")
}
Run the code above in your browser using DataLab