Skip to main content

Firebase integration

If you are using Firebase as your backend, you can integrate Metric by using Firebase Cloud Functions. Firebase Cloud Functions allow you to run server-side code in response to events and HTTPS requests. Metric can send data to your Firebase Cloud Function through a webhook, which allows you to store the data in your Firebase database.

We have provided an example Firebase Cloud Function for Metric integration, which you can find in our GitHub repository. The repository contains TypeScript and JavaScript files that demonstrate how to use the Firebase Cloud Functions for Metric integration.


To use the example function, follow these steps:

  • Clone the repository from GitHub.
  • Copy the code from either the TypeScript or JavaScript file in the repository, depending on your preference.
  • Paste the code into the index.js or index.ts file in the src/ folder of your Firebase Cloud Functions project.
  • Update the value of FIREBASE_COLLECTION_NAME to the name of the collection where you want to store the data.
  • Make sure cloud functions are enabled in the Firebase console.
  • Deploy the function using npm run deploy or firebase deploy --only functions.
  • Note the URL mentioned under the function name in the Firebase console.
  • Add the URL to the webhook section of the Metric dashboard.

That's it! Your Firebase Cloud Function is now ready to receive data from Metric.


Using Firebase Cloud Functions is an easy and scalable way to integrate Metric with your Firebase backend. The example function in our GitHub repository provides a starting point for your integration, and you can customize it to meet your specific needs.