Prompt Primio to Integrate Firebase Analytics (Minimal Setup)

In this post, we’ll walk you through how to prompt Primio to integrate only Firebase Analytics into a Flutter app, using just the JSON config and no extra boilerplate.

Step 1 — Set Up Firebase & Get Your JSON Config

Start by creating the Firebase backend so you have the config values you’ll feed to Primio:

  1. Go to Firebase Console and create a new project (or use an existing one).
  2. Add your Android and/or iOS app to this Firebase project.
  3. As part of that, Firebase provides a google-services.json (for Android) (or equivalent JSON for iOS).
  4. Download that JSON file.
  5. Open it, copy the complete JSON content (you’ll paste it into your Primio prompt).

That JSON is your “source of truth.” Primio will read from it to generate initialization logic — you don’t embed the file itself or use the Gradle plugin in this minimal approach.

Step 2 — Write Your Primio Prompt

This is the exact minimal prompt you paste into Primio. It tells Primio precisely what to do:

Integrate Firebase Analytics only (no google-services.json, no Gradle plugin); add firebase_core + firebase_analytics; in main.dart call WidgetsFlutterBinding.ensureInitialized(); then await Firebase.initializeApp(options: FirebaseOptions(...)) using values from the JSON below; after initialization call FirebaseAnalytics.instance.setAnalyticsCollectionEnabled(true); if initialization fails catch and log error and continue to runApp; create android/app/src/main/res/values/analytics.xml with `<string name="google_app_id">…</string>` (and `<string name="ga_app_id">…</string>` if present); ensure initialization logic covers web + Android + iOS (use kIsWeb or Platform.isAndroid / Platform.isIOS) so Firebase.initializeApp runs on each; nothing else. Use this JSON for config:

=== JSON START ===
[paste google-services.json here]
=== JSON END ===

This prompt:

  • States you want analytics only (no plugin, no extra Firebase features)
  • Directs inclusion of firebase_core + firebase_analytics
  • Instructs Primio to generate initialization using FirebaseOptions with values from the pasted JSON
  • Asks to enable analytics collection
  • Requests creation of analytics.xml containing the google_app_id (and ga_app_id if available)
  • Explicitly restricts anything beyond that (“nothing else”)

Because your JSON is embedded, Primio has all the values it needs to fill out the boilerplate.

Step 3 — Confirm It’s Working

To check that Primio’s output is working as intended, here’s what you do:

  1. Run your app
  2. Trigger some user actions (e.g. launch screens, taps, events)
  3. In the Firebase console, open the Analytics dashboard and see whether your events appear in near real-time.