Note:The clearData and exportData functions are a convenient way to manage data organized under a single user ID. If you use more complicated data structures, for example, message responses nested under another user's ID, you may need more advanced patterns for your clear and export functions.

Add clearData or exportData to your app

The clearData and exportData functions in the library are implemented as Cloud Functions that operate on data in Realtime Database, Cloud Storage, and Cloud Firestore. Adding the functions in your own app is a three step process:

Edit the library's user_privacy.json file

When you've done that, open functions/user_privacy.json in a text editor. The json file has a series of customizable paths that the clearData and exportData functions use to find your app's data in Realtime Database, Cloud Firestore, and Cloud Storage. If your app only uses one or two of those services, start by deleting the JSON objects associated with the unused services.

With the objects gone, you can begin to replace the remaining services' placeholder values with the actual data structures your app uses.

Add Realtime Database paths to user data

To customize user_privacy.json for your app's Realtime Database instance, replace the list of placeholder strings under "database" with actual paths to user data: