---
description: Unofficial Capacitor plugin for Firebase Analytics SDK to track user interactions and events in your app.
title: Capacitor Firebase Analytics Plugin for Android, iOS & Web - Capawesome
image: https://capawesome.io/docs/assets/images/social/plugins/firebase/analytics.png
---

[ Skip to content](#capacitor-firebaseanalytics) 

[ 🎉 Introducing **Capawesome Platform** — one platform for Live Updates, Native Builds, App Store Publishing, and Insider SDKs.](https://capawesome.io) 

* [  iOS ](#ios)
* [  Configuration ](#configuration)
* [  Demo ](#demo)
* [  Usage ](#usage)
* [  API ](#api)
* [  Enums ](#enums)
* [  Test your implementation ](#test-your-implementation)
* [  Changelog ](#changelog)
* [  License ](#license)
* [  App ](/docs/plugins/firebase/app/)
* [  App Check ](/docs/plugins/firebase/app-check/)
* [  Authentication ](/docs/plugins/firebase/authentication/)
* [  Crashlytics ](/docs/plugins/firebase/crashlytics/)
* [  Cloud Firestore ](/docs/plugins/firebase/cloud-firestore/)
* [  Cloud Functions ](/docs/plugins/firebase/cloud-functions/)
* [  Cloud Messaging ](/docs/plugins/firebase/cloud-messaging/)
* [  Cloud Storage ](/docs/plugins/firebase/cloud-storage/)
* [  Performance Monitoring ](/docs/plugins/firebase/performance-monitoring/)
* [  Remote Config ](/docs/plugins/firebase/remote-config/)
* [  Formbricks ](/docs/plugins/formbricks/)
* [  Geocoder ](/docs/plugins/geocoder/)
* [  Google Sign-In ](/docs/plugins/google-sign-in/)
* [  libSQL ](/docs/plugins/libsql/)
* [  Live Update ](/docs/plugins/live-update/)
* [  Managed Configurations ](/docs/plugins/managed-configurations/)
* [  Media Session ](/docs/plugins/media-session/)
* [  ML Kit ](/docs/plugins/mlkit/)
* [  NFC ](/docs/plugins/nfc/)
* [  OAuth ](/docs/plugins/oauth/)
* [  Pedometer ](/docs/plugins/pedometer/)
* [  Photo Editor ](/docs/plugins/photo-editor/)
* [  PostHog ](/docs/plugins/posthog/)
* [  Printer ](/docs/plugins/printer/)
* [  Purchases ](/docs/plugins/purchases/)
* [  RealtimeKit ](/docs/plugins/realtimekit/)
* [  Screen Orientation ](/docs/plugins/screen-orientation/)
* [  Screenshot ](/docs/plugins/screenshot/)
* [  Secure Preferences ](/docs/plugins/secure-preferences/)
* [  Speech Recognition ](/docs/plugins/speech-recognition/)
* [  Speech Synthesis ](/docs/plugins/speech-synthesis/)
* [  Share Target ](/docs/plugins/share-target/)
* [  Square Mobile Payments ](/docs/plugins/square-mobile-payments/)
* [  SQLite ](/docs/plugins/sqlite/)
* [  Superwall ](/docs/plugins/superwall/)
* [  Torch ](/docs/plugins/torch/)
* [  Wifi ](/docs/plugins/wifi/)
* [  Zip ](/docs/plugins/zip/)
* [  Cloud ](/docs/cloud/)
* [  Live Updates ](/docs/cloud/live-updates/)
* Advanced
* Integrations
* [  Native Builds ](/docs/cloud/native-builds/)
* [  Configuration ](/docs/cloud/native-builds/configuration/)
* [  Environments ](/docs/cloud/native-builds/environments/)
* Guides
* [  Sample Projects ](/docs/cloud/native-builds/sample-projects/)
* [  Troubleshooting ](/docs/cloud/native-builds/troubleshooting/)
* [  Automations ](/docs/cloud/automations/)
* [  Assist ](/docs/cloud/assist/)
* Account
* Organizations
* [  Organization and User Management ](/docs/cloud/organizations/memberships/)
* [  Single Sign-On (SSO) ](/docs/cloud/organizations/sso/)
* [  Teams ](/docs/cloud/organizations/teams/)
* [  Two-Factor Authentication ](/docs/cloud/organizations/two-factor-authentication/)
* [  Integrations ](/docs/cloud/integrations/)
* [  License Keys ](/docs/cloud/license-keys/)
* [  Webhooks ](/docs/cloud/webhooks/)
* [  Pricing ](https://capawesome.io/pricing/)
* [  FAQ ](/docs/cloud/faq/)
* [  Support ](/docs/cloud/support/)
* [  Contributing ](/docs/contributing/)
* [  LLMs ](/docs/llms/)
* [  Insiders ](/docs/insiders/)
* [  License ](https://capawesome.io/legal/eula/)
* [  Support ](/docs/insiders/support/)
* [  FAQ ](/docs/insiders/faq/)
* [  Blog ](/blog/)
* Categories

* [  iOS ](#ios)
* [  Configuration ](#configuration)
* [  Demo ](#demo)
* [  Usage ](#usage)
* [  API ](#api)
* [  Enums ](#enums)
* [  Test your implementation ](#test-your-implementation)
* [  Changelog ](#changelog)
* [  License ](#license)

# @capacitor-firebase/analytics[¶](#capacitor-firebaseanalytics "Permanent link")

Unofficial Capacitor plugin for [Firebase Analytics](https://firebase.google.com/docs/analytics).[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/) 

## 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/).

## 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/analytics` 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/analytics 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")

#### Disable Analytics data collection[¶](#disable-analytics-data-collection "Permanent link")

See [Disable Analytics data collection](https://firebase.google.com/docs/analytics/configure-data-collection?platform=android#disable%5Fdata%5Fcollection) if you want to disable Analytics data collection.

#### Disable Advertising ID collection[¶](#disable-advertising-id-collection "Permanent link")

See [Disable Advertising ID collection](https://firebase.google.com/docs/analytics/configure-data-collection?platform=android#disable%5Fadvertising%5Fid%5Fcollection) if you want to disable Advertising ID collection.

#### 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:

* `$firebaseAnalyticsVersion` version of `com.google.firebase:firebase-analytics` (default: `23.0.0`)

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

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

If you are using **CocoaPods** for your iOS project, you need to add the `CapacitorFirebaseAnalytics/Analytics` pod to your `Podfile` (usually `ios/App/Podfile`):

`[](#%5F%5Fcodelineno-3-1)target 'App' do
[](#%5F%5Fcodelineno-3-2)capacitor_pods
[](#%5F%5Fcodelineno-3-3)# Add your Pods here
[](#%5F%5Fcodelineno-3-4)+  pod 'CapacitorFirebaseAnalytics/Analytics', :path => '../../node_modules/@capacitor-firebase/analytics'
[](#%5F%5Fcodelineno-3-5)end
`

**Attention**: Do not add the pod in the section `def capacitor_pods`, but under the comment `# Add your Pods here` ([example](https://github.com/robingenz/capacitor-firebase-plugin-demo/blob/e1684a0af6871442ed0a87dceeeba6fd9ce0185d/ios/App/Podfile#L30)).

#### Disable Analytics data collection[¶](#disable-analytics-data-collection%5F1 "Permanent link")

See [Disable Analytics data collection](https://firebase.google.com/docs/analytics/configure-data-collection?platform=ios#disable%5Fdata%5Fcollection) if you want to disable Analytics data collection.

#### Disable IDFA collection[¶](#disable-idfa-collection "Permanent link")

If you are using **CocoaPods** for your iOS project and you want to disable IDFA collection, you can use the `CapacitorFirebaseAnalytics/AnalyticsWithoutAdIdSupport` pod instead of the `CapacitorFirebaseAnalytics/Analytics` pod:

`[](#%5F%5Fcodelineno-4-1)target 'App' do
[](#%5F%5Fcodelineno-4-2)capacitor_pods
[](#%5F%5Fcodelineno-4-3)# Add your Pods here
[](#%5F%5Fcodelineno-4-4)-  pod 'CapacitorFirebaseAnalytics/Analytics', :path => '../../node_modules/@capacitor-firebase/analytics'
[](#%5F%5Fcodelineno-4-5)+  pod 'CapacitorFirebaseAnalytics/AnalyticsWithoutAdIdSupport', :path => '../../node_modules/@capacitor-firebase/analytics'
[](#%5F%5Fcodelineno-4-6)end
`

If you are using **Swift Package Manager** for your iOS project and you want to disable IDFA collection, you can enable the `AnalyticsWithoutAdIdSupport` trait in your `capacitor.config.json` (or `capacitor.config.ts`):

`[](#%5F%5Fcodelineno-5-1){
[](#%5F%5Fcodelineno-5-2)  "experimental": {
[](#%5F%5Fcodelineno-5-3)    "ios": {
[](#%5F%5Fcodelineno-5-4)      "spm": {
[](#%5F%5Fcodelineno-5-5)        "swiftToolsVersion": "6.1",
[](#%5F%5Fcodelineno-5-6)        "packageTraits": {
[](#%5F%5Fcodelineno-5-7)          "@capacitor-firebase/analytics": ["AnalyticsWithoutAdIdSupport"]
[](#%5F%5Fcodelineno-5-8)        }
[](#%5F%5Fcodelineno-5-9)      }
[](#%5F%5Fcodelineno-5-10)    }
[](#%5F%5Fcodelineno-5-11)  }
[](#%5F%5Fcodelineno-5-12)}
`

**Note**: SPM trait support requires Capacitor CLI **8.3.0+** and Xcode **16.3+** (Swift 6.1+).

## 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")

`[](#%5F%5Fcodelineno-6-1)import { FirebaseAnalytics } from '@capacitor-firebase/analytics';
[](#%5F%5Fcodelineno-6-2)
[](#%5F%5Fcodelineno-6-3)const setUserId = async () => {
[](#%5F%5Fcodelineno-6-4)  await FirebaseAnalytics.setUserId({
[](#%5F%5Fcodelineno-6-5)    userId: '123',
[](#%5F%5Fcodelineno-6-6)  });
[](#%5F%5Fcodelineno-6-7)};
[](#%5F%5Fcodelineno-6-8)
[](#%5F%5Fcodelineno-6-9)const setUserProperty = async () => {
[](#%5F%5Fcodelineno-6-10)  await FirebaseAnalytics.setUserProperty({
[](#%5F%5Fcodelineno-6-11)    key: 'language',
[](#%5F%5Fcodelineno-6-12)    value: 'en',
[](#%5F%5Fcodelineno-6-13)  });
[](#%5F%5Fcodelineno-6-14)};
[](#%5F%5Fcodelineno-6-15)
[](#%5F%5Fcodelineno-6-16)const setCurrentScreen = async () => {
[](#%5F%5Fcodelineno-6-17)  await FirebaseAnalytics.setCurrentScreen({
[](#%5F%5Fcodelineno-6-18)    screenName: 'Login',
[](#%5F%5Fcodelineno-6-19)    screenClassOverride: 'LoginPage',
[](#%5F%5Fcodelineno-6-20)  });
[](#%5F%5Fcodelineno-6-21)};
[](#%5F%5Fcodelineno-6-22)
[](#%5F%5Fcodelineno-6-23)const logEvent = async () => {
[](#%5F%5Fcodelineno-6-24)  await FirebaseAnalytics.logEvent({
[](#%5F%5Fcodelineno-6-25)    name: 'sign_up',
[](#%5F%5Fcodelineno-6-26)    params: { method: 'password' },
[](#%5F%5Fcodelineno-6-27)  });
[](#%5F%5Fcodelineno-6-28)};
[](#%5F%5Fcodelineno-6-29)
[](#%5F%5Fcodelineno-6-30)const setSessionTimeoutDuration = async () => {
[](#%5F%5Fcodelineno-6-31)  await FirebaseAnalytics.setSessionTimeoutDuration({
[](#%5F%5Fcodelineno-6-32)    duration: '120',
[](#%5F%5Fcodelineno-6-33)  });
[](#%5F%5Fcodelineno-6-34)};
[](#%5F%5Fcodelineno-6-35)
[](#%5F%5Fcodelineno-6-36)const setEnabled = async () => {
[](#%5F%5Fcodelineno-6-37)  await FirebaseAnalytics.setEnabled({
[](#%5F%5Fcodelineno-6-38)    enabled: true,
[](#%5F%5Fcodelineno-6-39)  });
[](#%5F%5Fcodelineno-6-40)};
[](#%5F%5Fcodelineno-6-41)
[](#%5F%5Fcodelineno-6-42)const isEnabled = async () => {
[](#%5F%5Fcodelineno-6-43)  const { enabled } = await FirebaseAnalytics.isEnabled();
[](#%5F%5Fcodelineno-6-44)  return enabled;
[](#%5F%5Fcodelineno-6-45)};
[](#%5F%5Fcodelineno-6-46)
[](#%5F%5Fcodelineno-6-47)const resetAnalyticsData = async () => {
[](#%5F%5Fcodelineno-6-48)  await FirebaseAnalytics.resetAnalyticsData();
[](#%5F%5Fcodelineno-6-49)};
[](#%5F%5Fcodelineno-6-50)
[](#%5F%5Fcodelineno-6-51)const initiateOnDeviceConversionMeasurementWithEmailAddress = async () => {
[](#%5F%5Fcodelineno-6-52)  await FirebaseAnalytics.initiateOnDeviceConversionMeasurementWithEmailAddress({
[](#%5F%5Fcodelineno-6-53)    emailAddress: 'mail@example.com',
[](#%5F%5Fcodelineno-6-54)  });
[](#%5F%5Fcodelineno-6-55)};
[](#%5F%5Fcodelineno-6-56)
[](#%5F%5Fcodelineno-6-57)const initiateOnDeviceConversionMeasurementWithPhoneNumber = async () => {
[](#%5F%5Fcodelineno-6-58)  await FirebaseAnalytics.initiateOnDeviceConversionMeasurementWithPhoneNumber({
[](#%5F%5Fcodelineno-6-59)    phoneNumber: '+49123456789',
[](#%5F%5Fcodelineno-6-60)  });
[](#%5F%5Fcodelineno-6-61)};
[](#%5F%5Fcodelineno-6-62)
[](#%5F%5Fcodelineno-6-63)const initiateOnDeviceConversionMeasurementWithHashedEmailAddress = async () => {
[](#%5F%5Fcodelineno-6-64)  await FirebaseAnalytics.initiateOnDeviceConversionMeasurementWithHashedEmailAddress({
[](#%5F%5Fcodelineno-6-65)    emailAddressToHash: 'mail@example.com',
[](#%5F%5Fcodelineno-6-66)  });
[](#%5F%5Fcodelineno-6-67)};
[](#%5F%5Fcodelineno-6-68)
[](#%5F%5Fcodelineno-6-69)const initiateOnDeviceConversionMeasurementWithHashedPhoneNumber = async () => {
[](#%5F%5Fcodelineno-6-70)  await FirebaseAnalytics.initiateOnDeviceConversionMeasurementWithHashedPhoneNumber({
[](#%5F%5Fcodelineno-6-71)    phoneNumberToHash: '+49123456789',
[](#%5F%5Fcodelineno-6-72)  });
[](#%5F%5Fcodelineno-6-73)};
`

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

* [getAppInstanceId()](#getappinstanceid)
* [setConsent(...)](#setconsent)
* [setUserId(...)](#setuserid)
* [setUserProperty(...)](#setuserproperty)
* [setCurrentScreen(...)](#setcurrentscreen)
* [logEvent(...)](#logevent)
* [setSessionTimeoutDuration(...)](#setsessiontimeoutduration)
* [setEnabled(...)](#setenabled)
* [isEnabled()](#isenabled)
* [resetAnalyticsData()](#resetanalyticsdata)
* [logTransaction(...)](#logtransaction)
* [initiateOnDeviceConversionMeasurementWithEmailAddress(...)](#initiateondeviceconversionmeasurementwithemailaddress)
* [initiateOnDeviceConversionMeasurementWithPhoneNumber(...)](#initiateondeviceconversionmeasurementwithphonenumber)
* [initiateOnDeviceConversionMeasurementWithHashedEmailAddress(...)](#initiateondeviceconversionmeasurementwithhashedemailaddress)
* [initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(...)](#initiateondeviceconversionmeasurementwithhashedphonenumber)
* [Interfaces](#interfaces)
* [Enums](#enums)

### getAppInstanceId()[¶](#getappinstanceid "Permanent link")

`[](#%5F%5Fcodelineno-7-1)getAppInstanceId() => Promise<GetAppInstanceIdResult>
`

Retrieves the app instance id.

Only available for Android and iOS.

**Returns:** `Promise<[GetAppInstanceIdResult](#getappinstanceidresult)>`

**Since:** 1.4.0

---

### setConsent(...)[¶](#setconsent "Permanent link")

`[](#%5F%5Fcodelineno-8-1)setConsent(options: SetConsentOptions) => Promise<void>
`

Sets the user's consent mode.

| Param       | Type                                    |
| ----------- | --------------------------------------- |
| **options** | [SetConsentOptions](#setconsentoptions) |

**Since:** 6.0.0

---

### setUserId(...)[¶](#setuserid "Permanent link")

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

Sets the user ID property.

| Param       | Type                                  |
| ----------- | ------------------------------------- |
| **options** | [SetUserIdOptions](#setuseridoptions) |

**Since:** 0.1.0

---

### setUserProperty(...)[¶](#setuserproperty "Permanent link")

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

Sets a custom user property to a given value.

| Param       | Type                                              |
| ----------- | ------------------------------------------------- |
| **options** | [SetUserPropertyOptions](#setuserpropertyoptions) |

**Since:** 0.1.0

---

### setCurrentScreen(...)[¶](#setcurrentscreen "Permanent link")

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

Sets the current screen name.

| Param       | Type                                                |
| ----------- | --------------------------------------------------- |
| **options** | [SetCurrentScreenOptions](#setcurrentscreenoptions) |

**Since:** 0.1.0

---

### logEvent(...)[¶](#logevent "Permanent link")

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

Logs an app event.

| Param       | Type                                |
| ----------- | ----------------------------------- |
| **options** | [LogEventOptions](#logeventoptions) |

**Since:** 0.1.0

---

### setSessionTimeoutDuration(...)[¶](#setsessiontimeoutduration "Permanent link")

`[](#%5F%5Fcodelineno-13-1)setSessionTimeoutDuration(options: SetSessionTimeoutDurationOptions) => Promise<void>
`

Sets the duration of inactivity that terminates the current session.

Only available for Android and iOS.

| Param       | Type                                                                  |
| ----------- | --------------------------------------------------------------------- |
| **options** | [SetSessionTimeoutDurationOptions](#setsessiontimeoutdurationoptions) |

**Since:** 0.1.0

---

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

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

Enables/disables automatic data collection. The value does not apply until the next run of the app.

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

**Since:** 0.1.0

---

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

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

Returns whether or not automatic data collection is enabled.

Only available for Web.

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

**Since:** 0.1.0

---

### resetAnalyticsData()[¶](#resetanalyticsdata "Permanent link")

`[](#%5F%5Fcodelineno-16-1)resetAnalyticsData() => Promise<void>
`

Clears all analytics data for this app from the device. Resets the app instance id.

Only available for Android and iOS.

**Since:** 0.1.0

---

### logTransaction(...)[¶](#logtransaction "Permanent link")

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

Logs a StoreKit 2 transaction.

Only available for iOS (15.0+).

| Param       | Type                                            |
| ----------- | ----------------------------------------------- |
| **options** | [LogTransactionOptions](#logtransactionoptions) |

**Since:** 8.2.0

---

### initiateOnDeviceConversionMeasurementWithEmailAddress(...)[¶](#initiateondeviceconversionmeasurementwithemailaddress "Permanent link")

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

Initiates on-device conversion measurement with an email address.

Only available for iOS.

| Param       | Type                                                                                                                          |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **options** | [InitiateOnDeviceConversionMeasurementWithEmailAddressOptions](#initiateondeviceconversionmeasurementwithemailaddressoptions) |

**Since:** 7.2.0

---

### initiateOnDeviceConversionMeasurementWithPhoneNumber(...)[¶](#initiateondeviceconversionmeasurementwithphonenumber "Permanent link")

`[](#%5F%5Fcodelineno-19-1)initiateOnDeviceConversionMeasurementWithPhoneNumber(options: InitiateOnDeviceConversionMeasurementWithPhoneNumberOptions) => Promise<void>
`

Initiates on-device conversion measurement with a phone number.

Only available for iOS.

| Param       | Type                                                                                                                        |
| ----------- | --------------------------------------------------------------------------------------------------------------------------- |
| **options** | [InitiateOnDeviceConversionMeasurementWithPhoneNumberOptions](#initiateondeviceconversionmeasurementwithphonenumberoptions) |

**Since:** 7.2.0

---

### initiateOnDeviceConversionMeasurementWithHashedEmailAddress(...)[¶](#initiateondeviceconversionmeasurementwithhashedemailaddress "Permanent link")

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

Initiates on-device conversion measurement with a hashed email address.

Only available for iOS.

| Param       | Type                                                                                                                                      |
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **options** | [InitiateOnDeviceConversionMeasurementWithHashedEmailAddressOptions](#initiateondeviceconversionmeasurementwithhashedemailaddressoptions) |

**Since:** 7.2.0

---

### initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(...)[¶](#initiateondeviceconversionmeasurementwithhashedphonenumber "Permanent link")

`[](#%5F%5Fcodelineno-21-1)initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(options: InitiateOnDeviceConversionMeasurementWithHashedPhoneNumberOptions) => Promise<void>
`

Initiates on-device conversion measurement with a hashed phone number.

Only available for iOS.

| Param       | Type                                                                                                                                    |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| **options** | [InitiateOnDeviceConversionMeasurementWithHashedPhoneNumberOptions](#initiateondeviceconversionmeasurementwithhashedphonenumberoptions) |

**Since:** 7.2.0

---

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

#### GetAppInstanceIdResult[¶](#getappinstanceidresult "Permanent link")

| Prop              | Type   | Description                                                                                                                                                                                          | Since |
| ----------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **appInstanceId** | string | The app instance id. Not defined if FirebaseAnalytics.<a href="#consenttype">ConsentType</a>.ANALYTICS\_STORAGE has been set to FirebaseAnalytics.<a href="#consentstatus">ConsentStatus</a>.DENIED. | 1.4.0 |

#### SetConsentOptions[¶](#setconsentoptions "Permanent link")

| Prop       | Type                            | Description         | Since |
| ---------- | ------------------------------- | ------------------- | ----- |
| **type**   | [ConsentType](#consenttype)     | The consent type.   | 6.0.0 |
| **status** | [ConsentStatus](#consentstatus) | The consent status. | 6.0.0 |

#### SetUserIdOptions[¶](#setuseridoptions "Permanent link")

| Prop       | Type           | Since |
| ---------- | -------------- | ----- |
| **userId** | string \| null | 0.1.0 |

#### SetUserPropertyOptions[¶](#setuserpropertyoptions "Permanent link")

| Prop      | Type           | Since |
| --------- | -------------- | ----- |
| **key**   | string         | 0.1.0 |
| **value** | string \| null | 0.1.0 |

#### SetCurrentScreenOptions[¶](#setcurrentscreenoptions "Permanent link")

| Prop                    | Type           | Description                         | Default | Since |
| ----------------------- | -------------- | ----------------------------------- | ------- | ----- |
| **screenName**          | string \| null | 0.1.0                               |         |       |
| **screenClassOverride** | string \| null | Only available for Android and iOS. | null    | 0.1.0 |

#### LogEventOptions[¶](#logeventoptions "Permanent link")

| Prop       | Type                      | Description                | Since |
| ---------- | ------------------------- | -------------------------- | ----- |
| **name**   | string                    | The event name.            | 0.1.0 |
| **params** | { \[key: string\]: any; } | The optional event params. | 0.1.0 |

#### SetSessionTimeoutDurationOptions[¶](#setsessiontimeoutdurationoptions "Permanent link")

| Prop         | Type   | Description          | Default | Since |
| ------------ | ------ | -------------------- | ------- | ----- |
| **duration** | number | Duration in seconds. | 1800    | 0.1.0 |

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

| Prop        | Type    | Since |
| ----------- | ------- | ----- |
| **enabled** | boolean | 0.1.0 |

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

| Prop        | Type    | Since |
| ----------- | ------- | ----- |
| **enabled** | boolean | 0.1.0 |

#### LogTransactionOptions[¶](#logtransactionoptions "Permanent link")

| Prop              | Type   | Description                                              | Since |
| ----------------- | ------ | -------------------------------------------------------- | ----- |
| **transactionId** | string | The StoreKit 2 Transaction.id value as a numeric string. | 8.2.0 |

#### InitiateOnDeviceConversionMeasurementWithEmailAddressOptions[¶](#initiateondeviceconversionmeasurementwithemailaddressoptions "Permanent link")

| Prop             | Type   | Description                                                          | Since |
| ---------------- | ------ | -------------------------------------------------------------------- | ----- |
| **emailAddress** | string | The email address to initiate on-device conversion measurement with. | 7.2.0 |

#### InitiateOnDeviceConversionMeasurementWithPhoneNumberOptions[¶](#initiateondeviceconversionmeasurementwithphonenumberoptions "Permanent link")

| Prop            | Type   | Description                                                         | Since |
| --------------- | ------ | ------------------------------------------------------------------- | ----- |
| **phoneNumber** | string | The phone number to initiate on-device conversion measurement with. | 7.2.0 |

#### InitiateOnDeviceConversionMeasurementWithHashedEmailAddressOptions[¶](#initiateondeviceconversionmeasurementwithhashedemailaddressoptions "Permanent link")

| Prop                   | Type   | Description                                                          | Since |
| ---------------------- | ------ | -------------------------------------------------------------------- | ----- |
| **emailAddressToHash** | string | The email address to initiate on-device conversion measurement with. | 7.2.0 |

#### InitiateOnDeviceConversionMeasurementWithHashedPhoneNumberOptions[¶](#initiateondeviceconversionmeasurementwithhashedphonenumberoptions "Permanent link")

| Prop                  | Type   | Description                                                         | Since |
| --------------------- | ------ | ------------------------------------------------------------------- | ----- |
| **phoneNumberToHash** | string | The phone number to initiate on-device conversion measurement with. | 7.2.0 |

### Enums[¶](#enums "Permanent link")

#### ConsentType[¶](#consenttype "Permanent link")

| Members                    | Value                      | Since |
| -------------------------- | -------------------------- | ----- |
| **AdPersonalization**      | 'AD\_PERSONALIZATION'      | 6.0.0 |
| **AdStorage**              | 'AD\_STORAGE'              | 6.0.0 |
| **AdUserData**             | 'AD\_USER\_DATA'           | 6.0.0 |
| **AnalyticsStorage**       | 'ANALYTICS\_STORAGE'       | 6.0.0 |
| **FunctionalityStorage**   | 'FUNCTIONALITY\_STORAGE'   | 6.0.0 |
| **PersonalizationStorage** | 'PERSONALIZATION\_STORAGE' | 6.0.0 |

#### ConsentStatus[¶](#consentstatus "Permanent link")

| Members     | Value     | Since |
| ----------- | --------- | ----- |
| **Granted** | 'GRANTED' | 6.0.0 |
| **Denied**  | 'DENIED'  | 6.0.0 |

## Test your implementation[¶](#test-your-implementation "Permanent link")

[Here](https://firebase.google.com/docs/analytics/debugview) you can find more information on how to test the Firebase Analytics implementation using the **DebugView**.

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

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

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

See [LICENSE](https://github.com/capawesome-team/capacitor-firebase/blob/main/packages/analytics/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")

May 17, 2026 

 Back to top 