Learn business growth with Google Analytics 4 › Forums › Google Analytics 4 › How can I quickly remove logged events from Firebase or Google Analytics? › Reply To: How can I quickly remove logged events from Firebase or Google Analytics?
-
Sure, I’d be happy to guide you!
Google Analytics offers the User Deletion API where you can process data deletions for a specific user identifier. You can set this up from the top right drop down menu of events dashboard in Google Analytics. You’ll see many options, including setting up a custom timeframe for your deletions.
For handling it via Cloud Functions, it’s quite feasible too! Cloud Functions has friendly support for Google Analytics’ AnalyticsEvent. By using this, you can work with any conversion events you have logged and set up functions that trigger in response to such events.
Google Analytics for Firebase triggers even allow you to log event-related activity. This means you can track any user interactions in your app and set triggers based on these actions.
For instance, you can write a function that sets off when an ‘in_app_purchase event’ occurs. Specify the Analytics event that you want to seed your function using the
functions.analytics.event()
method.Then, you just handle the event within the
onLog()
event handler:`
exports.sendCouponOnPurchase = functions.analytics.event(‘in_app_purchase’).onLog((event) => {
// Your code to handle delete
});
`
So, in this transformed function, you can draft your deletions code and voila, you got yourself an automated data scrubber!Remember, you need to have the required access credentials for calling the API from Cloud Functions. All feasible and right at your fingertips with a few lines of code!