Learn R Programming

googleAnalyticsR (version 1.2.0)

ga_trackme: Opt in or out of googleAnalyticsR 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, ga_trackme_event() is the function that fires. You can use debug_call=TRUE to see what would be sent before opting in or out.

Usage

ga_trackme()

ga_trackme_event(debug_call = FALSE, say_hello = NULL)

Arguments

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!

Details

Running ga_trackme_event() function will send a Measurement Protocol hit via ga_mp_send only if the ~/.R/optin-googleanalyticsr file is present

Examples

Run this code

# control your tracking choices via a menu if in interactive session
if(interactive()){
  ga_trackme()
}

# this only works with a valid opt-in file present 
ga_trackme_event()

# see what data is sent
ga_trackme_event(debug_call=TRUE)

# add your own message!
ga_trackme_event(debug_call = TRUE, say_hello = "err hello Mark")

Run the code above in your browser using DataLab