---
description: Unofficial Capacitor plugin for Firebase Performance Monitoring SDK to measure app performance and identify bottlenecks.
title: Capacitor Firebase Performance Plugin - Capawesome
image: https://capawesome.io/docs/assets/images/social/sdks/capacitor/firebase/performance-monitoring.png
---

<!doctype html> 

[Skip to content ](#capacitor-firebaseperformance) 

[🖥️ Introducing the **Capacitor Electron Platform** — build desktop apps for macOS, Windows, and Linux. Free & open source. ](/blog/announcing-the-capacitor-electron-platform/) 

* [ SDKs ](/docs/sdks/)
* [ iOS ](#ios)
* [ Configuration ](#configuration)
* [ Demo ](#demo)
* [ Usage ](#usage)
* [ API ](#api)
* [ Type Aliases ](#type-aliases)
* [ FAQ ](#faq)
* [ Related Plugins ](#related-plugins)
* [ Newsletter ](#newsletter)
* [ Changelog ](#changelog)
* [ License ](#license)
* [ Remote Config ](/docs/sdks/capacitor/firebase/remote-config/)
* [ Formbricks ](/docs/sdks/capacitor/formbricks/)
* [ Geocoder ](/docs/sdks/capacitor/geocoder/)
* [ Google Sign-In ](/docs/sdks/capacitor/google-sign-in/)
* [ Grafana Faro ](/docs/sdks/capacitor/grafana-faro/)
* [ Gyroscope ](/docs/sdks/capacitor/gyroscope/)
* [ Haptics ](/docs/sdks/capacitor/haptics/)
* [ Home Indicator ](/docs/sdks/capacitor/home-indicator/)
* [ In-App Browser ](/docs/sdks/capacitor/in-app-browser/)
* [ Install Referrer ](/docs/sdks/capacitor/install-referrer/)
* [ Intercom ](/docs/sdks/capacitor/intercom/)
* [ Intune ](/docs/sdks/capacitor/intune/)
* [ Keep Awake ](/docs/sdks/capacitor/keep-awake/)
* [ libSQL ](/docs/sdks/capacitor/libsql/)
* [ Light Sensor ](/docs/sdks/capacitor/light-sensor/)
* [ Live Update ](/docs/sdks/capacitor/live-update/)
* [ Localization ](/docs/sdks/capacitor/localization/)
* [ Mail Composer ](/docs/sdks/capacitor/mail-composer/)
* [ Managed Configurations ](/docs/sdks/capacitor/managed-configurations/)
* [ Maps Launcher ](/docs/sdks/capacitor/maps-launcher/)
* [ Media Session ](/docs/sdks/capacitor/media-session/)
* [ ML Kit ](/docs/sdks/capacitor/mlkit/)
* [ Navigation Bar ](/docs/sdks/capacitor/navigation-bar/)
* [ Network ](/docs/sdks/capacitor/network/)
* [ NFC ](/docs/sdks/capacitor/nfc/)
* [ Node.js ](/docs/sdks/capacitor/nodejs/)
* [ OAuth ](/docs/sdks/capacitor/oauth/)
* [ Passkeys ](/docs/sdks/capacitor/passkeys/)
* [ Password Autofill ](/docs/sdks/capacitor/password-autofill/)
* [ PDF Generator ](/docs/sdks/capacitor/pdf-generator/)
* [ PDF Viewer ](/docs/sdks/capacitor/pdf-viewer/)
* [ Pedometer ](/docs/sdks/capacitor/pedometer/)
* [ Permissions ](/docs/sdks/capacitor/permissions/)
* [ Phone Dialer ](/docs/sdks/capacitor/phone-dialer/)
* [ Photo Editor ](/docs/sdks/capacitor/photo-editor/)
* [ Photo Manipulator ](/docs/sdks/capacitor/photo-manipulator/)
* [ PixLive ](/docs/sdks/capacitor/pixlive/)
* [ PostHog ](/docs/sdks/capacitor/posthog/)
* [ Printer ](/docs/sdks/capacitor/printer/)
* [ Privacy Screen ](/docs/sdks/capacitor/privacy-screen/)
* [ Proximity Sensor ](/docs/sdks/capacitor/proximity-sensor/)
* [ Purchases ](/docs/sdks/capacitor/purchases/)
* [ RealtimeKit ](/docs/sdks/capacitor/realtimekit/)
* [ Root Detection ](/docs/sdks/capacitor/root-detection/)
* [ Screen Brightness ](/docs/sdks/capacitor/screen-brightness/)
* [ Screen Orientation ](/docs/sdks/capacitor/screen-orientation/)
* [ Screen Reader ](/docs/sdks/capacitor/screen-reader/)
* [ Screenshot ](/docs/sdks/capacitor/screenshot/)
* [ Secure Preferences ](/docs/sdks/capacitor/secure-preferences/)
* [ Settings Launcher ](/docs/sdks/capacitor/settings-launcher/)
* [ Shake ](/docs/sdks/capacitor/shake/)
* [ Silent Mode ](/docs/sdks/capacitor/silent-mode/)
* [ SIM ](/docs/sdks/capacitor/sim/)
* [ SMS Composer ](/docs/sdks/capacitor/sms-composer/)
* [ Speech Recognition ](/docs/sdks/capacitor/speech-recognition/)
* [ Speech Synthesis ](/docs/sdks/capacitor/speech-synthesis/)
* [ Share Target ](/docs/sdks/capacitor/share-target/)
* [ Square Mobile Payments ](/docs/sdks/capacitor/square-mobile-payments/)
* [ SQLite ](/docs/sdks/capacitor/sqlite/)
* [ Superwall ](/docs/sdks/capacitor/superwall/)
* [ System WebView ](/docs/sdks/capacitor/system-webview/)
* [ Tauri ](/docs/sdks/capacitor/tauri/)
* [ Text Interaction ](/docs/sdks/capacitor/text-interaction/)
* [ Text Zoom ](/docs/sdks/capacitor/text-zoom/)
* [ Thermal State ](/docs/sdks/capacitor/thermal-state/)
* [ Toast ](/docs/sdks/capacitor/toast/)
* [ Torch ](/docs/sdks/capacitor/torch/)
* [ Vault ](/docs/sdks/capacitor/vault/)
* [ Volume ](/docs/sdks/capacitor/volume/)
* [ Wallet ](/docs/sdks/capacitor/wallet/)
* [ Wifi ](/docs/sdks/capacitor/wifi/)
* [ YouTube Player ](/docs/sdks/capacitor/youtube-player/)
* [ Zip ](/docs/sdks/capacitor/zip/)
* [ Cordova ](/docs/sdks/cordova/)
* [ Cloud ](/docs/cloud/)
* [ Integrations ](/docs/cloud/live-updates/integrations/)
* Concepts
* Reference
* [ Troubleshooting ](/docs/cloud/live-updates/troubleshooting/)
* [ FAQ ](/docs/cloud/live-updates/faq/)
* [ Native Builds ](/docs/cloud/native-builds/)
* [ Set Up Environments ](/docs/cloud/native-builds/environments/)
* [ Overwrite Native Configurations ](/docs/cloud/native-builds/native-configurations/)
* [ Auto-Increment Build Numbers ](/docs/cloud/native-builds/auto-incrementing-build-numbers/)
* [ Configure the Web Build Script ](/docs/cloud/native-builds/web-build-script/)
* [ Build from a Monorepo ](/docs/cloud/native-builds/monorepo/)
* [ Use pnpm, Yarn, or bun ](/docs/cloud/native-builds/package-managers/)
* [ Install Private npm Packages ](/docs/cloud/native-builds/npm-private-registry/)
* [ Override the Java Version ](/docs/cloud/native-builds/override-java-version/)
* [ Custom iOS Provisioning Profiles ](/docs/cloud/native-builds/custom-ios-provisioning-profiles/)
* [ Build without Git ](/docs/cloud/native-builds/build-without-git/)
* [ Access Git Behind a Firewall ](/docs/cloud/native-builds/firewall-access/)
* [ Integrations ](/docs/cloud/native-builds/integrations/)
* Reference
* [ Troubleshooting ](/docs/cloud/native-builds/troubleshooting/)
* [ FAQ ](/docs/cloud/native-builds/faq/)
* [ App Store Publishing ](/docs/cloud/app-store-publishing/)
* [ Submit a Build ](/docs/cloud/app-store-publishing/submit-a-build/)
* [ Submit Automatically After a Build ](/docs/cloud/app-store-publishing/submit-automatically/)
* [ Troubleshooting ](/docs/cloud/app-store-publishing/troubleshooting/)
* [ FAQ ](/docs/cloud/app-store-publishing/faq/)
* [ Automations ](/docs/cloud/automations/)
* [ Reference ](/docs/cloud/automations/reference/)
* [ Troubleshooting ](/docs/cloud/automations/troubleshooting/)
* [ FAQ ](/docs/cloud/automations/faq/)
* [ Assist ](/docs/cloud/assist/)
* [ CLI ](/docs/cloud/cli/)
* APIs and SDKs
* [ Webhooks ](/docs/cloud/webhooks/)
* [ Integrations ](/docs/cloud/integrations/)
* Account
* [ Organization ](/docs/cloud/organizations/)
* [ Two-Factor Enforcement ](/docs/cloud/organizations/two-factor-authentication/)
* [ Audit Logs ](/docs/cloud/organizations/audit-logs/)
* [ Billing ](/docs/cloud/organizations/billing/)
* [ License Keys ](/docs/cloud/license-keys/)
* [ AI ](/docs/ai/)
* [ Insiders ](/docs/insiders/)
* [ Billing & Plans ](/docs/insiders/billing-and-plans/)
* [ FAQ ](/docs/insiders/faq/)
* [ License ](https://capawesome.io/legal/eula/)
* [ Support ](/docs/support/)
* [ Contributing ](/docs/contributing/)
* Contributing code
* [ Code of Conduct ](/docs/contributing/code-of-conduct/)
* [ Questions ](https://docs.github.com/en/discussions/collaborating-with-your-community-using-discussions/participating-in-a-discussion#creating-a-discussion)
* [ Blog ](/blog/)
* Categories

* [ iOS ](#ios)
* [ Configuration ](#configuration)
* [ Demo ](#demo)
* [ Usage ](#usage)
* [ API ](#api)
* [ Type Aliases ](#type-aliases)
* [ FAQ ](#faq)
* [ Related Plugins ](#related-plugins)
* [ Newsletter ](#newsletter)
* [ Changelog ](#changelog)
* [ License ](#license)

# @capacitor-firebase/performance[¶](#capacitor-firebaseperformance "Permanent link")

Unofficial Capacitor plugin for [Firebase Performance Monitoring](https://firebase.google.com/docs/perf-mon).[1](#fn:1)

[ ![Deliver Live Updates to your Capacitor app with Capawesome Cloud](../../../../assets/external/cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.69628c3f.png) ](https://cloud.capawesome.io/) 

## Use Cases[¶](#use-cases "Permanent link")

The Firebase Performance Monitoring plugin is typically used to gain insight into the performance characteristics of your app, for example:

* **Custom code traces**: Measure how long specific tasks in your app take, such as loading data or processing an image.
* **Custom metrics**: Count performance-related events within a trace, such as cache hits or retries.
* **Performance segmentation**: Add custom attributes to your traces, such as a user id, to segment your performance data.
* **Privacy compliance**: Enable or disable performance monitoring at runtime, for example based on the user's consent.

## Compatibility[¶](#compatibility "Permanent link")

| Plugin Version | Capacitor Version | Status         |
| -------------- | ----------------- | -------------- |
| 8.x.x          | \>=8.x.x          | Active support |
| 7.x.x          | 7.x.x             | Deprecated     |
| 6.x.x          | 6.x.x             | Deprecated     |
| 5.x.x          | 5.x.x             | Deprecated     |
| 1.x.x          | 4.x.x             | Deprecated     |

## Installation[¶](#installation "Permanent link")

You can use our **AI-Assisted Setup** to install the plugin. Add the [Capawesome Skills](https://github.com/capawesome-team/skills) to your AI tool using the following command:

`[](#%5F%5Fcodelineno-0-1)npx skills add capawesome-team/skills --skill capacitor-plugins
`

Then use the following prompt:

`` [](#%5F%5Fcodelineno-1-1)Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capacitor-firebase/performance` plugin in my project.
 ``

If you prefer **Manual Setup**, install the plugin by running the following commands and follow the platform-specific instructions below:

`[](#%5F%5Fcodelineno-2-1)npm install @capacitor-firebase/performance firebase
[](#%5F%5Fcodelineno-2-2)npx cap sync
`

Add Firebase to your project if you haven't already ([Android](https://github.com/capawesome-team/capacitor-firebase/blob/main/docs/firebase-setup.md#android) / [iOS](https://github.com/capawesome-team/capacitor-firebase/blob/main/docs/firebase-setup.md#ios) / [Web](https://github.com/capawesome-team/capacitor-firebase/blob/main/docs/firebase-setup.md#web)).

### Android[¶](#android "Permanent link")

See [Add the Performance Monitoring plugin to your app](https://firebase.google.com/docs/perf-mon/get-started-android#add-perfmon-plugin) and follow the instructions to set up your app correctly.

#### Variables[¶](#variables "Permanent link")

If needed, you can define the following project variable in your app’s `variables.gradle` file to change the default version of the dependency:

* `$firebasePerfVersion` version of `com.google.firebase:firebase-perf` (default: `22.0.4`)

This can be useful if you encounter dependency conflicts with other plugins in your project.

### iOS[¶](#ios "Permanent link")

#### Swift Package Manager[¶](#swift-package-manager "Permanent link")

Add the following to your `capacitor.config.json` (or `capacitor.config.ts`) to avoid a [SwiftPM package identity collision](https://github.com/capawesome-team/capacitor-firebase/issues/959):

`[](#%5F%5Fcodelineno-3-1){
[](#%5F%5Fcodelineno-3-2)  "experimental": {
[](#%5F%5Fcodelineno-3-3)    "ios": {
[](#%5F%5Fcodelineno-3-4)      "spm": {
[](#%5F%5Fcodelineno-3-5)        "packageOptions": {
[](#%5F%5Fcodelineno-3-6)          "@capacitor-firebase/performance": {
[](#%5F%5Fcodelineno-3-7)            "symlink": true
[](#%5F%5Fcodelineno-3-8)          }
[](#%5F%5Fcodelineno-3-9)        }
[](#%5F%5Fcodelineno-3-10)      }
[](#%5F%5Fcodelineno-3-11)    }
[](#%5F%5Fcodelineno-3-12)  }
[](#%5F%5Fcodelineno-3-13)}
`

**Attention**: SPM `packageOptions` support requires Capacitor CLI **8.4.0+**.

## Configuration[¶](#configuration "Permanent link")

No configuration required for this plugin.

## Demo[¶](#demo "Permanent link")

A working example can be found here: [robingenz/capacitor-firebase-plugin-demo](https://github.com/robingenz/capacitor-firebase-plugin-demo)

## Usage[¶](#usage "Permanent link")

The following examples show how to start and stop traces, record custom metrics, add custom attributes, toggle performance monitoring, and record a trace manually.

### Start and stop a trace[¶](#start-and-stop-a-trace "Permanent link")

Start a custom code trace to measure how long a specific task in your app takes and stop it as soon as the task is completed:

`[](#%5F%5Fcodelineno-4-1)import { FirebasePerformance } from '@capacitor-firebase/performance';
[](#%5F%5Fcodelineno-4-2)
[](#%5F%5Fcodelineno-4-3)const startTrace = async () => {
[](#%5F%5Fcodelineno-4-4)  await FirebasePerformance.startTrace({ traceName: 'test_trace' });
[](#%5F%5Fcodelineno-4-5)};
[](#%5F%5Fcodelineno-4-6)
[](#%5F%5Fcodelineno-4-7)const stopTrace = async () => {
[](#%5F%5Fcodelineno-4-8)  await FirebasePerformance.stopTrace({ traceName: 'test_trace' });
[](#%5F%5Fcodelineno-4-9)};
`

### Record custom metrics[¶](#record-custom-metrics "Permanent link")

Set the value of a custom metric for a trace, increment it atomically, or read its current value. Note that metric values are floored down to the nearest integer:

`[](#%5F%5Fcodelineno-5-1)import { FirebasePerformance } from '@capacitor-firebase/performance';
[](#%5F%5Fcodelineno-5-2)
[](#%5F%5Fcodelineno-5-3)const putMetric = async () => {
[](#%5F%5Fcodelineno-5-4)  await FirebasePerformance.putMetric({
[](#%5F%5Fcodelineno-5-5)    traceName: 'test_trace',
[](#%5F%5Fcodelineno-5-6)    metricName: 'item_cache_hit',
[](#%5F%5Fcodelineno-5-7)    num: 1,
[](#%5F%5Fcodelineno-5-8)  });
[](#%5F%5Fcodelineno-5-9)};
[](#%5F%5Fcodelineno-5-10)
[](#%5F%5Fcodelineno-5-11)const incrementMetric = async () => {
[](#%5F%5Fcodelineno-5-12)  await FirebasePerformance.incrementMetric({
[](#%5F%5Fcodelineno-5-13)    traceName: 'test_trace',
[](#%5F%5Fcodelineno-5-14)    metricName: 'item_cache_hit',
[](#%5F%5Fcodelineno-5-15)    incrementBy: 1,
[](#%5F%5Fcodelineno-5-16)  });
[](#%5F%5Fcodelineno-5-17)};
[](#%5F%5Fcodelineno-5-18)
[](#%5F%5Fcodelineno-5-19)const getMetric = async () => {
[](#%5F%5Fcodelineno-5-20)  const result = await FirebasePerformance.getMetric({
[](#%5F%5Fcodelineno-5-21)    traceName: 'test_trace',
[](#%5F%5Fcodelineno-5-22)    metricName: 'item_cache_hit',
[](#%5F%5Fcodelineno-5-23)  });
[](#%5F%5Fcodelineno-5-24)  return result.value;
[](#%5F%5Fcodelineno-5-25)};
`

### Add custom attributes to a trace[¶](#add-custom-attributes-to-a-trace "Permanent link")

Set custom attributes on a trace, for example a user id, to segment your performance data. You can also read or remove them again:

`[](#%5F%5Fcodelineno-6-1)import { FirebasePerformance } from '@capacitor-firebase/performance';
[](#%5F%5Fcodelineno-6-2)
[](#%5F%5Fcodelineno-6-3)const putAttribute = async () => {
[](#%5F%5Fcodelineno-6-4)  await FirebasePerformance.putAttribute({
[](#%5F%5Fcodelineno-6-5)    traceName: 'test_trace',
[](#%5F%5Fcodelineno-6-6)    attribute: 'user_id',
[](#%5F%5Fcodelineno-6-7)    value: '123',
[](#%5F%5Fcodelineno-6-8)  });
[](#%5F%5Fcodelineno-6-9)};
[](#%5F%5Fcodelineno-6-10)
[](#%5F%5Fcodelineno-6-11)const getAttribute = async () => {
[](#%5F%5Fcodelineno-6-12)  const result = await FirebasePerformance.getAttribute({
[](#%5F%5Fcodelineno-6-13)    traceName: 'test_trace',
[](#%5F%5Fcodelineno-6-14)    attribute: 'user_id',
[](#%5F%5Fcodelineno-6-15)  });
[](#%5F%5Fcodelineno-6-16)  return result.attributes;
[](#%5F%5Fcodelineno-6-17)};
[](#%5F%5Fcodelineno-6-18)
[](#%5F%5Fcodelineno-6-19)const getAttributes = async () => {
[](#%5F%5Fcodelineno-6-20)  const result = await FirebasePerformance.getAttributes({ traceName: 'test_trace' });
[](#%5F%5Fcodelineno-6-21)  return result.attributes;
[](#%5F%5Fcodelineno-6-22)};
[](#%5F%5Fcodelineno-6-23)
[](#%5F%5Fcodelineno-6-24)const removeAttribute = async () => {
[](#%5F%5Fcodelineno-6-25)  await FirebasePerformance.removeAttribute({
[](#%5F%5Fcodelineno-6-26)    traceName: 'test_trace',
[](#%5F%5Fcodelineno-6-27)    attribute: 'user_id',
[](#%5F%5Fcodelineno-6-28)  });
[](#%5F%5Fcodelineno-6-29)};
`

### Enable or disable performance monitoring[¶](#enable-or-disable-performance-monitoring "Permanent link")

Enable or disable performance monitoring at runtime, for example based on the user's consent. The setting is applied with the next start of the app:

`[](#%5F%5Fcodelineno-7-1)import { FirebasePerformance } from '@capacitor-firebase/performance';
[](#%5F%5Fcodelineno-7-2)
[](#%5F%5Fcodelineno-7-3)const setEnabled = async () => {
[](#%5F%5Fcodelineno-7-4)  await FirebasePerformance.setEnabled({ enabled: true });
[](#%5F%5Fcodelineno-7-5)};
[](#%5F%5Fcodelineno-7-6)
[](#%5F%5Fcodelineno-7-7)const isEnabled = async () => {
[](#%5F%5Fcodelineno-7-8)  const result = await FirebasePerformance.isEnabled();
[](#%5F%5Fcodelineno-7-9)  return result.enabled;
[](#%5F%5Fcodelineno-7-10)};
`

### Record a trace manually[¶](#record-a-trace-manually "Permanent link")

Record a trace for a task that has already been completed by providing its start time and duration. Only available on Web:

`[](#%5F%5Fcodelineno-8-1)import { FirebasePerformance } from '@capacitor-firebase/performance';
[](#%5F%5Fcodelineno-8-2)
[](#%5F%5Fcodelineno-8-3)const record = async () => {
[](#%5F%5Fcodelineno-8-4)  await FirebasePerformance.record({
[](#%5F%5Fcodelineno-8-5)    traceName: 'test_trace',
[](#%5F%5Fcodelineno-8-6)    startTime: Date.now(),
[](#%5F%5Fcodelineno-8-7)    duration: 1000,
[](#%5F%5Fcodelineno-8-8)    options: {
[](#%5F%5Fcodelineno-8-9)      metrics: {
[](#%5F%5Fcodelineno-8-10)        item_cache_hit: 1,
[](#%5F%5Fcodelineno-8-11)      },
[](#%5F%5Fcodelineno-8-12)      attributes: {
[](#%5F%5Fcodelineno-8-13)        user_id: '123',
[](#%5F%5Fcodelineno-8-14)      },
[](#%5F%5Fcodelineno-8-15)    },
[](#%5F%5Fcodelineno-8-16)  });
[](#%5F%5Fcodelineno-8-17)};
`

## API[¶](#api "Permanent link")

* [startTrace(...)](#starttrace)
* [stopTrace(...)](#stoptrace)
* [incrementMetric(...)](#incrementmetric)
* [setEnabled(...)](#setenabled)
* [isEnabled()](#isenabled)
* [putAttribute(...)](#putattribute)
* [getAttribute(...)](#getattribute)
* [getAttributes(...)](#getattributes)
* [removeAttribute(...)](#removeattribute)
* [putMetric(...)](#putmetric)
* [getMetric(...)](#getmetric)
* [record(...)](#record)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)

### startTrace(...)[¶](#starttrace "Permanent link")

`[](#%5F%5Fcodelineno-9-1)startTrace(options: StartTraceOptions) => Promise<void>
`

Starts a trace.

| Param       | Type                                    |
| ----------- | --------------------------------------- |
| **options** | [StartTraceOptions](#starttraceoptions) |

**Since:** 0.1.0

---

### stopTrace(...)[¶](#stoptrace "Permanent link")

`[](#%5F%5Fcodelineno-10-1)stopTrace(options: StopTraceOptions) => Promise<void>
`

Stops a trace.

| Param       | Type                                  |
| ----------- | ------------------------------------- |
| **options** | [StopTraceOptions](#stoptraceoptions) |

**Since:** 0.1.0

---

### incrementMetric(...)[¶](#incrementmetric "Permanent link")

`[](#%5F%5Fcodelineno-11-1)incrementMetric(options: IncrementMetricOptions) => Promise<void>
`

Atomically increments the metric with the given name for the selected trace by the `incrementBy` value.

| Param       | Type                                              |
| ----------- | ------------------------------------------------- |
| **options** | [IncrementMetricOptions](#incrementmetricoptions) |

**Since:** 0.1.0

---

### setEnabled(...)[¶](#setenabled "Permanent link")

`[](#%5F%5Fcodelineno-12-1)setEnabled(options: SetEnabledOptions) => Promise<void>
`

Enables or disables performance monitoring. Will be applied with the next start of the app.

| Param       | Type                                    |
| ----------- | --------------------------------------- |
| **options** | [SetEnabledOptions](#setenabledoptions) |

**Since:** 0.1.0

---

### isEnabled()[¶](#isenabled "Permanent link")

`[](#%5F%5Fcodelineno-13-1)isEnabled() => Promise<IsEnabledResult>
`

Determines whether performance monitoring is enabled or disabled.

**Returns:** `Promise<[IsEnabledResult](#isenabledresult)>`

**Since:** 0.1.0

---

### putAttribute(...)[¶](#putattribute "Permanent link")

`[](#%5F%5Fcodelineno-14-1)putAttribute(options: PutAttributeOptions) => Promise<void>
`

Sets a custom attribute of a trace to a given value.

| Param       | Type                                        |
| ----------- | ------------------------------------------- |
| **options** | [PutAttributeOptions](#putattributeoptions) |

**Since:** 6.3.0

---

### getAttribute(...)[¶](#getattribute "Permanent link")

`[](#%5F%5Fcodelineno-15-1)getAttribute(options: GetAttributeOptions) => Promise<GetAttributeResult>
`

Returns the value of a custom attribute of a trace.

| Param       | Type                                        |
| ----------- | ------------------------------------------- |
| **options** | [GetAttributeOptions](#getattributeoptions) |

**Returns:** `Promise<[GetAttributeResult](#getattributeresult)>`

**Since:** 6.3.0

---

### getAttributes(...)[¶](#getattributes "Permanent link")

`[](#%5F%5Fcodelineno-16-1)getAttributes(options: GetAttributesOptions) => Promise<GetAttributesResult>
`

Gets the all the custom attributes of a trace with their values.

| Param       | Type                                          |
| ----------- | --------------------------------------------- |
| **options** | [GetAttributesOptions](#getattributesoptions) |

**Returns:** `Promise<[GetAttributesResult](#getattributesresult)>`

**Since:** 6.3.0

---

### removeAttribute(...)[¶](#removeattribute "Permanent link")

`[](#%5F%5Fcodelineno-17-1)removeAttribute(options: RemoveAttributeOptions) => Promise<void>
`

Removes a custom attribute from a trace given its name.

| Param       | Type                                        |
| ----------- | ------------------------------------------- |
| **options** | [GetAttributeOptions](#getattributeoptions) |

**Since:** 6.3.0

---

### putMetric(...)[¶](#putmetric "Permanent link")

`[](#%5F%5Fcodelineno-18-1)putMetric(options: PutMetricOptions) => Promise<void>
`

Sets the value of a custom metric.

| Param       | Type                                  |
| ----------- | ------------------------------------- |
| **options** | [PutMetricOptions](#putmetricoptions) |

**Since:** 6.3.0

---

### getMetric(...)[¶](#getmetric "Permanent link")

`[](#%5F%5Fcodelineno-19-1)getMetric(options: GetMetricOptions) => Promise<GetMetricResult>
`

Get the value of a custom metric by name.

| Param       | Type                                  |
| ----------- | ------------------------------------- |
| **options** | [GetMetricOptions](#getmetricoptions) |

**Returns:** `Promise<[GetMetricResult](#getmetricresult)>`

**Since:** 6.3.0

---

### record(...)[¶](#record "Permanent link")

`[](#%5F%5Fcodelineno-20-1)record(options: RecordOptions) => Promise<void>
`

Records a trace given its name and options.

Only available on web.

| Param       | Type                            |
| ----------- | ------------------------------- |
| **options** | [RecordOptions](#recordoptions) |

**Since:** 6.3.0

---

### Interfaces[¶](#interfaces "Permanent link")

#### StartTraceOptions[¶](#starttraceoptions "Permanent link")

| Prop          | Type   | Description                                                                                                                                                                                      | Since |
| ------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |
| **traceName** | string | Custom trace name. Names for custom code traces must meet the following requirements: no leading or trailing whitespace, no leading underscore (\_) character, and max length is 100 characters. | 0.1.0 |

#### StopTraceOptions[¶](#stoptraceoptions "Permanent link")

| Prop          | Type   | Description                                     | Since |
| ------------- | ------ | ----------------------------------------------- | ----- |
| **traceName** | string | Name of the trace that was set with startTrace. | 0.1.0 |

#### IncrementMetricOptions[¶](#incrementmetricoptions "Permanent link")

| Prop            | Type   | Description                                       | Default | Since |
| --------------- | ------ | ------------------------------------------------- | ------- | ----- |
| **traceName**   | string | Name of the trace that was set with startTrace.   |         | 0.1.0 |
| **metricName**  | string | Name of the metric to be incremented.             |         | 0.1.0 |
| **incrementBy** | number | Amount by which the metric has to be incremented. | 1       | 0.1.0 |

#### SetEnabledOptions[¶](#setenabledoptions "Permanent link")

| Prop        | Type    | Description                               | Since |
| ----------- | ------- | ----------------------------------------- | ----- |
| **enabled** | boolean | Should performance monitoring be enabled. | 0.1.0 |

#### IsEnabledResult[¶](#isenabledresult "Permanent link")

| Prop        | Type    | Description                                                 | Since |
| ----------- | ------- | ----------------------------------------------------------- | ----- |
| **enabled** | boolean | true if performance monitoring is enabled, otherwise false. | 0.1.0 |

#### PutAttributeOptions[¶](#putattributeoptions "Permanent link")

| Prop          | Type   | Description                             | Since |
| ------------- | ------ | --------------------------------------- | ----- |
| **traceName** | string | Name of the trace to set its attribute. | 6.3.0 |
| **attribute** | string | Name of the attribute to set its value. | 6.3.0 |
| **value**     | string | The value to set to the attribute.      | 6.3.0 |

#### GetAttributeResult[¶](#getattributeresult "Permanent link")

| Prop      | Type           | Description                        | Since |
| --------- | -------------- | ---------------------------------- | ----- |
| **value** | string \| null | The value of the custom attribute. | 6.3.0 |

#### GetAttributeOptions[¶](#getattributeoptions "Permanent link")

| Prop          | Type   | Description                                  | Since |
| ------------- | ------ | -------------------------------------------- | ----- |
| **traceName** | string | Name of the trace to set its attribute.      | 6.3.0 |
| **attribute** | string | Name of the attribute to retrieve its value. | 6.3.0 |

#### GetAttributesResult[¶](#getattributesresult "Permanent link")

| Prop           | Type                         | Description                                                  | Since |
| -------------- | ---------------------------- | ------------------------------------------------------------ | ----- |
| **attributes** | { \[key: string\]: string; } | A map of all custom attributes of a trace with their values. | 6.3.0 |

#### GetAttributesOptions[¶](#getattributesoptions "Permanent link")

| Prop          | Type   | Description                              | Since |
| ------------- | ------ | ---------------------------------------- | ----- |
| **traceName** | string | Name of the trace to get its attributes. | 6.3.0 |

#### PutMetricOptions[¶](#putmetricoptions "Permanent link")

| Prop           | Type   | Description                                                                              | Since |
| -------------- | ------ | ---------------------------------------------------------------------------------------- | ----- |
| **traceName**  | string | Name of the trace to set its metric.                                                     | 6.3.0 |
| **metricName** | string | The metric name.                                                                         | 6.3.0 |
| **num**        | number | The value to set for the metric. The given value is floored down to the nearest integer. | 6.3.0 |

#### GetMetricResult[¶](#getmetricresult "Permanent link")

| Prop      | Type   | Description                        | Since |
| --------- | ------ | ---------------------------------- | ----- |
| **value** | number | The value of the metric if exists. | 6.3.0 |

#### GetMetricOptions[¶](#getmetricoptions "Permanent link")

| Prop           | Type   | Description                          | Since |
| -------------- | ------ | ------------------------------------ | ----- |
| **traceName**  | string | Name of the trace to get its metric. | 6.3.0 |
| **metricName** | string | The metric name.                     | 6.3.0 |

#### RecordOptions[¶](#recordoptions "Permanent link")

| Prop          | Type                                                                                   | Description                                                                   | Since |
| ------------- | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----- |
| **traceName** | string                                                                                 | Name of the trace to record.                                                  | 6.3.0 |
| **startTime** | number                                                                                 | Start time of the trace since epoch in milliseconds.                          | 6.3.0 |
| **duration**  | number                                                                                 | The duration of the trace in milliseconds.                                    | 6.3.0 |
| **options**   | { metrics?: { \[key: string\]: number; }; attributes?: { \[key: string\]: string; }; } | An optional object that holds optional maps of custom metrics and attributes. | 6.3.0 |

### Type Aliases[¶](#type-aliases "Permanent link")

#### RemoveAttributeOptions[¶](#removeattributeoptions "Permanent link")

`[GetAttributeOptions](#getattributeoptions)`

## FAQ[¶](#faq "Permanent link")

### How do I measure the duration of a specific task in my app?[¶](#how-do-i-measure-the-duration-of-a-specific-task-in-my-app "Permanent link")

Start a custom code trace with `startTrace(...)` before the task begins and stop it with `stopTrace(...)` as soon as the task is completed, as shown in the [usage example](#start-and-stop-a-trace) above. You can enrich the trace with custom metrics and attributes before stopping it.

### What are the requirements for custom trace names?[¶](#what-are-the-requirements-for-custom-trace-names "Permanent link")

Names for custom code traces must not contain leading or trailing whitespace, must not start with an underscore (`_`), and may have a maximum length of 100 characters.

### What is the difference between a metric and an attribute?[¶](#what-is-the-difference-between-a-metric-and-an-attribute "Permanent link")

A metric is a numeric value of a trace, for example a counter for cache hits, which is set with `putMetric(...)` or incremented with `incrementMetric(...)`. Note that metric values are floored down to the nearest integer. An attribute is a string value of a trace, for example a user id, which is set with `putAttribute(...)` and can be used to segment your performance data.

### Can users disable performance monitoring at runtime?[¶](#can-users-disable-performance-monitoring-at-runtime "Permanent link")

Yes, call `setEnabled(...)` to enable or disable performance monitoring, for example based on the user's consent. The setting is applied with the next start of the app. Use `isEnabled()` to determine whether performance monitoring is currently enabled or disabled.

### Why does the `record` method not work on Android and iOS?[¶](#why-does-the-record-method-not-work-on-android-and-ios "Permanent link")

The `record(...)` method is only available on Web. On Android and iOS, use `startTrace(...)` and `stopTrace(...)` to measure the duration of a task instead.

## Related Plugins[¶](#related-plugins "Permanent link")

* [Firebase Analytics](https://capawesome.io/docs/sdks/capacitor/firebase/analytics/): Log events and user properties with Firebase Analytics.
* [Firebase Crashlytics](https://capawesome.io/docs/sdks/capacitor/firebase/crashlytics/): Track and analyze app crashes with Firebase Crashlytics.

## Newsletter[¶](#newsletter "Permanent link")

Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).

## Changelog[¶](#changelog "Permanent link")

See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-firebase/blob/main/packages/performance/CHANGELOG.md).

## License[¶](#license "Permanent link")

See [LICENSE](https://github.com/capawesome-team/capacitor-firebase/blob/main/packages/performance/LICENSE).

---

1. This project is not affiliated with, endorsed by, sponsored by, or approved by Google LLC or any of their affiliates or subsidiaries. [↩](#fnref:1 "Jump back to footnote 1 in the text")

July 8, 2026 

Back to top

```json
{"@context": "https://schema.org", "@graph": [{"@type": "TechArticle", "@id": "https://capawesome.io/docs/sdks/capacitor/firebase/performance-monitoring/#article", "headline": "Capacitor Firebase Performance Plugin", "name": "Capacitor Firebase Performance Plugin", "description": "Unofficial Capacitor plugin for Firebase Performance Monitoring SDK to measure app performance and identify bottlenecks.", "inLanguage": "en", "url": "https://capawesome.io/docs/sdks/capacitor/firebase/performance-monitoring/", "mainEntityOfPage": "https://capawesome.io/docs/sdks/capacitor/firebase/performance-monitoring/", "author": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}, "publisher": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}, "about": {"@id": "https://capawesome.io/docs/sdks/capacitor/firebase/performance-monitoring/#software"}}, {"@type": "SoftwareSourceCode", "@id": "https://capawesome.io/docs/sdks/capacitor/firebase/performance-monitoring/#software", "name": "Capacitor Firebase Performance Plugin", "description": "Unofficial Capacitor plugin for Firebase Performance Monitoring SDK to measure app performance and identify bottlenecks.", "url": "https://capawesome.io/docs/sdks/capacitor/firebase/performance-monitoring/", "programmingLanguage": "TypeScript", "runtimePlatform": "Capacitor", "codeRepository": "https://github.com/capawesome-team", "author": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}, "publisher": {"@type": "Organization", "name": "Capawesome", "url": "https://capawesome.io", "logo": {"@type": "ImageObject", "url": "https://capawesome.io/assets/images/logo.svg"}}}]}
{"@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{"@type": "Question", "name": "How do I measure the duration of a specific task in my app?", "acceptedAnswer": {"@type": "Answer", "text": "Start a custom code trace with startTrace(...) before the task begins and stop it with stopTrace(...) as soon as the task is completed, as shown in the usage example above. You can enrich the trace with custom metrics and attributes before stopping it."}}, {"@type": "Question", "name": "What are the requirements for custom trace names?", "acceptedAnswer": {"@type": "Answer", "text": "Names for custom code traces must not contain leading or trailing whitespace, must not start with an underscore ( _), and may have a maximum length of 100 characters."}}, {"@type": "Question", "name": "What is the difference between a metric and an attribute?", "acceptedAnswer": {"@type": "Answer", "text": "A metric is a numeric value of a trace, for example a counter for cache hits, which is set with putMetric(...) or incremented with incrementMetric(...). Note that metric values are floored down to the nearest integer. An attribute is a string value of a trace, for example a user id, which is set with putAttribute(...) and can be used to segment your performance data."}}, {"@type": "Question", "name": "Can users disable performance monitoring at runtime?", "acceptedAnswer": {"@type": "Answer", "text": "Yes, call setEnabled(...) to enable or disable performance monitoring, for example based on the user's consent. The setting is applied with the next start of the app. Use isEnabled() to determine whether performance monitoring is currently enabled or disabled."}}, {"@type": "Question", "name": "Why does the record method not work on Android and iOS?", "acceptedAnswer": {"@type": "Answer", "text": "The record(...) method is only available on Web. On Android and iOS, use startTrace(...) and stopTrace(...) to measure the duration of a task instead."}}], "url": "https://capawesome.io/docs/sdks/capacitor/firebase/performance-monitoring/"}
```
