Firebase Analytics for Your App
This guide walks you through enabling Firebase Analytics in your AI Studio–generated Android app. Once set up, your app automatically tracks screen views, session starts, and custom events — all visible in your Google Analytics 4 console. No technical background is required. The whole process takes about 15–30 minutes.
How It Works
If your app already has Google Login set up, you do not need to upload google-services.json again — AI Studio reuses the same file. Skip directly to Part 2 — Configure Analytics in Settings.
Setting up Firebase Analytics has two or three steps depending on whether your app also uses Google Login:
You do not need Google Sign-In to use Firebase Analytics. If your app has analytics but not Google Login, just follow this guide from the start. If your app has both, the same google-services.json is used for both — no second upload needed.
Part 1 — Set Up Firebase (skip if Google Login is already configured)
Firebase Analytics requires a Firebase project and a google-services.json file.
If your app already has Google Login set up, you already have this — skip to
Part 2.
- Open your app in AI Studio.
- Click the Settings button in the toolbar above the preview (⚙ gear icon).
- Select Analytics in the left menu.
- Under "Step 1 — Register this app in Firebase Console", copy the Android package name (e.g.
com.example.myapp). You'll paste this into Firebase Console.
- Go to console.firebase.google.com.
- Click "Create a project" (or "Add project") and give it a name.
- When asked about Google Analytics, click Enable Google Analytics and connect it to a Google Analytics account (or create one — it's free).
- Once the project is created, click the Android icon (⚙ → Project Settings → scroll to Your apps → Android icon) to add an Android app.
- Paste your Android package name from AI Studio and click Register app.
- Click Next through the remaining screens and then Continue to console.
Unlike Google Login, Firebase Analytics does not require your release keystore SHA-1. You can skip the "SHA certificate fingerprints" section in Firebase Console.
- In Firebase Console, click the gear icon → Project Settings.
- Scroll down to "Your apps" and click on your Android app entry.
- Click google-services.json → Download.
- Save the file — you'll upload it to AI Studio in the next step.
- In AI Studio Settings → Analytics, scroll to "Step 2 — google-services.json".
- Click the file picker and select your
google-services.json. - Click Upload. AI Studio validates the package name matches your app and stores the file.
The package name inside google-services.json must be identical to your app's package name shown in AI Studio Settings. If they don't match, you'll get a "Package name mismatch" error — fix it by re-adding the Android app in Firebase Console with the correct package name, then re-downloading the file.
Part 2 — Configure Analytics in Settings
Once a google-services.json is available (either uploaded in Part 1 or reused from Google Login),
you control analytics behaviour through the toggle in AI Studio Settings → Analytics → Step 3 — Configure.
Toggle Enable Analytics to on. This activates Firebase Analytics in your next build — the SDK will automatically start tracking screen views and session events.
Debug mode sends events to Firebase DebugView in near-real-time, which is useful when testing on a device. Disable it before submitting to the Play Store — in production, DebugView adds unnecessary latency to event delivery.
When you first enable analytics, Debug mode is on so you can verify events are arriving immediately. Remember to turn it off before your production AAB build.
Click Save at the bottom of the page. Your settings are stored and will be applied on the next build.
Part 3 — Build Your Android App
Trigger an Android build — AI Studio automatically injects your google-services.json
and the analytics configuration into the build. No extra steps required.
The in-studio preview is a web build. Firebase Analytics is a native Android SDK and does not fire events in the preview. Events start tracking as soon as the APK or AAB is installed and opened on an Android device.
- In AI Studio, click the Preview button to open the download panel.
- Click "Download APK (For Mobile Testing)" to test, or "Download AAB (Google Play)" for a Play Store submission.
- Install the APK on an Android device and open the app.
- In Firebase Console → Analytics → DebugView, you should see events appearing within seconds (if Debug mode is on).
What Gets Tracked
Automatic events (no code needed)
The Firebase Analytics SDK fires these events automatically on every screen and session:
- › screen_view — fired every time a user navigates to a screen
- › session_start — when a new app session begins
- › first_open — the very first time the app is opened after install
- › app_open — every time the app is brought to the foreground
- › user_engagement — time spent in the app
Standard events added by the agent
When the AI agent builds screens that include login, sign-up, or AI interaction, it automatically adds these events to the relevant screens:
- › sign_up — when a user creates a new account
- › login — when a user signs in (including with Google)
- › logout — when a user signs out
- › ai_message_sent — when a user sends a message to an AI feature
- › ai_response_received — when the AI returns a response
KPI events (app-specific)
The AI agent registers KPI events specific to your app's purpose when it builds your screens.
These appear in the KPI events tracked table in AI Studio Settings → Analytics.
Examples: product_viewed, checkout_started, appointment_booked, etc.
Viewing Your Analytics Data
All events flow into Google Analytics 4 (GA4) via your Firebase project. To view them:
- Go to Firebase Console → select your project.
- In the sidebar, click Analytics → Dashboard for an overview, or Analytics → Events for a full event list.
- For real-time testing: Analytics → DebugView shows events as they fire (requires Debug mode to be on in your build).
- For advanced reports, click "View in Google Analytics" — this opens your GA4 property where you can build custom reports and funnels.
DebugView shows events immediately. Standard Analytics reports and the GA4 dashboard typically show data after a 24–48 hour processing delay. This is normal — plan for it when checking the results of a new build.
Frequently Asked Questions
No. AI Studio reuses the same google-services.json that was uploaded for Google Login. In the Analytics tab → Step 2, you'll see a green banner confirming the file is already available. Just go to Step 3 — Configure, enable analytics, and save.
No. The in-studio preview is a web build — Firebase Analytics is a native Android SDK and does not fire events in web mode. Events are tracked only in the APK or AAB build running on an Android device.
Check these in order: (1) Confirm Enable Analytics is toggled on in AI Studio Settings → Analytics and that you clicked Save before building. (2) Confirm the build was triggered after you saved. (3) Open DebugView in Firebase Console — events should appear within a few seconds if Debug mode is on. (4) If DebugView is empty, confirm the APK was built with Debug mode enabled. Standard event reports have a 24–48 hour delay; use DebugView for immediate verification.
No. Firebase Analytics is completely free with no usage limits. The underlying Google Analytics 4 property is also free. See Firebase Pricing for details.
This is not supported in the current version. Both Google Login and Firebase Analytics use the same google-services.json file, which points to a single Firebase project. Using separate projects would require two files, which is not yet available. For most apps, one Firebase project covering both features is the recommended approach.
Not in the current version. iOS Firebase Analytics requires a GoogleService-Info.plist file and additional iOS configuration. iOS support is on our roadmap and will be added in a future release.