npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rawdash/connector-firebase-analytics

v0.27.0

Published

Rawdash connector for Firebase Analytics - syncs DAU/WAU/MAU, per-event volume, and cohort retention from the GA4 Data API into the six-shape storage model

Readme

@rawdash/connector-firebase-analytics

npm version license

Sync DAU/WAU/MAU, per-event activity, and cohort retention from a Firebase project via the GA4 Data API.

Install

npm install @rawdash/connector-firebase-analytics

Authentication

Firebase Analytics data is exposed through the linked GA4 property. Authenticate against the GA4 Data API with either a Google service account JSON key (recommended) or an OAuth 2.0 refresh-token tuple. The identity must have at least the Analytics Viewer role on the property.

  1. In Firebase Console -> Project settings -> Integrations -> Google Analytics, note the linked GA4 property and copy its numeric Property ID from Google Analytics -> Admin -> Property settings.
  2. In Firebase Console -> Project settings -> General -> Your apps, copy the Firebase App ID for the app whose analytics you want to sync.
  3. Recommended: create a service account at Google Cloud -> IAM & Admin -> Service Accounts, generate a JSON key, and grant it the Analytics Viewer role on the GA4 property. Store the JSON as a secret and reference it as serviceAccountJson: secret("FIREBASE_ANALYTICS_SA_JSON").
  4. Alternative: provide an OAuth 2.0 refresh token with the analytics.readonly scope together with its clientId and clientSecret from the Google Cloud Console.

Configuration

| Field | Type | Required | Description | | -------------------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | propertyId | string | Yes | Numeric ID of the GA4 property linked to your Firebase project (e.g. 123456789). Find it in Google Analytics -> Admin -> Property settings. | | firebaseAppId | string | Yes | Firebase App ID for the app whose analytics you are syncing (e.g. 1:1234567890:web:abcdef). Find it in Firebase Console -> Project settings -> General -> Your apps. Used to label samples with the source app. | | serviceAccountJson | secret | No | Contents of the JSON key file for a Google service account with the Firebase Viewer + Analytics Viewer roles. Create one at Google Cloud -> IAM & Admin -> Service Accounts. | | refreshToken | secret | No | Google OAuth 2.0 refresh token with the analytics.readonly scope. Required if not using serviceAccountJson. | | clientId | string | No | OAuth 2.0 client ID from Google Cloud Console. Required when using refreshToken auth. | | clientSecret | secret | No | OAuth 2.0 client secret from Google Cloud Console. Required when using refreshToken auth. | | lookbackDays | number | No | How many calendar days to fetch on a full sync. Defaults to 90. |

Resources

  • firebase_dau_wau_mau (metric) - Daily active, weekly active, and monthly active user counts for the linked GA4 property.
    • Endpoint: POST /v1beta/properties/{propertyId}:runReport
    • Unit: users
    • Granularity: day
    • Dimensions: date
  • firebase_events_per_day (metric) - Daily event counts and the active users that triggered them, bucketed by event name.
    • Endpoint: POST /v1beta/properties/{propertyId}:runReport
    • Unit: events
    • Granularity: day
    • Dimensions: date, eventName
  • firebase_retention (metric) - Active users on each day grouped by the date of their first session (cohort retention).
    • Endpoint: POST /v1beta/properties/{propertyId}:runReport
    • Unit: users
    • Granularity: day
    • Dimensions: firstSessionDate, date
    • Each sample also carries a period attribute equal to (date - firstSessionDate) in days, so retention curves can be built by grouping on it.

Example

import {
  defineConfig,
  defineDashboard,
  defineMetric,
  secret,
} from '@rawdash/core';

const firebaseAnalytics = {
  name: 'firebaseAnalytics',
  connectorId: 'firebase-analytics',
  config: {
    propertyId: '123456789',
    firebaseAppId: '1:1234567890:web:abcdef1234567890',
    serviceAccountJson: secret('FIREBASE_ANALYTICS_SA_JSON'),
    lookbackDays: 90,
  },
};

export default defineConfig({
  connectors: [firebaseAnalytics],
  dashboards: {
    engagement: defineDashboard({
      widgets: {
        dau: {
          kind: 'timeseries',
          title: 'Daily active users',
          window: '30d',
          metric: defineMetric({
            connector: firebaseAnalytics,
            shape: 'metric',
            name: 'firebase_dau_wau_mau',
            fn: 'sum',
          }),
        },
      },
    }),
  },
});

Rate limits

GA4 Data API quota is 200,000 tokens/day per property (default); 429 responses are retried automatically with exponential backoff.

Limitations

  • Incremental syncs use a 30-day window because GA4 can attribute events up to 3 days after they occur.
  • Report pagination is 10,000 rows per page.
  • The firebaseAppId is recorded on every sample but does not filter the report; ensure your GA4 property only contains the app you intend to sync.

Links

License

Apache-2.0