You can opt-in or out to sending a measurement protocol hit when you load the package for use in the package's statistics via this function. No personal data is collected.

If you opt in, this is the function that fires. You can use debug_call=TRUE to see what would be sent before opting in or out.

mp_trackme(package)

mp_trackme_event(
  package,
  debug_call = FALSE,
  say_hello = NULL,
  opt_in_function = NULL
)

Arguments

package

The package name

debug_call

Set as a debug event to see what would be sent

say_hello

If you want to add your own custom message to the event sent, add it here!

opt_in_function

The name of the function for a user to opt-in

Details

Running this function will send a Measurement Protocol hit via mp_send only if the cache file is present

Examples

# 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")
#> 2021-04-10 11:21:39 > No consent file found
#> [1] FALSE
# see what data is sent mp_trackme_event("googleAnalyticsR", debug_call=TRUE)
#> Warning: Error on package load with mp_trackme_event: there is no package called ‘googleAnalyticsR’
#> NULL
# add your own message! mp_trackme_event("googleAnalyticsR", debug_call = TRUE, say_hello = "err hello Mark")
#> Warning: Error on package load with mp_trackme_event: there is no package called ‘googleAnalyticsR’
#> NULL
# placed in .onAttach with function name .onAttach <- function(libname, pkgname){ measurementProtocol::mp_trackme_event(pkgname, opt_in_function = "mp_opt_in") }