ga_set_user_id: Provide the identifier which will be used to identify a...

Description Usage Arguments Value Examples

Description

Set the identifier of a visitor as it is known by you. The user_id identifier is the identifier of the visitor/user as it is know by you. Defaults to a randomly generated identifier.

You can also set the client_id identifier which anonymously identifies a particular user or device. For R users this client_id identifies the same user across different R sessions. The value of this field should be a random UUID (version 4) as described in http://www.ietf.org/rfc/rfc4122.txt
By default for every new R session, a new client_id is generated.

Usage

1
2
ga_set_user_id(user_id = uuid::UUIDgenerate(),
  client_id = uuid::UUIDgenerate())

Arguments

user_id

a character string with the visitor/user known to you. Defaults to a randomly generated UUID.

client_id

a character string in UUID format which anonymously and uniquely identifies a particular R user or device across different R sessions. Defaults to a randomly generated UUID.

Value

invisibly a list all general settings used to send data to Google Analytics

Examples

1
2
3
4
5
6
7
8
9
ga_set_user_id()
ga_set_user_id("root")
ga_set_user_id("team-datascientists")
ga_set_user_id("shiny-server")

x <- sprintf("%s-%s", Sys.getpid(), tolower(Sys.getenv("USERNAME", unset = "default")))
x
ga_set_user_id(x)
ga_set_user_id(x, client_id = "a5d1eeb6-0459-11e8-8912-134976ff196e")

bnosac/GAlogger documentation built on May 23, 2019, 6:05 a.m.