IMPORTANT: In July 2025, we stopped releasing new versions of KTX modules, and we removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the previously released KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.
Important In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.
Important In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.
Important In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead. For details, see the FAQ about this initiative.
[null,null,["Last updated 2025-07-21 UTC."],[],[],null,["# com.google.firebase.analytics.ktx\n=================================\n\nClasses\n-------\n\n|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|\n| [ConsentBuilder](/docs/reference/kotlin/com/google/firebase/analytics/ktx/ConsentBuilder) | **This class is deprecated.** Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration. |\n| [ParametersBuilder](/docs/reference/kotlin/com/google/firebase/analytics/ktx/ParametersBuilder) | **This class is deprecated.** Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration. |\n\nExtension functions summary\n---------------------------\n\n|---------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `inline `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [FirebaseAnalytics](/docs/reference/kotlin/com/google/firebase/analytics/FirebaseAnalytics)`.`~~[logEvent](/docs/reference/kotlin/com/google/firebase/analytics/ktx/package-summary#(com.google.firebase.analytics.FirebaseAnalytics).logEvent(kotlin.String,kotlin.Function1))~~`(name: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, block: `[ParametersBuilder](/docs/reference/kotlin/com/google/firebase/analytics/ktx/ParametersBuilder)`.() `-\u003e` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` **This function is deprecated.** Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration. |\n| `inline `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [FirebaseAnalytics](/docs/reference/kotlin/com/google/firebase/analytics/FirebaseAnalytics)`.`~~[setConsent](/docs/reference/kotlin/com/google/firebase/analytics/ktx/package-summary#(com.google.firebase.analytics.FirebaseAnalytics).setConsent(kotlin.Function1))~~`(crossinline block: `[ConsentBuilder](/docs/reference/kotlin/com/google/firebase/analytics/ktx/ConsentBuilder)`.() `-\u003e` `[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)`)` **This function is deprecated.** Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration. |\n\nExtension properties summary\n----------------------------\n\n|---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [FirebaseAnalytics](/docs/reference/kotlin/com/google/firebase/analytics/FirebaseAnalytics) | [Firebase](/docs/reference/kotlin/com/google/firebase/ktx/Firebase)`.`[analytics](/docs/reference/kotlin/com/google/firebase/analytics/ktx/package-summary#(com.google.firebase.ktx.Firebase).analytics()) Accessing this object for Kotlin apps has changed; see the [migration guide](https://firebase.google.com/docs/android/kotlin-migration). |\n\nExtension functions\n-------------------\n\n### logEvent\n\n```\ninline fun FirebaseAnalytics.[logEvent](/docs/reference/kotlin/com/google/firebase/analytics/ktx/package-summary#(com.google.firebase.analytics.FirebaseAnalytics).logEvent(kotlin.String,kotlin.Function1))(name: String, block: ParametersBuilder.() -\u003e Unit): Unit\n```\n| **This function is deprecated.** \n| Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.\n\nFluent version of [FirebaseAnalytics.logEvent](/docs/reference/kotlin/com/google/firebase/analytics/FirebaseAnalytics#logEvent(kotlin.String,android.os.Bundle)).\n\nExample use: \n\n```kotlin\nFirebase.analytics.logEvent(\"myEvent\") {\n param(Params.VALUE, 3.99)\n param(Params.CURRENCY, \"USD\")\n}\n```\n\n**Important** In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). **If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead** . For details, see the [FAQ about this initiative.](https://firebase.google.com/docs/android/kotlin-migration) \n\n### setConsent\n\n```\ninline fun FirebaseAnalytics.[setConsent](/docs/reference/kotlin/com/google/firebase/analytics/ktx/package-summary#(com.google.firebase.analytics.FirebaseAnalytics).setConsent(kotlin.Function1))(crossinline block: ConsentBuilder.() -\u003e Unit): Unit\n```\n| **This function is deprecated.** \n| Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.\n\nFluent version of [FirebaseAnalytics.setConsent](/docs/reference/kotlin/com/google/firebase/analytics/FirebaseAnalytics#setConsent(kotlin.collections.MutableMap)).\n\nExample use: \n\n```kotlin\nFirebase.analytics.setConsent {\n adStorage = ConsentStatus.GRANTED\n analyticsStorage = ConsentStatus.GRANTED\n}\n```\n\n**Important** In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). **If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead** . For details, see the [FAQ about this initiative.](https://firebase.google.com/docs/android/kotlin-migration)\n\nExtension properties\n--------------------\n\n### analytics\n\n```\nval Firebase.analytics: FirebaseAnalytics\n```\n\nAccessing this object for Kotlin apps has changed; see the [migration guide](https://firebase.google.com/docs/android/kotlin-migration).\n\nReturns the [FirebaseAnalytics](/docs/reference/kotlin/com/google/firebase/analytics/FirebaseAnalytics) instance of the default [FirebaseApp](/docs/reference/kotlin/com/google/firebase/FirebaseApp).\n\n**Important** In July 2025, we stopped releasing KTX modules and removed the KTX libraries from the Firebase Android BoM (v34.0.0). **If you use KTX APIs from the KTX modules, we recommend that you migrate your app to use KTX APIs from the main modules instead** . For details, see the [FAQ about this initiative.](https://firebase.google.com/docs/android/kotlin-migration)"]]