Learn R Programming

googleAnalyticsR (version 1.2.0)

ga_clientid_deletion: Create or update a user deletion request

Description

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

Usage

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

Value

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

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

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.

See Also

https://developers.google.com/analytics/devguides/config/userdeletion/v3/

Other clientid functions: ga_clientid_activity(), ga_clientid_activity_unnest(), ga_clientid_hash()

Examples

Run this code

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

}

Run the code above in your browser using DataLab