Organizations across the globe are facing an influx of new requirements related to privacy legislation. While regulations vary significantly from one region to another, one consistent right being granted to consumers is the right to access and delete data that has been collected about them. These rights require the deletion of data across all platforms to which personal data has been sent, including analytics and advertising technologies.
Luckily for users of Google Analytics, Google Analytics 4 (GA4) offers several different means of executing these requests. Here’s a handy guide for the ways in which an organization can effectively execute Data Subject Access Requests (DSARs) and deletion requests when using GA4.
Data Access
Pull Event Information Via the UI
To pull event information for any given user identifier via the UI, you can use the User Explorer report or the User Activity report within GA4. This feature allows you to analyze and export event-level data for a single user identifier. To do this, you will need to first have the user identifier for the user in question. This will either be a user ID (if you have implemented this in your GA4 Property) or the device ID (default option if you have not implemented user ID as a user property and configured on your website).
The User Explorer functionality in GA4 is within the “Analysis” section of reporting. Once there, you will create a segment or filter to include just the user identifier for the requesting user and then export the results to provide to the user and satisfy their access request.
Pull Event Information Via the API
GA4 has a User Activity API that allows a GA4 property owner to retrieve all analytics measurement data associated with a single user. Again, you will need to have the user identifier associated with the user in question (either the device ID or user ID depending upon your specific implementation). With the user identifier you will then use the User Activity API to pull down all the relevant data.
Pull Information Via BigQuery
A feature of GA4 is that all organizations can integrate their GA4 properties with BigQuery to create full exports of all event data associated with all of their users in a single queryable repository. If you have this set up, you can then easily and programmatically access the data in a more scalable way.
Resources
- Google Support overview of User Explorer reporting
- API Developer documentation for pulling event information via API
Data Deletion
Delete Data Associated with a Specified User
GA4 offers two methods of deleting the data associated with specific users from GA4. These types of deletion will be used when a user executes their “right to be forgotten” under privacy legislation such as GDPR or CCPA.
Similar to the methods available for user access requests, you can satisfy user deletion requests via both the GA4 interface, as well via an API.
Deleting User Data Via the UI
To delete user data via the UI, you will use the User Explorer report within the Analysis section of GA4. You will first need to know the user identifier for the user in question (either the user ID or device ID depending upon your implementation). Using this user identifier you can filter or segment the User Explorer report to find that user record and all associated data. Once identified, there is a trash can icon that can be clicked to ‘Delete User’. Using this will delete all of the event and parameter data associated with the user identifier from the Google Analytics servers.
Deleting User Data Via the API
Google Analytics has a User Deletion API that allows a GA4 property owner to programmatically request deletion of all data associated with a specified user identifier. You will need a user identifier to specify the associated records to delete. With the API you can use either the client ID (still called this in the documentation but would be the “device ID” in GA4 nomenclature), user ID, or the app instance ID. Here is Google’s documentation for executing these requests.
Some important notes from Google’s documentation regarding data deletion requests:
- For user data deletion requests, once deletion is requested, data associated with the user identifier 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 approximately every two months.
- If data has been exported outside of GA4, they recommend you delete it there prior to making the GA4 deletion request. The data deletion request will only delete data in GA4 and not in BigQuery or other potentially connected products. You will need to delete data in these downstream connected locations separately.
- Note that reports based on previously aggregated data (for example, user counts in the audience overview report) will be unaffected.
Resources
- Google Support article for data deletion requests
- Google Support for deleting users and data via User Explorer in the UI
- Google Developer resource for the User Deletion API
Collecting Client ID Necessary to Execute Requests
Pro Tip: The device ID for GA4 is the “client ID”. This value is stored on the user’s browser in the ‘_ga’ first party cookie. You can collect this cookie value as a hidden field with the form used for submitting DSAR and deletion requests. Extracting the client ID from the cookie value provides the information necessary to execute the request even for a pseudonymous user.
- The cookie value is in the format of [version.domain components.cliendid.timestamp]:
- Example: GA1.1.1069988591.1657793649 –
- Version number – 1
- Number of components in the domain – 1
- Client ID – 1069988591
- Timestamp – 1657793649