The legacy Google Analytics User Deletion API (v3) has been sunset along with
Universal Analytics. The Google Analytics Admin API (v1alpha) provides a replacement
SubmitUserDeletion
method to request data deletion for users in Google Analytics properties.
Do I need to migrate?
If your code is still calling the upsert method of the legacy
User Deletion API (v3), you must migrate to the Google Analytics Admin API to perform user
deletions for your Google Analytics properties.
Migration steps
Follow these steps to start using the new SubmitUserDeletion method.
Enable the Google Analytics Admin API
Click the following Enable the Google Analytics Admin API button to select or create a new Google Cloud project and automatically enable the Google Analytics Admin API.
Enable the Google Analytics Admin APIFind and replace calls to the legacy User Deletion API
Replace any calls to the legacy upsert method of the legacy
User Deletion API with calls to the new SubmitUserDeletion
method of the Google Analytics Admin API.
Example upsert request to the legacy User Deletion API:
REST
POST https://analytics.googleapis.com/analytics/v3/userDeletion/userDeletionRequests:upsert
{
"propertyId": "1234567",
"id": {
"type": "USER_ID",
"userId": "user123"
}
}
Example of an equivalent SubmitUserDeletion request of the Google Analytics Admin API:
REST
POST https://analyticsadmin.googleapis.com/v1alpha/properties/1234567:submitUserDeletion
{
"userId": "user123"
}
Update requested OAuth scopes
The new SubmitUserDeletion of the Google Analytics Admin API uses the scope
https://www.googleapis.com/auth/analytics.edit.
This is different from the legacy User Deletion API, which used the
https://www.googleapis.com/auth/analytics.user.deletion scope.
You should update any code or access token request commands that are using
https://www.googleapis.com/auth/analytics.user.deletion
to request https://www.googleapis.com/auth/analytics.edit instead.
If you are using a client library, it should request the necessary scopes automatically.
Disable the legacy API
Once you have updated your code to use the SubmitUserDeletion method, you are
ready to disable the legacy API in your Google Cloud project.
Open the following link to open the legacy Universal Analytics API endpoint in your Google Cloud Console. Select your Cloud Project and click the Disable API button.