firebase-analytics
Skill0 starsChanged 5 months agoMITView on GitHub
Sets up Firebase Analytics (Google Analytics for Firebase) on web and Expo / React Native — installing, logging custom events, setting user properties, debugging in real time, integrating with BigQuery for raw events, and respecting iOS ATT consent. Use whenever the user wants to track product usage, funnels, or user demographics.
- Installs packages
2 other projects use a version of this.
Adopted by
Most recently taken up by
- firebase/agent-skillstheir own version, first seen Nov 8, 2026
- evanca/flutter-ai-rulestheir own version, first seen Aug 24, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- evanca/flutter-ai-rules★ 669same name
- firebase/agent-skills★ 506same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository15 other files it gives its agents.
- firebase-ai-logicSkill
- firebase-app-checkSkill
- firebase-architectureSkill
- firebase-authSkill
- firebase-cloud-functionsSkill
- firebase-cost-optimizationSkill
- firebase-crashlyticsSkill
- firebase-emulatorsSkill
- firebase-expoSkill
- firebase-firestoreSkill
- firebase-hostingSkill
- firebase-messagingSkill
- firebase-realtime-databaseSkill
- firebase-remote-configSkill
- firebase-storageSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 153
Privacy: never set personally identifiable strings as user properties (email, name, phone).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Firebase Analytics
Minimum viable example
import analytics from "@react-native-firebase/analytics";
await analytics().logEvent("post_created", { category: "blog", word_count: 450 });
await analytics().setUserProperty("tier", "pro");Event names: lowercase_snake_case, ≤ 40 chars, ≤ 25 params per event. Violations are silently dropped — verify with DebugView before shipping.
1. Install
Web
npm install firebaseimport { getAnalytics, isSupported } from "firebase/analytics";
let analytics: ReturnType<typeof getAnalytics> | null = null;
isSupported().then((ok) => {
if (ok) analytics = getAnalytics(app);
});isSupported() is required for SSR (Next.js) — getAnalytics throws in non-browser environments.
Expo / React Native
npx expo install @react-native-firebase/analyticsAdd to app.json:
{
"expo": {
"plugins": ["@react-native-firebase/app", "@react-native-firebase/analytics"]
}
}Rebuild (npx expo prebuild --clean + EAS Build).
2. iOS App Tracking Transparency (ATT)
For any IDFA-based analytics (cross-app tracking, ad attribution), iOS 14.5+ requires explicit user consent via the ATT prompt. Without it, IDFA is zeroed out and ad measurement breaks.
npx expo install expo-tracking-transparencyapp.json:
{
"expo": {
"ios": {
"infoPlist": {
"NSUserTrackingUsageDescription": "We use this to measure ad performance and personalize content."
}
}
}
}import { requestTrackingPermissionsAsync } from "expo-tracking-transparency";
const { status } = await requestTrackingPermissionsAsync();
// status is "granted" | "denied" | "restricted" | "undetermined"Firebase Analytics still works without ATT for first-party events and aggregate metrics — only IDFA-linked features (Audiences for ads, attribution) are affected.
If shipping in the EEA, UK, or Switzerland, you also need Google Consent Mode v2 — see references/consent-mode.md. Without it, Google blocks all data from those regions.
3. Log events
import analytics from "@react-native-firebase/analytics";
await analytics().logEvent("post_created", {
category: "blog",
word_count: 450,
});Reserved events (screen_view, login, sign_up, purchase, search, etc.) get richer reporting — use them when applicable:
await analytics().logLogin({ method: "google" });
await analytics().logSignUp({ method: "email" });
await analytics().logPurchase({
currency: "USD",
value: 9.99,
items: [{ item_id: "pro_monthly", item_name: "Pro Monthly", price: 9.99 }],
});Event naming rules
- Lowercase snake_case
- ≤ 40 characters
- ≤ 25 parameters per event
- Parameter names ≤ 40 chars, values ≤ 100 chars (string) or
number
Events that violate these rules are silently dropped. Test in DebugView (next section).
4. Real-time debugging (DebugView)
The Analytics dashboard has a 24h delay. For development, use DebugView for real-time event verification:
# iOS Simulator
xcrun simctl spawn booted log stream --predicate 'subsystem == "com.google.firebase.analytics"'
# Or enable persistently:
adb shell setprop debug.firebase.analytics.app <your.package.name>For iOS, in Xcode → Edit Scheme → Run → Arguments → add -FIRDebugEnabled to "Arguments Passed On Launch".
Open Firebase Console → Analytics → DebugView → your device appears, events stream in seconds.
5. User properties and IDs
await analytics().setUserId(user.uid);
await analytics().setUserProperty("tier", "pro");
await analytics().setUserProperty("signup_source", "google");User properties are usable as Audiences for Remote Config targeting and Firebase Messaging campaigns. They're also dimensions in BigQuery exports.
Privacy: never set personally identifiable strings as user properties (email, name, phone). Use anonymous IDs only. The userId accepts an opaque string — your Firebase Auth uid is fine.
6. Screen tracking (React Navigation)
import analytics from "@react-native-firebase/analytics";
import { useRef } from "react";
import { NavigationContainer } from "@react-navigation/native";
const navigationRef = useRef<NavigationContainerRef<any>>(null);
const routeNameRef = useRef<string>();
<NavigationContainer
ref={navigationRef}
onReady={() => { routeNameRef.current = navigationRef.current?.getCurrentRoute()?.name; }}
onStateChange={async () => {
const previous = routeNameRef.current;
const current = navigationRef.current?.getCurrentRoute()?.name;
if (previous !== current) {
await analytics().logScreenView({ screen_name: current, screen_class: current });
}
routeNameRef.current = current;
}}
>For Expo Router, hook into the useSegments() change instead.
7. BigQuery export
For raw event analysis beyond what the console offers, enable BigQuery export:
Firebase Console → Project Settings → Integrations → BigQuery → Link.
Events stream to a daily-partitioned table (events_YYYYMMDD) with ~1 hour delay. Pricing: free under 1M events/day; standard BigQuery beyond.
8. Common mistakes
- Calling
getAnalyticsin Next.js withoutisSupported. Throws during SSR. - Expecting events in the dashboard immediately. 24h delay. Use DebugView for verification.
- Naming events in CamelCase or with spaces. Silently rejected.
- Setting PII as user properties. Violates Google's terms and risks account suspension.
- Forgetting to rebuild after adding the plugin.
@react-native-firebase/analyticsrequires native code. - Treating Analytics as a real-time event bus. It's batched. For real-time, write events to Firestore or Pub/Sub.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

