Skip to content

Is Firebase Analytics available? #1397

Closed Answered by posva
hytka81 asked this question in Questions and Help
Discussion options

You must be logged in to vote

You don't need anything specific in VueFire for this, initialize it next to your firebaseApp. In Nuxt, you do this in a client-only plugin, this might be added in the future:

import type { FirebaseApp } from 'firebase/app'
import { isSupported, initializeAnalytics } from 'firebase/analytics'
import { defineNuxtPlugin, useAppConfig } from '#app'

/**
 * Plugin to initialize the analytics module.
 * @experimental: NOT YET RELEASED
 */
export default defineNuxtPlugin(async (nuxtApp) => {
  const appConfig = useAppConfig()
  // @ts-expect-error: not implemented yet
  const options = appConfig.vuefireOptions.analytics
  const firebaseApp = nuxtApp.$firebaseApp as FirebaseApp

  if (await isSup…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@posva
Comment options

Answer selected by posva
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants