mp_trackme {measurementProtocol}R Documentation

Opt in or out of package usage tracking

Description

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.

Usage

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

Value

No return value, called for side effects

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")

# 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")
 }


[Package measurementProtocol version 0.1.1 Index]