This document explains how you can delete data associated with a given user ID using the Google Analytics User Deletion API. This tool is one of several tools available to help you safeguard your data.
For more details, see the reference documentation.
You can use Firebase projects or Google Analytics properties to send User Deletion API requests. The https://www.googleapis.com/auth/analytics.user.deletion OAuth 2.0 scope is required for the requests in this guide.
Send a deletion request
Use the
upsert
method to request the data deletion for a given user. The upsert
method takes
a
userDeletionRequest
as its only parameter.
Specify the user whose data you want to delete by setting one of the IDs inside
the id.userId
field. The type of the ID must be specified inside the id.type
field.
Here's a list of supported user ID types:
CLIENT_ID
: Google Analytics client ID (only supported whenpropertyId
field is set).USER_ID
: Google Analytics User ID (only supported whenpropertyId
field is set).APP_INSTANCE_ID
: Firebase application instance ID (only supported whenfirebaseProjectId
orpropertyId
field is set).
Each data deletion request processes only the ID submitted in that request.
If you have multiple IDs associated with the same user, you must submit separate deletion requests for each ID associated with that user. If you Use BigQuery export, you must also process your own deletions there.
Learn more about user IDs.
Deletion timeline
The
upsert
method returns a User Deletion Request
Resource
with the deletionRequestTime
field set. The deletionRequestTime
field tells
you the time at which the deletion request was received by Google Analytics.
Once deletion is requested, data associated with the user ID will be removed from the Individual User Report within 72 hours, and then deleted from Analytics servers during the next deletion process. Deletion processes are scheduled to occur every two months. If you have exported the user data outside of Google Analytics, we recommend you delete it there first.