The Google Analytics User Deletion API allows customers to process deletions of data associated with a given user identifier.

ga_clientid_deletion(
  userId,
  propertyId,
  idType = c("CLIENT_ID", "USER_ID", "APP_INSTANCE_ID"),
  propertyType = c("ga", "firebase")
)

Arguments

userId

A character vector of user ID's

propertyId

The Google Analytics Web property or Firebase ProjectId you are deleting the user from.

idType

Type of user. One of APP_INSTANCE_ID, CLIENT_ID or USER_ID.

propertyType

Firebase or Google Analytics

Value

a data.frame with a row for each userID you sent in, plus a column with its deletionRequestTime

Details

The user explorer report in Google Analytics can give you the client.id you need to test.

A data deletion request can be applied to either a Google Analytics web property (specified by propertyType="ga") or Firebase application (propertyType="firebase"). A user whose data will be deleted can be specified by setting one of the identifiers the userId field. The type of the identifier must be specified inside idType field.

There is a quota of 500 queries per day per cloud project.

The API returns a User Deletion Request Resource with deletionRequestTime field set. This field is the point in time up to which all user data will be deleted. This means that all user data for the specified user identifier and Google Analytics property or Firebase project will be deleted up to this date and time - if the user with the same identifier returns after this date/time, they will reappear in reporting.

Examples


if (FALSE) {

# make sure you are authenticated with user deletion scopes
options(googleAuthR.scopes.selected = "https://www.googleapis.com/auth/analytics.user.deletion")
ga_auth()

# a vector of ids
ids <- c("1489547420.1526330722", "1138076389.1526568883")

# do the deletions
ga_clientid_deletion(ids, "UA-1234-2")
#                 userId   id_type  property      deletionRequestTime
#1 1489547420.1526330722 CLIENT_ID UA-1234-2 2018-05-20T19:43:33.540Z
#2 1138076389.1526568883 CLIENT_ID UA-1234-2 2018-05-20T19:43:36.218Z

}